Time travel 101

  • Post category:icalJava

Suppose you take 2:30 AM at some random day in the year, and add 366 times one day to it, when do you end up? Yes… 367 times if it’s a leap year, wise guys. But still, when do you end up?

Calendar cal = new GregorianCalendar(2020, 11-1, 1, 2, 30);
cal.setTimeZone(TimeZone.getTimeZone("Europe/Rome"));
ZonedDateTime zdt = ZonedDateTime.of(2020, 11, 1, 2, 30, 00, 00, ZoneId.of("Europe/Rome"));
for (int i = 0; i < 366; i++) {
	System.out.println(cal.toInstant() + "   " + zdt);
			
	cal.add(Calendar.DATE, 1);
	zdt = zdt.plusDays(1);
}

Take a guess before reading on!

(more…)

Continue ReadingTime travel 101

The correcting case of the closed-off cloud

That title sounds like one from a boy’s book, a Tintin (Kuifje) or Spike and Suzy (Suske en Wiske) comic, but this blog is about Tesla, cloud computing, and hexagons.

In the middle of September 2020 Tesla suddenly blocked all network traffic originating from any of the major cloud providers, like Amazon, Google and Microsoft. A number of of third party Tesla apps were suddenly in big problems because of this, including my TeslaTasks. A lot of developers had to scram to work around that unexpected situation.

(more…)

Continue ReadingThe correcting case of the closed-off cloud

TECL

People have complaints about configuration languages all the time; properties are too simple, XML is too verbose, JSON doesn’t allow comments, YAML is only suited for small configuration files, TOML’s tables are a bit weird (IMHO). So how about we throw all the good aspects onto a heap and see what comes out of it? And with only one task in mind: configuration. (Just like JSON is intended for datatransfer, hence it does not support comments.) Therefor I’m introducing TECL, the Totally Encompassing Configuration Language. But the name is open for suggestions. 😀

The goals are:

  • Simple, like properties, but supporting a hierarchy
  • Compact, like JSON, but allowing comments
  • Formal hierarchy, unlike YAML’s indentation based one
  • Schema support
  • Conditions
  • Multi line strings
  • Tables
(more…)

Continue ReadingTECL

Corona: Netherlands vs Italy

There is a lot of fuss about the Netherlands blocking aid to Italy. To prevent any misunderstanding (especially by my non Dutch readers), I’ve written this small explanation. And I’ll be using the words “sneaky bastard”. 😀

After the banking crisis in 2008 the Dutch national debt grew to 68% of our GDP, well past the maximum of 60% required by the EU. As a result we started to reduce expenses, and in 2019 our debt was below 50%.

In the same period Italy’s debt grew as well, but they never reduced their expenses. So it kept on growing to 138% in 2019. They were addressed on this by the member states of the EU, but the populist government gave the EU the big finger.

(more…)

Continue ReadingCorona: Netherlands vs Italy

Corona – devilish dilemmas

This blog is just based on my own opinion, as a software engineer I do not have the qualifications to have a professional one.

The situation

Corona has arrived. The world has dodged the bullet with SARS and MERS, but the third time seems to be the charm, and a pandemic is rolling around the globe as I type this. Corona isn’t like the zombie virus from the movies, it’s closer to a standard influenza flue, except that the human world population has never encountered it before and thus no one has any immunity. The infection rate is higher than that of influenza.

Let’s examine some rough numbers, they don’t need to be exact for the point I want to make. Experts seem to agree that 60-70% of all people will get the corona virus. Given a country like the Netherlands with just over 17 million people, that will mean around 11 million people. About 80% of those will only get mild or moderate symptoms, which can go away in 3 days, but can also last up to two weeks. In any case no hospital care is required. It’s the remaining 20% that is the cause for alarm, because those need medical care. And with 11 million infected people, that would mean over 2 million people will be in the hospital. But our country only has 37.000 hospital beds. Total.

Now, those two million people will not become sick all at the same time, but assuming the severe cases are sick for two weeks, than we have 4 million hospitalbed-weeks to handle. This means that given the current capacity, we need 108 weeks worth of these 37.000 beds. Or in other words: we need to spread out the sick people over more than two years. And that is at 100% hospital capacity; there is no room for anything else in the mean time; no accidents, no cancer, no nothing.

Okay… So that is not going to work out. At all.

(more…)

Continue ReadingCorona – devilish dilemmas

