StrayObject


Hi!

I'm Mike; I help startups and larger companies make their applications as good as possible.
Visit projects or about to learn more.

All Medium Twitter

2017-03-30 Hey @RBS 2 cashiers to serve 11 people in a queue = a long waiting time, 3 free staff members on the floor saying sorry they can't help...

Dump all keys stored in redis

2017-03-28

Dump all keys stored in redis

redis-cli KEYS \* |xargs -n 1 -P8 redis-cli dump

Such a facepalm moment.

2017-03-26

Such a facepalm moment.

David, how do you handle missing PHP extensions when using dockerised composer?

2017-03-26

David, how do you handle missing PHP extensions when using dockerised composer?
Is there a better solution than customising composer image to include any and all required?

PhalconPHP: Volt — generate url for named route with params

2017-03-09

This is a quick example of how to generate url from a named route that requires params in Volt templating engine.

Your route declaration:

$router->add(‘/register/complete/{guid}’,
[
‘controller’ => ‘auth’,
‘action’ => ‘complete’,
]
)->setName(‘register-complete’);

Template tag to display the url (this assumes that the template is receiving a key ‘giud’ in the $params:

{{ url.get([‘for’: ‘register-complete’, ‘guid’: guid]) }}

PHPStorm remote interpreter — docker on Ubuntu

2017-03-05

I keep forgetting what the set up is for remote interpreter.

window: CLI Interpreters (click +)
Name: <give it a name>
Remote: docker
Server: Click on “New…” — window: Configure Remote PHP Interpreter
1. Server: Click on “New…” — window: Docker
 — Name: Local Docker
 — API URL: unix://var/tmp/docker.sock
 — Docker Compose executable: docker-compose

2. Image Name: <pick php image>
3. PHP Interpreter Path: <usually php should just work>

2017-02-24 Fantastic footage from team #dongfeng https://t.co/XYxH2SNJil Can't wait for the next #VolvoOceanRace to start. #vor #alicante + @madala_eu

2017-02-24 Just by accident I discovered double shift in #phpstorm opens search anywhere. #jawdropped #awesome #phpc

2017-02-23 Hey @twitter Would be great if you allowed me to retweet from another account if I have more than one (in your android app).

2017-02-19 Swimming with the seals. #winterswim #wintersea #coldswim #seamill #seamillbeach #seals… https://t.co/qRM9cBactB

2017-02-14 Use "docker diff" command to see what files have been modified in a #docker container. Thanks @adrianmouat & @glasgowphp

2017-02-08 "You Cannot Have Exactly-Once Delivery" in a distributed system. https://t.co/yYD5yImnqv #queues #programming #distributed #devops

2017-02-07 #rethinkdb status update. https://t.co/rZ3MvYB3Uy

2017-02-03 How to deploy Docker containers on AWS Elastic Beanstalk Applications https://t.co/vWwHYt7c6G via @CloudRank #docker #aws #ebs #php

2017-02-03 “‘Junior Developer for Life’ is for Suckers” by @_ericelliott https://t.co/wO998M4knT

2017-02-02 I just published “Building Angular2 app for production” https://t.co/dxqzR0lJQS #angular2 #angularjs

Building Angular2 app for production

2017-02-02

A few different ideas. One is bound to work ;)
http://stackoverflow.com/questions/37631098/how-to-bundle-an-angular-2-app-for-production

2017-02-01 “Good Bye SublimeText, hello PhpStorm” — @strayobject https://t.co/vothbh2CNm #php #sublimetext #phpstorm https://t.co/bERJwffcfB

Good Bye SublimeText, hello PhpStorm

2017-02-01

It has been a long and great relationship, nah just kidding. As much as I like vim and I had set up Sublime and all the modules to almost perfection, in the end the PhpStorm is simply better. Yes, the cost of ownership is higher, but thanks to that it is a more polished product.
You will find people claiming that it is just a text editor and not a IDE, but those people most likely have not added all the modules to make Sublime a full blown IDE. One place where it fell short is xDebug integration. There is a module and it does work, but the one in PhpStorm is just that bit better.

