Having every bit of information defined at every aspect of application makes system actually finished.
Piotr Masełkowski, Maslosoft Founder

Reviewed an updated documentation for balin

The Maslosoft Balin Project had documentation migrated from old semi-static pages to be able to integrate into main Maslosoft website. Now all live documentation examples have been reviewed, cleaned up, in some cases fixed and also extended with more detailed descriptions.
The project itself is a set of more or less complex Knockout JS binding handlers. It is written in CoffeeScript for better clarity - and in fact writing this project in CoffeeScript made it possible to make it work.

Limiting var_dump output

Sometimes to quickly inspect what's in object, PHP var_dump function can be used. This will show all object properties, including private and protected, also of all nested objects.

Sometimes this is just too much to produce useful output.

Fortunately in recent PHP versions, a new magic method was added: __debugInfo. When implementing this method, it should return array with keys as object names, and it's values as values that should be displayed.

Extra Knockout Binding Handlers Demos

Finally extra binding handlers project - balin have accessible live documentation. Check out this project for inspiration of how binding Knockout JS binding handlers can be made or just use existing ones. There are numerous small helpers as well larger binding handlers, including but not limited to:
  • Various attributes helpers
  • Access Control Helper
  • Fancytree Knockout JS binding
  • Tree Grid
  • HTML Editable value

Annotations for anonymous classes

A new release of addendum provides annotations for anonymous classes. One of anonymous classes feature is that these can be wrapped in another class. Fortunately PHP has support for reading doc comments from those classes, thus allowing to parse annotations. Addendum will create annotations container just like if it were named class.

Creating Your first PHP annotation with Maslosoft Addendum

Creating annotation class read from begining to learn about configuration

Having addendum configured, let's create annotation class. This will allow us to use @ notation on our project classes. As each annotation is in fact class, which has some simple logic to set up metadata container. This container will be used to obtain values configured by annotations. Please not that this values might be different than raw values on @ notations. As value returned by meta container is solely dependent on values set by annotation definition.

This way, we have opportunity to set initial logic in annotation, thus having already prepared and cached values returned by metadata container. To obtain access to container for currently process class, there getEntity is method in annotation. This returns container instance, which can be configured with any property required.

New smarter way to use cache

When dealing with caching, common task is to load cache value, check if it is not empty and depending on it - either set some variable or perform some operation to retrieve this value.
This common tasks might scattered around various places in application. 
New cache component feature comes as remedy, allowing to execute callback if value is not already cached. This makes possible to use one-liners to either get cached value or retrieve it from any source.

Codeception Acceptance: Filling in contenteditable

When working with form fields, Codeception has already prepared tools to fill-in required data. However modern applications often works on editable elements via contenteditable attribute.
This approach has advantage of having visual HTML right away editable. When running in-browser acceptance tests, it is required to fill-in those values too. This can be done with Facebook WebDriver package, included in main codeception package.

jQuery UI jumping sortable items

Sometimes when creating sortable user interface widgets, some various quirks might happen. One of these is that just after starting dragging element, it jumps of from original location. Element will move above cursor for roughly height of it's parent container minus one sortable element.

There are plenty solutions including JavaScript to fix container height. These are clunky as it need to be assigned to each sortable. Even more problematic when used with Knockout JS sortable, as including JavaScript in HTML attributes is not pretty and really not recommended.

I turned out that properly styled container will remedy jumping issue. The point is to make it's overflow auto:

    overflow: auto;

That's it! Now sorted item should not jump anymore. Credits goes to:

Selenium bad magic number error

Using selenium for acceptance tests?

It usually run fine, until I got bad magic number error when trying to run any version:

invalid file (bad magic number): Exec format error

It is quite confusing message, basically it means that it cannot be executed. Solution is to execute it using java with -jar option:

java -jar selenium-server-standalone-3.0.1.jar

To make it easier, selenium bootstrap file can be created to launch it:

java -jar /usr/local/bin/selenium-server-standalone-3.0.1.jar
This file can be named, for example /usr/local/bin/selenium with jar file located in same directory.

Using composer with Xdebug on ubuntu

Using composer with Xdebug turned on will result in warning message, saying that Xdebug affects performance - and that's true. Composer will run much slower when used with Xdebug enabled. To overcome this issue, it is possible to disable Xdebug when using composer command.

Note that following steps are meant to be used only on development machine, do not use on production servers!

To turn on and off Xdebug, we will use bash script - which will link or unlink Xdebug configuration - as just disabling Xdebug in config still degrades performance.

Modernized website

As a lot of development effort were put into many Maslosoft's projects, this website was left behind.

Now it's time to keep up, so a highly redesigned system along with content was deployed. This includes documentation for many projects and blog You are reading now. But the most exciting part is a bit of knowledge about quite mature projects developed since... Who knows when.

As an incorrigible optimist, still creating software resulting in comfortable web editing, as it's my point of interest from ages.

  • Projects