Scheduling things on a Tesla using Azure pt. 5; parsing the action

We’re down to the last piece of the puzzel; calendars are examined in a regular interval, we can tell the cars what to do, but those two need to be connected.

It is very practical to quickly see in a calendar what will be happening, and the summary field of an appointment is rendered in any view, so that is the best field to use. Other fields like description are often only visible in a detail view. Below is how I’ve currently setup my Tesla this February (which is winter).

My car goes into a security cam mode every night between 2 and 6 am, by activating sentry mode at home. And I’m making sure the doors are locked and the sun roof is closed. I could also schedule charging at that time, but I want my car to be fully charged ASAP. At weekdays I’m preconditioning the car early in the morning, which means heating up the battery and the cabine. We have a lame winter this year, so that suffices to remove any ice on the windows, but if it were really cold I’d put in “defrost”. You can see that my current schedule takes me to a different project on Tuesdays, with less driving time, so I can leave later.

(more…)

Continue ReadingScheduling things on a Tesla using Azure pt. 5; parsing the action

Political correctness

Now I’m really going off the deep end with respect to what this blog is supposed to be about. But since it is a personal blog, I’m allowed to do that. And it is something I seem to run into more frequently: political correctness.

The trigger for this blogpost is the newspaper of this morning; school changes “carnaval” to “dress up party”, because carnaval is a faith related festivity (Roman Katholik to be exact) and they are a public school.

Really?

Carnaval may be faith related, but it’s not like they are not going to celebrate it. The whole southern half of our country does, Katholik or not, and it’s simply called carnaval. It has to have a name, you know, so people know what you are talking about. Dress up party is what children do, carnaval is something quite different.

By now we’ve changed the name of pastries; “moorkop” became “roomkop” because it referred to someone with a dark skinned head, and yes, it is made with dark chocolate. We’ve undarken black piet into someone with smears. And the list goes on and on. Everything needs to be politically correct nowadays, so that no one can be offended.

There’s a lot of whip-cream inside
(more…)

Continue ReadingPolitical correctness

Scheduling things on a Tesla using Azure pt. 4; Google calendar

Having made good progress on the Tesla side of the implementation, it’s time to take a look at how to implement the calendar integration. But first, let’s examine why to use a calendar in the first place. After all, there are many solutions that implement similar functionality, for example using timers (like Tesla does in the car).

Personally, to be honest, I would be totally lost if it were not for a digital calendar. Google calendar to be precise. I forget things, so I register everything in it. Not everything needs to send out reminders, but just not forgetting that my son has his basketball training every Tuesday and Thursday evening, prevents me from making some kind of commitment that will cause conflicts.

In other words: my life is in that calendar. That means also the things I need to get into my car for. So my calendar seems like the perfect place to also administer when I need my car to prepare itself for driving, by defrosting or whatever. And if an appointment changes, I immediately see that that part also needs to change. Like generating documentation from code.

(more…)

Continue ReadingScheduling things on a Tesla using Azure pt. 4; Google calendar

Scheduling things on a Tesla using Azure pt. 3; the Tesla API

In the previous post we took a look at how the initial just-for-my-own-car implementation was refactored into a version that supported many cars using a database instead of hardcoded values. It also showed that the LogicApp based implementation lost its merrits, and everything was moved into Java code. In this part we’ll take a look at the Tesla API that is used to make the car do things.

(more…)

Continue ReadingScheduling things on a Tesla using Azure pt. 3; the Tesla API

Scheduling things on a Tesla using Azure pt. 2; from one to many

  • Post category:azureJava

Some time has passed since my previous post about fixing the issue that a Tesla does not allow scheduling preconditioning (de-icing) the car prior to a drive in the winter. The original post used an Azure Logic app as its core.

AzureLogic

What you see above is a Logic app for my car only; the first step “When an event starts” is linked to a Tesla calendar in my personal Google Calendar. The “StartHVAC” and “EndHVAC” call out to serverless functions that hardcoded contain the data for my personal car. And the emails go to a hardcoded email address of mine. Totally not reusable, but working.

After publishing that post, people started to ask if they could use the same functionality as well. Ahm, I did just say it was not reusable, didn’t I? But being a good friend, I ventured out and rewrote the whole thing to support multiple calendars and cars.

(more…)

Continue ReadingScheduling things on a Tesla using Azure pt. 2; from one to many