PhpStorm is not without it’s flaws, some of the shortcuts can only be a keyboard+mouse combo. Case in point multi-caret-select, or however you want to call it. In sublime, I had it at “Alt+UP” and “Alt+DOWN”, in PhpStorm I’m forced to grab a mouse. And then, there is resource consumption. Sitting at 800MB of RAM at runtime and 1.6GB after a while PhpStorm is a resource hog compared to a slick 200–350MB with Sublime. Pair PhpStorm with multitabbed Chrome and slack client, VM or a few docker containers and you might as well forget about any laptop limited to 8GB of RAM.

Overall, no piece of software is perfect and I’m going to use sublime for quick fixes, but in my day to day work phpstorm it is.

P.S. I know I can force the keymap setting by editing a keymap file. Unfortunately on Ubuntu it does not have any effect.

2017-01-30 https://t.co/AOyNrzeWiW #remotework #programming #startups I'm available for work, let's chat.

2017-01-27 Open-RethinkDB meeting notes #4 https://t.co/mYAJ7V3bxR #rethinkdb #openrethinkdb

2017-01-25 I just published “RethinkDB is going to be fine” https://t.co/rEGVQWYyni

RethinkDB is going to be fine

2017-01-25

I quite like RethinkDB (a document based data store with integrity, well thought through query language and enough built in functionality to make you wonder why you’ve never heard about it). What brought it to my attention were change feeds and if you are building anything requiring real time interaction, you should definitely check it out.

So you may have heard that the company behind RethinkDB has folded. You can read the postmortem. This has made some people worried that this awesome DB might go down with the company, despite assurances about making it a community run open-source project, however I’ve recently learned that the process is ongoing and further development is still happening.
From one of the contributors:

We’re nearly done polishing up the 2.4 release, which includes a bunch of sweet stuff like pre-write modifier functions. The biggest hold up on that is building out CI/testing infrastructure from scratch, figuring out how we’re going to release binaries, and the legality of doing so under the official name/domain.
We’ve even begun roadmapping things for 2.5/next including great work done by @srh which improves the performance of hard-durability writes by a significant degree. We intend to publish an official roadmap in the near future, but you can get a pretty good idea just following PRs in GitHub.
More is soon to come! If you’re interested in getting involved or just want to get updates, the best place to be is #open-rethinkdb onSlack.

So there you have it, I’m definitely going to sleep much better knowing that this awesome piece of software will continue.

2017-01-23 I just published “Postfix in a docker container” https://t.co/u68eTm8nlh

Postfix in a docker container

2017-01-23

Setting up postfix in docker is fairly easy, something I did not really know how to do was testing it. Turns out it’s just as simple with telnet and/or netcat. I followed BLOWB guide. Check it out.

2017-01-14 I just published “Postman — chasing ghosts” https://t.co/O4q0BPXpIc

Postman — chasing ghosts

2017-01-14

Postman — chasing ghosts

Changing “Type” in postman’s “Authorization” tab does not automatically clear the authorization key from the headers. Something to remember before you start pulling your hair trying to figure out how come user object gets populated.

Take care.

2017-01-09 I just published “Continuous Delivery — process graphic” https://t.co/OXsM32I2O1

Continuous Delivery — process graphic

2017-01-09

I’ve found this graphic very useful when explaining this. And since things like that are hard to find after some time. Here it is.

Source: https://s9.postimg.org/6ro48isr3/6ypcoh.png

2016-11-12 I just published “Don’t run composer in your app container…” https://t.co/C5X0rzC5fn

Don’t run composer in your app container…

2016-11-12

…run it in its own container!

I know, I know. Every service should have its own container. We all have heard it and we all aim for that utopia, but having limited time and resources we have to balance the cognitive load, complexity of such a system would have with what the team can realistically handle.
Having a development set up that runs a limited number of containers, one with minimal setup is always nice, however every time we internalize dependencies we are introducing change, we move further away from that ideal 1:1, production to development, environment parity.

With that in mind, rather than dropping a PHAR into a project container, or worse using one installed locally, a much better solution is to utilise a self-contained docker image. With that, assuming we start in the app folder on our dev machine all it takes to update dependencies is:

