Skip to content

Advent of Code 2020: "Toboggan Trajectory" - Day 3

Have to admit, on first glance this challenge looks complicated. It's well suited for languages which can do string manipulations, but it's not well suited for PostgreSQL. Earlier today I already looked at this problem together with the kid, in Python. Therefore I already knew that I have to jump multiple rows as well. To sum it up: adjust x, including overruns, jump multiple rows in y direction, count trees along the way. All in a single SQL query.

Decided to do the map search in a pl/pgSQL instead, and write a function for it.

Task 1: you get a map of "." and "#", where the "#" are trees. You get instructions to move a certain number of steps into x and y direction, and see if there is a tree. Then repeat until the end of the map. A detail problem is that the number of fields in x direction is smaller than the y direction. There are no clear instructions how to handle this, but the correct solution is to just start at the leftmost position again.

Task 2: Repeat the task from task 1, but 5 times with 5 different instructions for x and y movement. The resulting numbers are to be multiplied.

Continue reading "Advent of Code 2020: "Toboggan Trajectory" - Day 3"
  • Twitter
  • Bookmark Advent of Code 2020: "Toboggan Trajectory" - Day 3 at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Advent of Code 2020: "Toboggan Trajectory" - Day 3
  • Bloglines Advent of Code 2020: "Toboggan Trajectory" - Day 3
  • Technorati Advent of Code 2020: "Toboggan Trajectory" - Day 3
  • Fark this: Advent of Code 2020: "Toboggan Trajectory" - Day 3
  • Bookmark Advent of Code 2020: "Toboggan Trajectory" - Day 3 at YahooMyWeb
  • Bookmark Advent of Code 2020: "Toboggan Trajectory" - Day 3 at Furl.net
  • Bookmark Advent of Code 2020: "Toboggan Trajectory" - Day 3 at reddit.com
  • Bookmark Advent of Code 2020: "Toboggan Trajectory" - Day 3 at blinklist.com
  • Bookmark Advent of Code 2020: "Toboggan Trajectory" - Day 3 at Spurl.net
  • Bookmark Advent of Code 2020: "Toboggan Trajectory" - Day 3 at Simpy.com
  • Bookmark Advent of Code 2020: "Toboggan Trajectory" - Day 3 at blogmarks
  • Bookmark Advent of Code 2020: "Toboggan Trajectory" - Day 3 with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Advent of Code 2020: "Password Philosophy" - Day 2

Day 2, another challenge: fix a broken password database. In order to do that, the passwords which violate the policy must be identified.

Task 1: I get a string, consisting of 2 numbers, a letter, and a password string. Check how many passwords have count(letter) which is between number 1 and number 2.

Task 2: The numbers are positions in the password string (beginning by 1, not 0). Exactly one of the two letters in the string must match the letter.

 

Continue reading "Advent of Code 2020: "Password Philosophy" - Day 2"
  • Twitter
  • Bookmark Advent of Code 2020: "Password Philosophy" - Day 2 at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Advent of Code 2020: "Password Philosophy" - Day 2
  • Bloglines Advent of Code 2020: "Password Philosophy" - Day 2
  • Technorati Advent of Code 2020: "Password Philosophy" - Day 2
  • Fark this: Advent of Code 2020: "Password Philosophy" - Day 2
  • Bookmark Advent of Code 2020: "Password Philosophy" - Day 2 at YahooMyWeb
  • Bookmark Advent of Code 2020: "Password Philosophy" - Day 2 at Furl.net
  • Bookmark Advent of Code 2020: "Password Philosophy" - Day 2 at reddit.com
  • Bookmark Advent of Code 2020: "Password Philosophy" - Day 2 at blinklist.com
  • Bookmark Advent of Code 2020: "Password Philosophy" - Day 2 at Spurl.net
  • Bookmark Advent of Code 2020: "Password Philosophy" - Day 2 at Simpy.com
  • Bookmark Advent of Code 2020: "Password Philosophy" - Day 2 at blogmarks
  • Bookmark Advent of Code 2020: "Password Philosophy" - Day 2 with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Advent of Code 2020: "Report Repair" - Day 1

Started "Advent of Code" with the kid, the kid is polishing the Python (and English) skills. I thought I better do this in SQL.

