Jackdaw's Nest A Web Log

[ Log ] [ About ]

# 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 lookng for.

# Don't Use includes(), use indexOf() Instead 2017/09/12

I always forget that Internet Explorer does not support includes. Use indexOf instead. Luckily Edge is one step ahead and already has support.

# Ember "No model was found for `user-role?`" 2017/09/12

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/11

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

	  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 %}
   <p>{{ translationKey | trans }}</p>
{% 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.

# AWS London Region Open 2016/12/15

AWS has just opened a new region in London making the total number of regions 16, of which three are in Europe. When will we see the first one in northern Europe? Finland, maybe? :)

Google is already here enjoying the cold weather and Yandex heats up a small Finnish town with their datacenter. Where's AWS?

# AWS Elastic Beanstalk: First Impressions 2016/12/02

I've been building my first app in AWS Elastic Beanstalk. There's a lot to like in this platform.

There's a learning curve when you setup the system, but once you're done everything seems to be working smoothly. Deployments are easy from command line and I haven't had any problems so far.

Here's the things that I like the most:

I'm still learning and I'm probably not utilizing the full potential of Elastic Beanstalk.

# Telegraph by Telegram 2016/11/24

Telegram, the company known for their messaging app, has just published a blogging tool called Telegraph.

To try it, go to telegra.ph, publish a story, and share it on Telegram. With Telegraph, your Telegram channel can run stories just like the mainstream media (although you may find it tricky to become as biased).

Telegram Blog

This is interesting. Of course, I had to try it myself :) Here's my first Telegraph post. I really like the simplicity and the Medium inspired editor is really pretty and minimalist. You don't have to (and cannot) signup which adds to the simplicity. Since you cannot create a user account, anyone can post anything under any name. This might become a problem, and you need to be extra careful when you're reading posts in Telegraph.

It's going to be interesting to see what people will do with this. I know there's a need for public, anonymous posting tools, but I'm afraid Telegraph might end up filled with crap and fake news and whatnot. But we'll see, lets be optimistic.

# Google Search Going Mobile First 2016/11/08

our algorithms will eventually primarily use the mobile version of a site’s content to rank pages from that site

Google Webmaster Central Blog

Just a few days ago the news broke that mobile Internet usage exceeds desktop globally and now Google's search index will start using mobile versions as its primary source.

Do you need more convincing that you should take mobile Internet seriously?

# Mobile Internet Usage Exceeds Desktop 2016/11/04

Internet usage by mobile and tablet devices exceeded desktop worldwide for the first time in October according to independent web analytics company StatCounter


This has been coming for a long time. If this isn't a big enough a reason to check how your site works on mobile then I don't know what is.

# Long Term Support in the JS World 2016/10/18

Ember.js, one of my favourite JavaScript frameworks announced in February that they will release Long Term Support (LTS) versions of Ember.js.

The LTS version will receive security fixes for 60 weeks. Sixty weeks? Long term?

I guess that's considered a long term in the JS world. Anyway, it's a very welcome announcement for anyone who creates enterprise software.

# Chat and the Consumerization of IT 2016/10/18

The only thing that has grown faster than Slack’s user base and valuation is its hype and mindshare among the tech press

Stratechery by Ben Thompson

Well said. It's an interesting article covering a lot of the different ways how enterprise software is being sold today.

# JavaScript Frustration 2016/10/05

I'm starting to get frustrated with all the front-end development kits. I'm more of a back-end guy and I've been spoiled by Symfony's long term support, excellent documentation and punctual release cycle. I wish some JS frameworks would offer the same kind of enterpriseyness.

# AWS Cognito 2016/09/29

I've just done my first tests with AWS Cognito. It's pretty cool but I haven't done anything substantial with it yet.

# AWS CloudFront Supports HTTP/2 2016/09/28

Today we are launching HTTP/2 support for CloudFront.

AWS Blog

This is great! It seems Amazon is pushing HTTPS everywhere with their recent announcement of free SSL certificates and now HTTP/2 support.

# Is Facebook a Media Company? 2016/09/28

Is Facebook a media company? Ben Thompson of The Stratechery is once more spot on in his analysis. Read more here.