docker run --rm --name composer -v “$PWD:/app” composer/composer:alpine update

More options and info at docker hub.

EDIT: A friend of mine just pointed out that he wrote a short how to on this subject quite a while ago - and it’s much better. Head to his post for more indepth example of using dockerised composer taking into account user id and keys/tokens.

2016-10-28 hey @twitter seems adding phone number via android app v6.20.0 on Android 6.0 is not working. White screen and back to settings.

2016-10-27 I just published “SSL is hard (sometimes)” https://t.co/8yLcLhuwYS

SSL is hard (sometimes)

2016-10-27

TL;DR;

If you are getting error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
or server and client could not agree on the encryption method/cipher
the first thing you should check is permissions on every folder in the path you are reading both the cert and key from.

Backstory

I was testing a fairly simple setup, however, one however, where I’ve been using a mix of new technologies and it forced me to spend quite some time trying to figure out, what turned out to be a very simple issue.

What I wanted to deploy is a dockerised haproxy and a few containers with a small website I built using Aerys (amphp based server) with an automated certificate issuance via Let’s Encrypt. I know I could have used this awesome image to have scaling automated, but where would be the fun in that?
Instead I rolled out the default image read up on how to configure it and deployed the whole thing.
Rather than moving the auto generated key and cert to my project folder I left it where acme.sh has created it and just used that path in the server setup.

When testing with browsers I was getting a message that server and client could not agree on the encryption method/cipher, in both curl and openssl I was getting an error:

error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure

Having both, haproxy and aerys set up not to support sslv3 I was pulling my hair out as to what was going on. I reconfigured everything, ensured that both server and proxy is using the same cipher suite only to be met with the same error.
Not to bore you any further, it turns out that this is also a response to the situation where no key and certificate are available. A quick check of permissions on the default location was all that was needed. As soon as I fixed that everything was back to normal.

2016-10-24 I just published “Aerys/root() vs new Root()” https://t.co/SeUYxRfDAL

Aerys/root() vs new Root()

2016-10-24

For the past week or so I’ve been playing with Aerys and AMPHP in general.
Everything was going fine until I moves styles from a <style> tag into a css file. Basically, the css has been read but discarded. It took me a while to realise that the reason for this was the fact that the css file has been sent as text/plain and not text/css and why it was sent with that mime type.

Instead of instantiating the static file root object via a function call as per docs:

$docroot = Aerys\root(__DIR__ . “/public”);

I’ve done it with the good old fashioned new keyword:

$docroot = new Aerys\Root(__DIR__ . “/public”);

Quick check in the functions.php pointed me straight to the answer. The Aerys\root() function if not passed an options array is setting a path to mime types file. Because I instantiated the object myself, my $docroot was missing that and hence it was falling back onto a default type of text/plain. I rectified that and everything is working fine now.

$docroot = new Root(__DIR__.’/web’);
$docroot->setOption(‘mimeFile’, __DIR__.’/vendor/amphp/aerys/etc/mime’);

2016-10-22 https://t.co/QrLUXMBawR

2016-10-14 Even my #keyboard ain't happy. https://t.co/lWYSwxWUir

This is not the same number as above.

2016-10-12

This is not the same number as above.

I would have liked it better if you did not mention “net neutrality", because it clearly does not…

2016-08-11

I would have liked it better if you did not mention “net neutrality", because it clearly does not mean what you are trying to say.

Possibly the best thing I’ve read in a while.

2016-04-30

Possibly the best thing I’ve read in a while.

GoSublime error: MarGo build failed

2016-01-18

I’ve recently got back to learning GO and I was welcomed back by a frustrating issue related to my set up (Ubuntu+SublimeText3+GoSublime).

GoSublime error: MarGo build failed

I’ve read through and done what couple other people were suggesting might fix this, however, without success. In the end solution was simple and the culprit has been mentioned a bit further down in that error.

Cannot find GOROOT

All I had to do was to edit my user settings file for GoSublime and remove the line where I declared GOROOT from the env section of the settings file.

Take care,
Mike

Edit: Apparently, MarGo build failed issue has also been reported fixed by updating your version of GO to 1.5.2+ (mine is 1.5.1)