The task 1 for "Day 1" is: you get 200 numbers from the accounting department, find the two which in sum are 2020. This two numbers multiplied is the result of the task.

Task 2 is like task 1, except it's using three numbers. All three in sum will be 2020, and then multiply these three and that is the result.

 

Continue reading "Advent of Code 2020: "Report Repair" - Day 1"
  • Twitter
  • Bookmark Advent of Code 2020: "Report Repair" - Day 1 at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Advent of Code 2020: "Report Repair" - Day 1
  • Bloglines Advent of Code 2020: "Report Repair" - Day 1
  • Technorati Advent of Code 2020: "Report Repair" - Day 1
  • Fark this: Advent of Code 2020: "Report Repair" - Day 1
  • Bookmark Advent of Code 2020: "Report Repair" - Day 1 at YahooMyWeb
  • Bookmark Advent of Code 2020: "Report Repair" - Day 1 at Furl.net
  • Bookmark Advent of Code 2020: "Report Repair" - Day 1 at reddit.com
  • Bookmark Advent of Code 2020: "Report Repair" - Day 1 at blinklist.com
  • Bookmark Advent of Code 2020: "Report Repair" - Day 1 at Spurl.net
  • Bookmark Advent of Code 2020: "Report Repair" - Day 1 at Simpy.com
  • Bookmark Advent of Code 2020: "Report Repair" - Day 1 at blogmarks
  • Bookmark Advent of Code 2020: "Report Repair" - Day 1 with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Django: Change or translate the app name in the admin menu

Let's say I have a Django app "users". The admin menu shows this as category "Users". That's ok, but if the website users speak another language I want this name translated. Also I'm not necessarily using "Users" as name in the admin menu as section name, but can use something more descriptive. "Website Users", as example.

 

Continue reading "Django: Change or translate the app name in the admin menu"
  • Twitter
  • Bookmark Django: Change or translate the app name in the admin menu at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Django: Change or translate the app name in the admin menu
  • Bloglines Django: Change or translate the app name in the admin menu
  • Technorati Django: Change or translate the app name in the admin menu
  • Fark this: Django: Change or translate the app name in the admin menu
  • Bookmark Django: Change or translate the app name in the admin menu at YahooMyWeb
  • Bookmark Django: Change or translate the app name in the admin menu at Furl.net
  • Bookmark Django: Change or translate the app name in the admin menu at reddit.com
  • Bookmark Django: Change or translate the app name in the admin menu at blinklist.com
  • Bookmark Django: Change or translate the app name in the admin menu at Spurl.net
  • Bookmark Django: Change or translate the app name in the admin menu at Simpy.com
  • Bookmark Django: Change or translate the app name in the admin menu at blogmarks
  • Bookmark Django: Change or translate the app name in the admin menu with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Django: Remove default entries from admin menu

The Django administration site comes with a couple of default entries, depending on which apps and middleware is installed.

Usually there is at least "Users" and "Groups", and if the quite common "allauth" is installed, then there is also "Site", "SocialApp", "SocialAccount", and "SocialToken". They are not always necessary, especially when no Social Login is used. Or why have the "Site" administration when only Site=1 is used?

With a few tricks these can be removed from the admin menu.

 

Continue reading "Django: Remove default entries from admin menu"
  • Twitter
  • Bookmark Django: Remove default entries from admin menu at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Django: Remove default entries from admin menu
  • Bloglines Django: Remove default entries from admin menu
  • Technorati Django: Remove default entries from admin menu
  • Fark this: Django: Remove default entries from admin menu
  • Bookmark Django: Remove default entries from admin menu at YahooMyWeb
  • Bookmark Django: Remove default entries from admin menu at Furl.net
  • Bookmark Django: Remove default entries from admin menu at reddit.com
  • Bookmark Django: Remove default entries from admin menu at blinklist.com
  • Bookmark Django: Remove default entries from admin menu at Spurl.net
  • Bookmark Django: Remove default entries from admin menu at Simpy.com
  • Bookmark Django: Remove default entries from admin menu at blogmarks
  • Bookmark Django: Remove default entries from admin menu with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Huginn: Monitor changes in websites

The Huginn software is not only good for monitoring Twitter feeds, it can also be used to monitor websites for changes.

That's actually easy and needs only two agents:

 

 

