Saturday, 26 May 2018

HouseScanner: Motivation

I now have a small family and we live in a small flat in Malmö. We don't plan to live like that forever, and therefore we are looking for houses in the area.

Some of the requirements for the house are:

  • Location (not too far from our work locations)
  • Price (both a total price and a cost per square meter and per month)
  • Local tax rates in the town we want to settle down.

I'm using a spread sheet to keep track of some houses, in order to see a price trend over time and to be able to compare between houses. Until now, I've entered the information manually:

  • Date when the add was published
  • Address
  • Town
  • Starting price
  • Taxation value
  • Number of rooms
  • Maintenance costs
  • Year the house was built
  • Living area
  • Other area
  • Garden area
  • Travel time from my work to the house
  • Travel time from my wifes work to the house
  • Final price (Updated when the house is sold)
  • Contract date (Updated when the house is sold)
  • Estimated renovating costs (A guesstimate based on the pictures and text in the ad)
  • Calculated monthly costs, both for 2% and 6% interest rates.

Some of the parameters can be fetched automatically. I've marked them in bold.

I use the parameters to estimate a monthly cost, and also a monthly cost per square meter. That cost is calculated as the sum of:

  • the monthly cost at an interest rate of 6%
  • the estimated need of renovations, multiplied by 4% and divided by 12,
  • the estimated increase/decrease in travel time, in terms of minutes per month multiplied by 3
  • the changes in local taxes and 
  • whether the house is in Lund or not (with a penalty of 2000 SEK if it isn't in Lund). We love Lund and we want to live there!

Fetching all those parameters is a very time consuming task and in the next blog post, I'll try to automate some of them to save time.

Saturday, 19 May 2018

Trains: Boiled, Fried or Mashed?

The local newspapers reported about two nasty incidents that ended well.

In Tomelilla, an off-duty firefighter found a four-year old child alone in a car. The weather was sunny and the temperature was quite high outside the car and very high inside the car.

Together with his officer, they started breaking in to the car. The mother arrived and unlocked the car. Luckily, the child didn't suffer any damages after spending at least fourty minutes in that car.

As a parent, I hope that I will never meet a child inside a locked car. If I do, I hope that I have the courage and presence needed to help that child. Being in a hot car is extremely dangerous.

Some sixty kilometers westbound, a similar incident occurred. Hundreds of passengers, including pregnant women, elderly people and small children found themselves trapped in a powerless train outside Malmö.

The internal loud speaker system failed, and after some fifty minutes, the passengers opened the train doors and went out on the tracks, where trains were operating in the opposite direction.

On a train, one should always follow the train personnels directions. But what to do if the clock is ticking, and the temperatures keep raising without any information? In the former incident, the necessary actions should be obvious. In the latter, one needs to consider the train operators ability to act,

I don't blame the people that left the train, even with the risk of being on the tracks in mind. However, the train operator needs to find out how to act. The passengers shouldn't need to choose between risk beeing overheated, electrocuted or run over by other trains.

Saturday, 12 May 2018

Important Stuff

Today, I had more important things to do than blogging.

She said yes.

Saturday, 5 May 2018

TrafficControl: Refactoring and User Interface Fixes

After adding a toolBar for hiding/showing the different windows of the program, I need to review and refactor my code.

Before adding a widget that helps the user to create a network file, I need to review/refactor the code and fix some bugs. One of them is that when resizing the dockWidgets for tracks/trains/stations, those widgets reset their sizes immediately.

Another bug is that the buttons in the toolbar aren't changed when the windows are closed using the "x" button on the top right. Fix: Connect the signal visibilityChanged to the same slot as the buttons are connected to. In that slot, update both buttons and 


In this code review, I'll focus on variable names, documentation of functions and whether there is redundant code or not. I'll also omvestogate the need of new test cases.

Saturday, 28 April 2018

TrafficControl: Understanding Qt Sizepolicy and a Floating Map

Making Qt set the size of the dockWidgets has been a challenge for me. I truly need to understand the sizing policies to make the dockwidgets behave as I want.

The map dock widget should have a small minimum size and it should expand as much as possible when there is room. Achieving this when docked is difficult, will add complexity to my program and it will be of limited benefit for the end user. It seems that it is hard to resize dockWidgets in main window.

According to some blog posts, it is possible to re-implement sizeHint to control its behaviour. See also this blog post.

In this case, I'll simply make mapDockWidget floating so that the user can resize it later. The user can also dock the widget to the main window if required.



I've seen that the zoom and pan of the map is reset once the map is resized. I need to investigate that.

Saturday, 21 April 2018

TrafficControl: Adding Menu, Toolbar and Statusbar

After adding button icons to the user interface, I've moved them to a menu and a toolbar.



Adding buttons to a toolbar is quite straight forward. I added the spinbox to the toolbar in the source code.

I have disabled the button "step one second" when the simulation is running.
The text related to the action/button changes when the state changes between running and paused,
The messages (time and time consumption) were added to the statusbar from the source code too.

The next step will be to ad a second toolbar that will control the different widgets.


Saturday, 14 April 2018

TrafficControl: Adding Button Icons to the User Interface

The first button I added is replacing the "Continue with ticks" checkbox.

A QPushbutton was added and made checkable using setCheckable property, I connected the signal checked(bool) to a slot that is changing the icon of the button when it is clicked.

Left to right: Import Network button, Play/Pause and Step one second.

When the simulation is running, the play button is transformed to pause.
In the next blog posts. I'll add a menu, status bar and a tool bar to the program. Using that tool bar, the user should be able to hide and show the different dock widgets.

Icon Credits: https://icons8.com/