# Playing Around with PHP Caching Static Files 2016/09/28

For some reason I've never used var_export before, but it seems like a useful tool for caching PHP objects or arrays.

I just read a blog post about using the filesystem as a cache for full PHP objects and the results can be pretty good.

# SimpleMDE MarkDown Editor 2016/08/25

I just came across SimpleMDE MarkDown editor which seems really cool. It's simple and elegant and has some nice features that make it easier to understand the syntax. I've just done some simple tests but it seems very promising.

# Keep Your WordPress Plugins Updated 2016/04/12

It seems that the Panama Papers have been leaked thanks to a vulnerable WordPress plugin and an outdated Drupal version.

Remember to keep your servers and software updated. And running email servers in the same network with a public WordPress server is probably not agood idea either.

# Note to Self: Check out Ionic Framework 2016/02/19

I just recently came across Ionic Framework. It seems pretty sweet. It's like Angular.js, some front-end styling and Cordova combined. Creating hybrid mobile apps and styling them to look like native apps seems to be easy.

I have to check this out in more detail.

# Static Site Generator Buzz 2016/01/27

It seems that there's quite a buzz lately in the static site generator world. There's a good summary in Smashing Magazine and SitePoint predicted that 2016 is the year Static Sites will go mainstream.

It seems that every coder is creating a static site generator of their own.

# End of the Week Reflections 2016/01/15

I had an amazingly productive day today. Especially for a Friday :) Actually, the whole week has been more productive than average despite the lack of sleep in the last couple of days.

I've been reading a lot, and coding a lot. Both at the office and at home.

# Fresh Coffee from Slurp 2016/01/09

There's a cool new company called Slurp and I'm a fan! They get coffee from small roasteries around Finland and send it to you on a monthly subscription. I get freshly roasted beans twice a month delivered right into my mailbox.

This is simply brilliant. I live in the middle of nowhere and the selection of coffees in my local grocery store is rather limited. Nearest roastery is about 35km away. Slurp is a perfect way to get to try out new coffees from small roasteries.

I've just got my first batch of beans and I'm drinking my Saturday morning cappuccino. I don't think it gets any better than this.

# CloudFront Supports gzip 2015/12/20

Amazon CloudFront can now compress your objects at the edge. You can now configure CloudFront to automatically apply GZIP compression when browsers and other clients request a compressed object with text and other compressible file formats.

Amazon AWS

This is great news, it's about time. Hopefully HTTP/2 comes next, right Amazon?

# Symfony 3.0.0 released 2015/12/01

Wow, Symfony 3.0 has been released.

I have to say I'm a big fan of the Symfony release process. It's very professional and perfect for projects that need years of support.

I realise that talking about Symfony 3 makes people nervous and this post is going to explain the Symfony 3 strategy and the reasons why you should not panic.

Fabien Potencier / Symfony Blog

So, don't panic. Actually, 3.0 is not really that big a leap forward. It's nothing compared to the leap from Symfony 1 to Symfony 2. Just look at the upgrade guide. Of course, there are changes that you need to make, but most of the changes are in methods that have already been deprecated in previous versions.

I haven't tried updating yet but I will try it soon.

# Playing Around With Symfony Service Container 2015/11/30

Lately, I've been playing around with the Symfony Service Container. For some reason, I've never really liked it that much and I've prefered Pimple that comes with Silex framework. Defining services in YML files instead of plain PHP always felt odd.

But I think I've changed my mind now. I've just created a largish project in Symfony and now I quite like the Symfony way of defining the services. It gives you a nice distinction between configuration and your business logic. Defining the services in YML is just the configuration part, and PHP is only used for real code. That's actually pretty nice and feels good after you get used to it.

# Square's Valuation Bubble 2015/11/20

Square went public today, raising $243 million, a price that values the company around $3 billion. That's about half the $6 billion valuation it received during it's last funding as a private company.

The Verge

This is a good reminder that the high valuations of some startups might not be accurate. Of course, that's the nature of the startup scene, but a 50% reduction in valuation after going public is a slap in the face.