Continue reading "Huginn: Monitor changes in websites"
  • Twitter
  • Bookmark Huginn: Monitor changes in websites at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Huginn: Monitor changes in websites
  • Bloglines Huginn: Monitor changes in websites
  • Technorati Huginn: Monitor changes in websites
  • Fark this: Huginn: Monitor changes in websites
  • Bookmark Huginn: Monitor changes in websites at YahooMyWeb
  • Bookmark Huginn: Monitor changes in websites at Furl.net
  • Bookmark Huginn: Monitor changes in websites at reddit.com
  • Bookmark Huginn: Monitor changes in websites at blinklist.com
  • Bookmark Huginn: Monitor changes in websites at Spurl.net
  • Bookmark Huginn: Monitor changes in websites at Simpy.com
  • Bookmark Huginn: Monitor changes in websites at blogmarks
  • Bookmark Huginn: Monitor changes in websites with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Django: disable inline option to add new referenced objects

The Django Web Framework makes it quite easy to add new referenced objects in the admin menu.

Let's say the model has two foreign keys in it:

class TeamMember(models.Model):
    team = models.ForeignKey(Team, on_delete=models.CASCADE, verbose_name=_("Team"))
    user = models.ForeignKey(CustomUser, on_delete=models.CASCADE, verbose_name=_("User"))

And the admin form:

class TeamMemberForm(forms.ModelForm):
    class Meta:
        model = TeamMember

class CustomTeamMemberAdmin(admin.ModelAdmin):
    form = TeamMemberForm
    add_form = TeamMemberForm
    model = TeamMember
    fieldsets = [
        (None,      {'fields': ['team', 'user']}),
    ]

admin.site.register(TeamMember, CustomTeamMemberAdmin)

Then Django will show small a small green "Django add reference" sign next to the fields:

Continue reading "Django: disable inline option to add new referenced objects"
  • Twitter
  • Bookmark Django: disable inline option to add new referenced objects at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Django: disable inline option to add new referenced objects
  • Bloglines Django: disable inline option to add new referenced objects
  • Technorati Django: disable inline option to add new referenced objects
  • Fark this: Django: disable inline option to add new referenced objects
  • Bookmark Django: disable inline option to add new referenced objects at YahooMyWeb
  • Bookmark Django: disable inline option to add new referenced objects at Furl.net
  • Bookmark Django: disable inline option to add new referenced objects at reddit.com
  • Bookmark Django: disable inline option to add new referenced objects at blinklist.com
  • Bookmark Django: disable inline option to add new referenced objects at Spurl.net
  • Bookmark Django: disable inline option to add new referenced objects at Simpy.com
  • Bookmark Django: disable inline option to add new referenced objects at blogmarks
  • Bookmark Django: disable inline option to add new referenced objects with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Volkswagen Golf 8

Vor einer Weile standen wir vor dem Problem dass wir ein neues Auto brauchen.

Zu den Gründen warum wir dann doch ab und zu ein Auto brauchen, und warum es kein Elektroauto geworden ist, steht mehr am Ende des Artikels.

Nachdem feststand, dass wir ein neues Auto brauchen, haben wir eine Weile gesucht, Probe  gefahren, Autohäuser besucht ect. Manches hat uns nicht gefallen, bei manchen Autohäusern sind wir auf unfreundliche Verkäufer gestoßen, manche haben sich nie wieder gemeldet. Der größte Teil war jedoch in Ordnung. Letztendlich hatten wir eine Liste von drei verschiedenen Angeboten, und haben uns dann für einen Golf 8 (Modell 2021, in schwarz, ganz wichtig, mit Schiebedach, auch ganz wichtig) entschieden.

Der Golf ist ein grundsolides Auto. Verarbeitung und Aufbau sind in Ordnung. Man merkt dem 8er aber an, dass Volkswagen krampfhaft versucht das Auto “online” zu bringen und mit digitaler Technik voll zu packen. Hier sind meine Beobachtungen nachdem das Auto jetzt eine Weile hier ist.
 

 

