Knowing when to stop (DSP17)

You usually know the moment when you start forcing yourself to do something. When it’s a big goal of yours, you try to persevere and finish the whole thing. It’s not always about finishing, though. One of my colleagues that also took part in Get Noticed contest recently decided that he suspends his blogging activities.

Although I’m still able to finish the contest, I decided not to force myself to do it – I’ll still be working on Matchlogger (I actually implemented adding matches today), occasionally I might also write a technology post with the DSP2017 tag for the contest – but my goal isn’t those 20 posts anymore.


These are the main reasons:

I already achieved what I wanted

I wanted to push this blog into a more technology-oriented one, while still keeping my (mostly) travel and soccer blogging in Polish. That goal is certainly achieved – I’m quite proud of some posts, especially the ones related to Spring Boot. I’m not planning to stop writing about technology now, though I expect the frequency to be lower.

Posts were getting to be more low-quality

I have noticed that and you may have noticed that too – some posts were about resolving specific technical issues, some were just fillers that gave some information, but weren’t that helpful. There was an increase of the latter ones as I progressed with the contest. That was mostly related to lack of time for real development while still trying to succeed with the contest.

Other activities suffered

There are things that are more important than the others. I have an OCP exam scheduled for July which I completely stopped learning for. That’s a commitment that I did at work so I treat it as a more important one. I also have some other commitments or things that I just like doing more than trying to fit in two technology blog posts every week 馃檪

Adapt and deprioritize

So I’ve reconsidered my priorities and will be focusing on other things instead. Was it worth trying? Certainly. I now have some new people that I started following and know more about which technologies are currently hot in the community. I’ve also started using Zenhub and Travis CI which will be helpful tools.

And for those of you that aim to finish the contest, good luck! Have fun in Warsaw!

Matchlogger: April summary

Time for a summary of April in terms of Matchlogger. The summary would be short – it’s not going too well.

The only functional part of the application that I was able to work in April was adding matches. With that part, I haven’t even finished it yet. Apart from adding matches, I briefly experimented with adding Content-Security-Policy header to the application, but that also wasn’t finished. At this point, it is quite clear that with current pace, by the end of May I won’t yet have a working MVP of my application.

With blogging, it went much better. Even though I had to take a one-week break because of personal reasons, seven posts have been published in April and that one will be the eighth. Writing text was going well enough that I’m wondering if in my case blogging isn’t ahead of coding in this contest – as I have to write 2 posts a week and do some research for the app, but not necessarily write code. This month, technology posts had worse traffic than my travel- or soccer-related posts – while my live travel post (PL) brought 84 visitors to the blog, the best technology post had 27 visits.

How about the April posts?

  1. Where can I deploy my Java web app? – 11 visits
  2. Content-Security-Policy: manage security settings of your app – 10 visits
  3. Amazon Glacier: storing backups you don’t need too often – 10 visits
  4. 15 things you learn about Java for OCA exam – 9 visits

…and then there is an abyss of posts having a maximum of three visits.

What may be my May plan?

The plan is quite short – less blogging, more coding. Nearest planned issues I want to deal with are:

  • adding matches – it’s important to finish it.
  • recording that user went to the match
  • creating an admin panel for accepting new teams
  • deploying the application on a server.

The added problem is that during the last week of the contest, I won’t be blogging nor coding due to other commitments. So, in fact, I have three weeks. We’ll see if I manage to do all that 馃檪

Stay tuned for next Matchlogger updates!

Using reserved MySQL words as Hibernate field/table names

As I came back to Matchlogger development today after a short break, I wanted to implement adding matches. I added a Liquibase migration, created all the required repositories and an entity class that looked like this:

When I opened the application and triggered a controller method that aimed to get all matches from the database, I saw an error message and a stack trace that had a cryptic message at the top:

2017-04-24 20:08:29.337 WARN 3190 --- [nio-8080-exec-4] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 1064, SQLState: 42000
2017-04-24 20:08:29.337 ERROR 3190 --- [nio-8080-exec-4] o.h.engine.jdbc.spi.SqlExceptionHelper : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'match match0_' at line 1
2017-04-24 20:08:29.357 ERROR 3190 --- [nio-8080-exec-4] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet] with root cause

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'match match0_' at line 1
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_121]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance( ~[na:1.8.0_121]
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance( ~[na:1.8.0_121]
	at java.lang.reflect.Constructor.newInstance( ~[na:1.8.0_121]

Not exactly the most meaningful message. So I added more logs into (Spring Boot FTW):

Right now I at least had an SQL that I could run:

sql> select as id1_1_,
  match0_.first_team_id as first_te3_1_,
  match0_.match_date as match_da2_1_,
  match0_.second_team_id as second_t4_1_
  match match0_
[2017-04-24 20:09:08] [42000][1064] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'match match0_' at line 7

As you can see, the message is still cryptic. There is a mention of error 1064 here. I found a reference that suggested that it might be because of reserved words. DB engines use some specific words that may be part of their syntax and using them usually requires adding backticks to the name. Is match such a word? Turns out it is.

How to solve that?

The solution is simple. The only thing I needed to do was to add quotation marks to the table name in entity class:

You will see the same issue especially with users. An obvious choice is always naming the table with users records as user which is a reserved, well, anywhere I remember. I did foresee that one and named the table ml_user, but didn’t expect to come across the same issue with matches.