# Refreshingly Anti-Disruptive Thoughts on Startups 2015/11/16

Part of the problem seems to be that nobody these days is content to merely put their dent in the universe. No, they have to fucking own the universe. It’s not enough to be in the market, they have to dominate it. It’s not enough to serve customers, they have to capture them.

Signal v. Noise

Ahh, this is a refreshing read. David from Basecamp writes a slightly ranty post about what's wrong with the whole startup scene. Not everyone needs to be chasing unicorns or trying to own the universe.

I really like David's approach to business. And I think this the best way to do business in the long term. I've had enough bad luck with startups getting acquired and seeing their service closed down. Or the company going bankcrupt because the founders or investors were unable to come up with a profitable business model. Personally, I'm getting wary about heavily funded startups that don't have a clear business model. I don't see the long term future in them.

The post is full of great quotes I'd like to add here.

There’s an incredible connection possible when you align your financial motivations with the service of your users. It’s an entirely different category of work than if you’re simply trying to capture eyeballs and sell their attention, privacy, and dignity in bulk to the highest bidder.

I'll leave it at that.

# Note to Self: Check out Aurelia 2015/11/16

There's a hot new name in the JavaScript world: Aurelia. This one goes straight to the top of my tools-to-check-out list.

It's still in pre-beta, but it looks interesting. Documentation is good (especially for a pre-beta) and it seems to focus on real world use cases like routing instead of trying to be the fastest framework or rendering engine compared to others.

From a first glance one of the coolest things in Aurelia is the fact that it relies heavily on plain JavaScript classes and ES2016. So most of the code you write is just plain JavaScript and not tightly coupled to Aurelia. I've been wanting to try out some of the new features of ES2015 and ES2016 and now I've got a great chance to try out ES2016 and a new framework.

ps. If you're confused with all the ES5, ES6 and ES-whatnot names, here's a good explanation by Ben McCormick.

# Fixing IE Compatibility View Errors 2015/11/05

I mostly hate Internet Explorer. Well, hate is a strong word, but I strongly dislike it. Sometimes it just makes the life of a web developer much more difficult.

What's Wrong?

One of the issues I've had lately concerns Compatibility view. Consider yourself lucky if you've never heard of it. In the old days (<IE9) Internet Explorer was notoriously bad in supporting web standards. Due to its market share in the corporate world a lot of company sites and intranets were designed specifically for IE.

Microsoft has cleaned up its act and things are much brighter since IE10. Except for those using the old web sites designed for older IE versions. This is where compatibility view comes in. It makes the new browsers render web pages as if they are old browsers. If you only develop modern, standards compliant web sites, you can call this brake the whole site feature. And it's built right in the browser and available in the address bar.

IE Address Bar with Compatibility Mode

Yes, it's right there in the address bar and it's pretty easy to accidentally click it.

I run into this issues every now and then. At work we still need to support IE8, although it's rarely used these days. IE9 is still quite common among some of our corporate clients.

The biggest problem is, that some companies have applied company wide policies to enforce Compatibility mode on all sites. And, of course, the end users are not allowed to change the settings themselves.

How to Fix This?

Here's how to solve this problem. Just add this meta tag to the head of the page.

<meta http-equiv="X-UA-Compatible" content="IE=edge" />

It's kind of an ugly hack to an ugly hack that fixes a problem that should never have existed. But I think it's the easiest way to solve this problem. And the good thing is, that with this tag in place the Compatibility mode switch is completely hidden from the browser address bar.

# Obfuscating Id's 2015/10/29


If you're using plain integer id's for your records, obfuscating the id's from the general public might be a good idea. You can use UUID's but that's not always possible, for instance, if you're working on a legacy project and don't want to fiddle with the database (yet).

Obfuscating id's can get handy. Basically, what it means is you can turn id's into random strings and back. For instance, you can turn 243242 to cds7rk23 and turn cds7rk23 back to 243242. There are libraries that handle this, like Tiny for php by Zack Kitzmiller.


Why would you want to do this? Well, if you have URL's like http://myapp.com/api/user/1245 it's pretty easy to guess that there probably are users with id's 1-1245. And if this is a public API, it's even more improtant. If you can guess all the data endpoints it's possible that someone is able to pull out all the data through your API. That could be your goal but in many cases it's probably not.

