Jackdaw's Nest

Google's Oct 4th Big Event

  • 2017-10-05

Google has a big event later today and it's expected to release a new high-end Chromebook. I've had my eyes on a new laptop for some time now and I'm even considering a Chromebook.

The previous Google Chromebook Pixels were gorgeous devices. The biggest problem with them was their availability here in Finland. I guess you could have ordered them somehow from the States but you wouldn't have a Finnish/Swedish keyboard and probably would avoid warranty and what not. So the previous Pixels were pretty much non existent for me. I'm hoping this time will be different.


Ember Frustration, Data Relationships

  • 2017-09-13

I've been building a large web app for about two years. The front end is made with Ember.js. We have a team of two people and for both of us this was the first really large scale single page app we have written.

Honeymoon Period

Ember was very good to start with. It gave us all the build tools and project structure to start with. Even with so little experience we were able to start writing our business logic in day one.

The Reality Kicks in

But, when your experience and needs grow you suddenly realize that in many cases you are fighting the framework. Of course, Ember has good intentions and most of the time everything works as expected and there's a lot off cool magic that Ember does for you.

But every now and then you need to do something in a non-Ember way. Maybe you're working with a legacy API or your data model doesn't quite fit Ember's way of thinking. And this is when things get frustrating. You find yourself fighting the framework which is just trying to do your work and does it wrong. It can be difficult to tell Ember to back off a bit and give you more space to do your own thing.

Now I've hit one of those moments. We have some relatively complex data models, although in this case they are used in a very simple way. Sometimes I'd just like to be able to call an API and process the raw data without Ember intervening.

Of course, there's always an Ember-y way of doing things but sometimes I'd just like to take a short cut and have my own way. But in a way, Ember forces you to use some good programming practices and I have to give them credit for that.


The State of Facebook Instant Articles

  • 2017-09-13

Facebook has just removed Instant Articles support from Messenger. I don't use Messenger that much and, frankly, I hadn't even noticed Messenger also supported Instant Articles.

But why did Facebook drop support from Messenger after just over a year? I'm guessing Instant Articles just aren't popular enough and the Messenger team wants to concentrate their efforts on something else. Initially I liked the idea of Instant Articles and the fact that it's built on RSS technology. But building a separate feed just for Facebook felt weird, and the open web lover in me was a bit irritated.

And I guess I wasn't the only one to be irritated. Instant Articles were targeted at major news publishers and I guess they had their concerns as well. Most media houses are struggling with online media these days but apparently Instant Articles weren't the answer publishers we're looking for.


Ember "No model was found for `user-role?`"

  • 2017-09-13

I added a new model in Ember called user-role. It's no different to any of the other 30+ models the app has. But out of the blue I get this error in the console:

No model was found for 'user-role'

I get this error when I'm requesting the user model from the API. user model has a hasMany relationship to user-role models.

Our user model already has at least three hasMany relationships to other similar models and they work just fine. I'm completely lost why this is happening.

UPDATE almost two hours later I renamed the user-role model to userrole and everything works as expected. I've been using Ember for over two years almost on a daily basis and I'm still lost with their naming conventions. user model also has a hasMany relationship to user-relationship model and it works just fine. There must be some difference how the data is loaded from the API.


Dear Google, Why Don't You Know What Kind of Music I Like?

  • 2017-09-13

Dear Google, you probably know me better than I do myself. I know you know that I listen to a lot of music every day. You already have all the music I've ever owned and even some albums that actually belong to my kids.

I used to rely on your arch enemy, Spotify, to recommend me new and interesting music I didn't even know existed. Recommendations work great in Spotify. For example, I've recently discovered some hidden gems such as Mt. Wolf and Zola Blood.

Why, Dear Google, didn't you recommend me these bands? Also, you already know I own seven Tori Amos albums, so why didn't you think I would be interested in her latest record? Or Sleep Well Beast by The National that I've listened to hundreds of times using your Google Play Music service?

Don't you care enough of me to remember what kind of music I like? Or is Google Play Music just one of your side projects that will get shut down when you start another project (yes, I'm thinking Google Reader)?

Please, dear Google, remind me when there's some great new music available. It's okay to even wake me up everytime Tori Amos releases a new album. Or The Cure, or Björk. Or any of the other all-time favourites that I have. But you already know those, don't you? Don't you?


Easy Trick to Show Translation only if it Exists in Symfony

  • 2017-03-07

I had a problem. I needed to show a translated piece of text based on a route parameter. For instance, I wanted route /category/symfony to show a translated description of symfony.

What I tried was to create translations like this

category: symfony: Symfony is a framework and...

Now the problem I had is that I don't want to write descriptions to all of the categories. For instance, if I tried to access route /category/twig I would only see category.twig because the translation is missing.

I was a bit surprised that I couldn't find a way to show an empty string if the translation key is not defined. I came up with a simple solution like this inside the twig template

{# Set the translation key #} {% set translationKey = "category." ~ category %} {% if (translationKey | trans) != translationKey %}

{{ translationKey | trans }}

{% endif %}

That does the trick. This piece of code will show the translation only if the trans filter returns something else than the translation key itself. Probably not the most elegant solution but it works for this use case.


Searching

  • 2017-01-13

Wohoo! I just put a search feature on my blog :) Check out the top right corner.