Spring Boot: Executing asynchronous method backed with a queue

Spring Boot - asynchronous execution of controller method with threading backed by a queueMany people go for different solutions and sometimes overcomplicate their applciation with message queues like ActiveMQ, RabbitMQ and other options out there. Though this is yet another part in the application architecture that would require maintenance and support and it’s also a possible failiure point.

There are good reasons to use this approach but in most cases you can get through with normal in-memmory queue with multi-threading. Read more ›

Posted in Java, Spring Tagged with: , , , ,

Best practices in Agile Retrospectives

agile scrum retrospective meeting best practices dos dontsOne of the core Agile practices is to inspect and adapt. We inspect the developed software in the business review or demo meeting to ensure that we are delivering the right product. And we inspect how the team performs and interacts in the retrospective meeting to make sure that we are working in the right way and that we keep improving.

We should work on maximizing the benefits of the retrospective meeting and adapt according to its outputs, or it will turn into a useless ritual.

In this article, I share some tips on things you can do to improve your retrospective meetings, and things you should avoid as well.
Read more ›

Posted in Project Management Tagged with: , , , ,

API Versioning – best practices

API Service versioning best practices URL headersWhat happens if you need to make changes to your API?

If you’re making additions to the API – e.g., adding services or adding fields to your services – you likely don’t need to do anything more to notify users than to tell them about the changes.

But what happens if you need to make a change that will affect users?

  • Adding authentication
  • Adding authorization rules
  • Removing a service
  • Removing or renaming fields inside services

Such changes as these impact your existing users. At times like these, you need to create a new version of your API.

But how do you do that? Read more ›

Posted in API, Small Tips Tagged with: , , ,

Load configurations from custom bundle in Symfony2

Symfony2 configuration file for custom bundleWhen I build apps or add new functionality to Symfony2 I build it into a separate bundle, thus trying to keep the structure modular which is generally a good practice as everyone knows. Keeping all parts of the bundle together makes it easy to maintain and also easy to change the configurations as they reside in same place as the code itself.

In this post I’ll show you how to make Symfony2 core discover your config.yml and services files defined in your custom bundle.

Create new bundle

First let’s create a new bundla that we’ll use as a demo. Run following command in the terminal: Read more ›

Posted in PHP, Small Tips, Symfony2 Tagged with: , , ,

Programatically render template area in Magnolia CMS

magnolia cms javaProblem

I am using Magnolia CMS 5.4 and I want to build a module that will render some content of a page and expose it over REST API. The task is simple but not sure how to approach it and/or where to start.

I want my module to generate partial template or an area of a template for a given reference, let’s say that is “header”. I need to render the header template/area get the HTML and return that as a response to another system.

Solution

First thing the rendering works based on different renderers and those could be JCR, plain text or Freemarker renderer. In Magnolia those are decided and used in RenderingEngine and the implementation: DefaultRenderingEngine. The rendering engine will allow you to render a whole page node which is one step closer to what I am trying to achieve. So let’s see how could this be done:
Read more ›

Posted in CMS, Java, Magnolia Tagged with: , , , ,

Running out of memory on Laravel 4 update

PECL out of memory with Composer and LaravelLaravel is great framework and I quite enjoy how it’s structured and how it works. In version 4 it was migrated from bundles to using Composer for dependency injection which is great and fits well in my daily routine on building apps also follows standards promoted by the PHP community in general.

In my application I was planning to add MongoDB support as first I’d like to improve the performance and second my data structure is perfect for this purpose, furthermore I want to improve my NoSQL skillset.

In this article I’ll describe the steps that I followed on installing the MongoDB provider, the problems that I’ve faced and final solutions and small tricks I used to make all work. Read more ›

Posted in BASH, Laravel, MongoDB, PHP, Unix Tagged with: , , , , ,

Pass parameters to Bash Alias command

pass console command parameters to bash alias command- like hammer bashes a nailI use BASH aliases extensively throughout my DEV environments and it saves me a lot of time. One specific I use is “cdv” that’s shorthand for CD to VirtualHosts which in most cases could be as simple as /var/www or in some cases could be very long path, especially on shared DEV environments like /var/www/dev/vhosts/mylongusername. Read more ›

Posted in BASH, Unix Tagged with: , , , , ,

Magento :: Export all customers and emails from orders

Magento export customer emails from ordersMagento export

Every now and then I am asked by different clients if I can export specific customer data, most often people need emails of their customers to use for newsletters or other types of marketing campaigns. There are two different ways to approach the problem either get all orders and get the customer email or any other related details that might be needed or you can use the customer collection which will give you all unique records for customers.

Setup magento API access

Read more ›

Posted in CMS, Magento, PHP Tagged with: , , , ,

Custom error handler for Laravel 4

Custom error handler for Laravel 4

Custom error handler for Laravel

I build API service for a mobile application and I faced a problem with the error reporting with Laravel.

Laravel is awesome framework and is great for RESTful application or building API that’s why it’s my first choice.

But I had one problem, my API should produce only JSON and my application can consume only JSON. So HTML error pages are pointless and needless for me. I had a specific case where a PHP error was causing problems but I also wanted to handle all PHP and display them appropriately for my app. Here is the solution: Read more ›

Posted in Laravel, PHP Tagged with: , , , ,

Consistent dates in PHP?

Consistent dates in PHP?

Consistent dates in PHP

It’s really interesting how small changes in core PHP functionality could break whole website and take hours to find the cause of the bug.

I am building website which takes some use of dates, stored in MySQL database as Date format for simplicity

Those dates are optional fields in my application and sometimes they have Zero Date format: ‘0000-00-00‘ which works perfectly on my development environment. Locally I am using PHP 5.3.4 not latest but allows me to spot any backward compatibility issues and probably it’s more laziness for not upgrading than any other sophisticated reason. Anyhow on production I run PHP 5.3.24 and so far everything has been just OK, running smoothly with no issues.
Read more ›

Posted in PHP Tagged with: , , ,

Categories