Continue reading "Volkswagen Golf 8"
  • Twitter
  • Bookmark Volkswagen Golf 8 at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Volkswagen Golf 8
  • Bloglines Volkswagen Golf 8
  • Technorati Volkswagen Golf 8
  • Fark this: Volkswagen Golf 8
  • Bookmark Volkswagen Golf 8 at YahooMyWeb
  • Bookmark Volkswagen Golf 8 at Furl.net
  • Bookmark Volkswagen Golf 8 at reddit.com
  • Bookmark Volkswagen Golf 8 at blinklist.com
  • Bookmark Volkswagen Golf 8 at Spurl.net
  • Bookmark Volkswagen Golf 8 at Simpy.com
  • Bookmark Volkswagen Golf 8 at blogmarks
  • Bookmark Volkswagen Golf 8 with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Search objects based on a specific criteria (Key:name:etymology) in JOSM

This posting is mainly a reference for myself, because I was looking for this specific issue a couple times.

OpenStreetMap (OSM) is a map of the world, created by anyone who wants to contribute. It so happens that data might be missing (just go and add it, if you see that something is not on the map). It also happens that someone adds too much data.

In my case someone added "Wikidata" entries to each and every footpath.The OSM folks in Berlin made a great effort to find the etymology of names, and add them to Wikidata. And then link the street names to the Wikidata entries. That's nice and very useful, but it's enough to do that for streets. Not for every path, including the underground parking.

I raised this in the Berlin Telegram channel, and we agreed that it's best to keep the etymology tags to the main streets. Now I had to find all the entries which were tagged with a Wikidata entry, and update most of them.

 

Continue reading "Search objects based on a specific criteria (Key:name:etymology) in JOSM"
  • Twitter
  • Bookmark Search objects based on a specific criteria (Key:name:etymology) in JOSM at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Search objects based on a specific criteria (Key:name:etymology) in JOSM
  • Bloglines Search objects based on a specific criteria (Key:name:etymology) in JOSM
  • Technorati Search objects based on a specific criteria (Key:name:etymology) in JOSM
  • Fark this: Search objects based on a specific criteria (Key:name:etymology) in JOSM
  • Bookmark Search objects based on a specific criteria (Key:name:etymology) in JOSM at YahooMyWeb
  • Bookmark Search objects based on a specific criteria (Key:name:etymology) in JOSM at Furl.net
  • Bookmark Search objects based on a specific criteria (Key:name:etymology) in JOSM at reddit.com
  • Bookmark Search objects based on a specific criteria (Key:name:etymology) in JOSM at blinklist.com
  • Bookmark Search objects based on a specific criteria (Key:name:etymology) in JOSM at Spurl.net
  • Bookmark Search objects based on a specific criteria (Key:name:etymology) in JOSM at Simpy.com
  • Bookmark Search objects based on a specific criteria (Key:name:etymology) in JOSM at blogmarks
  • Bookmark Search objects based on a specific criteria (Key:name:etymology) in JOSM with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Add a Google Calendar to openHAB

openHAB can integrate Google Calendars. The functionality is kind of limited, it can only see the current and the next calendar event, but in my case that is enough. More about the use case in another blog post.

There are three different calendar bindings available, let's have a quick look:

  • CalDAV Personal Binding: this is a v1 binding, which means it will no longer work in the soon-to-be-released openHAB v3. Apparently this works with Google calendars, but has performance issues. It can show the current and next event.
  • Google Calendar Scheduler: also a v1 binding. Needs more work for presense simulation, and additional bindings.
  • iCalendar Binding: v2 binding, should work with v3. It can show the current and next event. That's the one I'm going to use.

 

Continue reading "Add a Google Calendar to openHAB"
  • Twitter
  • Bookmark Add a Google Calendar to openHAB at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Add a Google Calendar to openHAB
  • Bloglines Add a Google Calendar to openHAB
  • Technorati Add a Google Calendar to openHAB
  • Fark this: Add a Google Calendar to openHAB
  • Bookmark Add a Google Calendar to openHAB at YahooMyWeb
  • Bookmark Add a Google Calendar to openHAB at Furl.net
  • Bookmark Add a Google Calendar to openHAB at reddit.com
  • Bookmark Add a Google Calendar to openHAB at blinklist.com
  • Bookmark Add a Google Calendar to openHAB at Spurl.net
  • Bookmark Add a Google Calendar to openHAB at Simpy.com
  • Bookmark Add a Google Calendar to openHAB at blogmarks
  • Bookmark Add a Google Calendar to openHAB with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca