Author Archives: Thomas Layh

Speed-Up your Functional Tests with paratest

I am currently working on a Symfony2 project where we use quite some Functional Test to check for our quality. Bad thing about that is that the functional tests currently take about 13 minutes in our Jenkins build. This is too long. So a quick search for options for optimizing led me to Github to brianium/paratest. This is a composer ready package that can be installed together with your project.

The changes for running are quite easy. Instead of

now we call

The difference now is that we are down to 5 minutes, so the tests are 7 minutes faster.

One thing I don’t like, there are almost all arguments from PHPUnit implemented, but still some are missing, like passing php.ini arguments to the call.

Good thing, all the report generating arguments are there and they are quite important if you want to check your coverage and stuff in Jenkins.

Smart Lock with Android 5.0 Lollipop

When I got my Nexus 5 over a year ago I was looking forward to play a little bit with NFC Tags. I played around a little bit with Trigger but finally there was no real usecase for me so I put the tags away.

After the upgrade to Android 5.0 Lollipop I read about the SmartLock feature and I thought this could be quite useful, especially for my car. So I thought it would be nice, adding an NFC Tag to my car holder and as soon as the phone gets contact to the NFC Tag I don’t have to unlock my phone anymore.

So I tried that. The setup is quite easy. Just go to the settings of your phone, security and select the Smart Lock option there. Everything else is self explaining. After I did that I put the NFC Tag on my car holder.

NFC Tag on my car holder

After adding my phone to the car holder, it worked like a charm and there was no need to unlock my phone anymore. I think this is a good idea, because entering the pin code while driving is a bad idea.

Finally I turned on the car and started driving. Too bad that I have a car holder with induction that is automatically loading my phone when I put it in the car holder and turn on the car. The induction is, as far as I know, also working via NFC so what happened next was, that my NFC Tag stopped working. No I have to decide, automatic loading of the phone or using the Smart Lock feature.

Well, at least I can use the Smart Lock feature when I am at home and don’t have to unlock my phone at home anymore.

If there is anyone out there who has a good idea how I can make this work together, feel free and write me.

Sketchnotes on an Android Tablet

I started with writing my notes in conferences and so on via SketchNotes recently. I did my first experiments during SymfonyLive in Berlin this year. Here are some of the results: SketchNotes from SymfonyLive.

Recently I got my Nexus 9, so I bought a Stylus for the tablet and now I am trying to use it to train a little bit for sketch notes without wasting too much paper. The most important thing here is the app you use for that. Currently I found two apps that look real good.

1: Bamboo Paper
I found it because it was announced together with the pen I bought from Bamboo. By the way, I bought the Bamboo Solo CS-160. The app is quite good for notes and what I really like are the different notebooks and the way you can organize your notes in different notebooks. Everything works fine here but what really can be improved is at first, the shadow marker. That is the pen I use for making shadows in boxes. It works quite well, but if you want to make a more detailed SketchNote and you zoom in a little bit, it is, even with the smallest brush size, too big. Second thing is the zooming that can be improved. Sometimes I need two or three tries bevor I manage to zoom in a little bit.
But hey, it is for free and for a free app, it is really, really good.

2. SketchBookX
This is another great app. The management of the images is different here, because instead of having a notebook with multiple pages and images inside, you always make only one image. But therefor on of the things from above is solved much better here, because you can resize every pen without limits instead of having only 3 different brush sizes like in Bamboo Paper. Another advantage of SketchBookX is, that you can use multiple layers for drawing and one more thing: You have nice shortcuts in each corner that you can easily use and that you can select by yourself. For example in the default setting, a double tip in the bottom left corner works as undo. This comes quite handy.
The app is for free as well.

I would love to try Autodesk Sketchnotes, but it is not working with Android 5.0. Perhaps I update this article as soon as they manage to make it work.

ArtFlow was another app I tried and I looked quite promising. But a big problem was that the line you are drawing first shows up when you finish the line. Until that you paint in the dark. So I uninstalled it and I will it give another dry later.

UPDATE: ArtFlow fixed that bug for the Nexus 9. If i find some time today, I will give it another try!!

I also tried a lot of other apps, but I did not found anything that was working for me. If you now another app, please let me know.

But in the end, I have to say that I think it will not work doing SketchNotes on a tablet. It is nice and fun and it can be used for training and for small notes, but I think I will never be fast enough on a tablet to write real time notes like on a paper book with a normal pen.

UPDATE

3. Papyrus
While looking for other apps I just found one more that is worse taking a look. It is called Papyrus and it looks really promising. There is not a big selection of pens, but it is possible to have a marker and an outliner and together with a color selection and flexible brush sizes this gives you a lot of possible combinations. There is a really awesome feature in this one. Endless paper. You start in the upper left corner and you can zoom easily in and out and you can scroll down and to the right as much as you want to. Only thing, if the paper is getting too big, it is not possible to export it as an image, so you have to export your notes as pdf. The marker costs many and can be bought via in-app purchase. Another good point here, you have a 14 day trial period before you have to decide if you want to pay or not.

 

Symfony2 – playing with default locale

The Symfony2 documentation is quit good, but this morning I missed a explanation for using a default locale without url parameter together with routing and a routing configuration in annotations.

What I wanted to do is the following url setup:

http://www.domain.com -> default locale should be used without any prefix
http://www.domain.com/en -> english translation should be used with prefix

I also wanted to do the routing with annotations inside the controllers.

Following setup seems to work:

The important part here is to start with the | when setting the requirements and to leave away the de that you might want to set.

Of course you have to set the default_locale in your configuration.

Your annotations inside your controller look like the following then:

It took me some time to figure out how this setup works. Perhaps it helps someone.

If you also want to have the “de” in your url, you have to add the “de” after the empty pipe, but then you have the problem that you can reach the german version with and without the “de” what means you will have duplicate content.

 

Blog Wall from the Scrum Master Gathering

This year, at the Scrum Master Gathering, someone came up with the idea to add a flip chart and to let people write down some blogs and websites with useful informations around agile stuff.

Thanks to @pherwarth the image is in Facebook and Xing now.

I just created a list here with all the blogs and links from the image, just because clicking is easier than reading on the picture.

Thx for the awesome event!!

Agile Weekly Podcast
http://integrumtech.com/category/agile-weekly-podcast/

Agile game development
http://blog.agilegamedevelopment.com/

Luis Goncalves
http://lmsgoncalves.com/

Agilitrix
http://agilitrix.com/

Kai Simons
http://ksimons.de/ – agilist.de

Retromat
plans-for-retrospectives.com

Agile Games
http://tastycupcakes.org/

Inspect & Adapt
http://www.inspectandadapt.de/

Stefan Roock
http://stefanroock.wordpress.com/

Validate yaml files in TYPO3.Flow via Jenkins

The possibility to validate yaml files in TYPO3.Flow by using a Schema file is a really nice feature. But to be honest, who is validating his configuration manually after each change he made? Exactly! No one.

Putting this into Jenkins to be made in each build process is easy, but the problem is, that Jenkins only fails if he gets an exit code greater than zero. So I decided to write a small shell script that runs the command for me and that returns an exit 0 if everything is validated and an exit 1 if there are errors.

Here is the shell script, perhaps it helps someone else:

There are two parameters required. The first one tells the script for which context it should validate the yaml files, the second parameter tells the script where the flow installation is located so that it can run the flow command.

For me it was enough to just add the different settings in the for loop, but this script can be changed with no effort to add a third parameter and to add the different types of settings as the third parameter.

PHPStorm and Vagrant / Vagrantmanager

Last week I learned about Vagrantmanager to manage your available vagrant boxes on your system. Currently it is only running with MacOSX and what I really like about it, that you can easily see which boxes on your host system are currently running.

I know about the vagrant feature in PHPStorm quite a time now, but after it was released I just took a short look and the integration in PHPStorm wanted to generate a new vagrant project in the root of the project. I have strictly separated the projects I am working on and the vagrant setup, so it was not usable for me.

Today, I don’t know why, I just decided to check if there are some settings where I can add a different root for the vagrant stuff, and yes, it was there. So I configured the different root for the project and know I have all the features from Vagrantmanager directly in my IDE.

Here is how to set it up:

Vagrant settings

Just select the correct “Instance folder” where your vagrant files are located.

Vagrant control options

Now you should see all this nice features if you go to Tools->Vagrant

One bad thing is, that I can not see if the box is currently running or not. I still miss a status icon. Thats better in Vagrantmanager.

Best thing would be if the features of both could be combined!!!

Symfony-style InMemory Repository for TYPO3.Flow

logo_symfony_headerTYPO3-FLOW Some time ago I worked on a Symfony Project at the office where we used a Webservice to fetch all the required data. We used Repositories, that call the web service and return the data. For our set of functional tests we used inMemory Repositories to get some data back from the application, without calling the web service. Basically the InMemory repositories just returned the objects that the web service would return, but without calling the web service. So for testing some frontend stuff, the testing context automatically injected the inMemory repositories into our controllers.

Since Symfony and Flow are not that fare away from each other, I was just wondering if it is possible to do the same thing in Flow. The big difference is, that Flow automatically wires the model to the repository and therefor there where two big differences.

First of all, I used the Objects.yaml to tell Flow in dependency of the context, which repository it should use. The second thing was to tell the repository where his model is. It is one thing, writing two repositories for two different things, but I did not want to write to identically models.

So fore the Testing context the Object.yaml looks like following:

For the Development context the Object.yaml looks like:

Good thing is, that you can tell the repositories in Flow to which models they belong by setting the constant ENTITY_CLASSNAME.

So in both repositories I set:

Finally the result of everything can be found here:

https://github.com/tlayh/Layh.Testing

If you call the package via the browser, you can add the Something Object to the database, while the functional tests access the InMemory repository and return a different set of data.

Normally you would use a Testdatabase for such a case, but in the Symfony project we did, there was no database at all, so we where really happy about the InMemory repositories.

Disclaimer:

This code might be not perfect, but I am open for feedback. Basically this was just a proof of concept if it is possible or not.

 

Symfony2 – Download Filestream as StreamedResponse

Sometimes you just get some content in form of a byte stream and you want to make a file out of it and download it.

Here is a short tutorial on how to do this with a StreamedResponse in Symfony2 and how you can write a functional test to validate the basics for the action.

Step 1 would be to write the test:

Now all the tests should be very red, so it is the right time implementing the controller. I don’t show how to set up the route for that, just how the controller looks like.

At the place where I call $report->getFileContent you can also use a buffer to read for example a large file.

Alternative image view for MacOS – Replacing preview with Xee3

Xee I really love my Mac, but if I want to take a look at a series of pictures, Preview is really not the best tool. So I looked around and tried different tools. One of them was Xee (Version 2) and another was Sequential. Both of them haven’t been as fluffy as I want them to be and the way of navigation through the pictures has not been like I expected it.

After fighting with Sequential for  some time now, I did another search and found out that there is a new version for Xee. Version 3 is exactly what I was looking for all the time.

The price: It is $3.99 and I really think it is worth every cent. Another good thing is, you have a trial for 30 days to check if it is the right tool for you.

Try it: Xee3