If you use obfuscating the url could look something like http://myapp.com/api/user/7Hc6dl3 which is a lot more difficult to guess. And it makes it close to impossible to try to guess all the other id's available.

# My First Package 2015/10/28

Wohoo! I just created my first Composer package. It's nothing fancy, just a simple Silex service provider for Tiny by Zack Kitzmiller.

You can find the package from Packagist and the code and more details in Github.

# CSS & JS Minification 2015/10/20

I just installed some tools for CSS and Javascript minification and concatenating. This time I wanted something simple and lightweight and I didn't use Gulp like I usually do

I installed Sass gem and UglifyJS and use them from the command line. This is a pretty simple and easy to get started approach for a small project.

# File Upload in Silex 2015/10/19

For some reason I never remember how to save an uploaded file (or the contents of the file, to be specific) in Silex, my favourite Symfony2 based framework. Well, here it is. I hope I'll remember it if I write it down.

// Get the /Symfony\Component\HttpFoundation\File\UploadedFile
// 'file' is the name of the upload file field in the form.
$file = $request->files->get('file');

// Get the contents of the file. $file->getRealPath() returns
// the full path to the temporarily saved file.
$content = file_get_contents($file->getRealPath());

There is a move method in /Symfony\Component\HttpFoundation\File\UploadedFile but I rarely use it. I usually use Flysystem to abstract the filesystem away.

# Friday Afternoon 2015/10/16

Pretty productive week, I learned a lot about

Not bad at all.

# Angular VS Ember VS React 2015/10/02

The battle of the JS frameworks, this is something that I've been wondering lately. I'm working on a longer blog post about this, but I think in the end it comes down to these things:

  1. Use the tools you and/or your team knows
  2. Use the tools best for the job

I know that's easier said than done.

# End of the Week Reflections 2015/10/02

Not the most productive week, but pretty good I guess. Considering, that there's a four-week-old little girl in the house. Next week will be even better, already looking forward to my trip to Turku on Monday.

# ReactJS For Stupid People 2015/09/02

React is often mentioned in the same breath as other Javascript frameworks, but "React vs Angular" doesn't make sense because they aren't directly comparable things. Angular is a complete framework (including a view layer), React is not. This is why React is so confusing to understand, it's emerging in an ecosystem of complete frameworks, but it's just the view.

Andrew Ray's Blog

React.js is just the view layer, that's it in a nutshell. Read the full post for some good insights.

# Why ContentEditable is Terrible - Medium Perspective 2015/03/15

I came across some reasoning behind the editor on Medium.com and reasons why contentEditable html5 tags did not work for them. It's written by Nick Santos, one of Medium software engineers. The Medium editor is probably one of the most elegant web html editors there is and, apparently, designing it wasn't that simple a task.

Most of the wysiwyg editors you see these days are broken in one way or another and the html they usually produce is far from optimal. This is probably the number one reason markdown has gained popularity especially among the more tech-savvy crowd. There are many beautiful markdown editors in Ghost and Dillinger to name just a few. However, markdown is definitely not for everyone and Medium has taken another, visually more appealing road.

There's pros and cons in everything. I do like the Medium editor and its simplicity and ease of use. But on the other hand, I'm also a big fan of markdown. There's probably good use cases for both of them. Using contentEditable html5 tags did not work for Medium. It will be interesting to see where where contentEditable will evolve into and what kind of native browser support it will have in the future.

# Wikipedia Moving to HHVM 2015/01/07

Wikimedia Foundation is happy to report that editing Wikipedia is now twice as quick Wikimedia Blog

Wow, Wikipedia is moving to HHVM with some good performance improvements. In addition, they have listed other advantages:

  • HHVM offers sophisticated observability tools, which make it easier to spot bottlenecks and identify opportunities for eliminating unnecessary work.
  • HHVM offers static program analysis

This is big for both HHVM and Wikipedia and opens up new possibilities to "dissolve the invisible distinction between passive and active Wikipedia users".