Posts

Symfony - Twig - How to check on instanceof class object

In Twig exist "constant" function that returns constant value, but if you set "class" in first parameter and object in second parameter, then function returns the fully qualified class name of an object.  So we can use it in our case and compare it on class name that we want to check like "instanceof". Example: {% if constant('class', app.user) == 'User' %}{% endif %} Or with namespace: {% if constant('class', app.user) == 'EntityBundle\\Entity\\User' %}{% endif %}

Which PHP Framework to choose in 2024

 If you've decided to start learning a PHP framework this year, or from scratch, and can't decide which one to choose, here's a selection of the most popular: Laravel - 302,403,373 downloads Symfony - 78,291,128 downloads Cakephp - 12,444,302 downloads Codeigniter4 - 1,720,925 downloads Codeigniter - 1,617,412 downloads by downloads in January 2024 All info from Packagist.org So, to choose Laravel in this year, you obtain much more possibilities to find a job. 

How to add screenshot to App Store for your App

Warning! Use no transparency! Size resolutions: 6.7” Display > 1290 x 2796 pixels 6.5” Display > 1242 x 2688 pixels || 1284 x 2778 pixels 6.1” Display > 1179 x 2556 pixels 5.5” Display > 1242 x 2208 pixels 12.9" Display (2nd + 3rd gen) > 2048 x 2732 pixels Mac > 2880 x 1800 pixels Apple Watch > 396 x 484 pixels ----------------------------------------- 72 dpi, RGB, flattened High-quality JPEG or PNG image file format

HTML - How to add placeholder to dropdown (select) with selectpicker

First time in my life I needed to add placeholder for dropdown O.o I even didn`t know that it exists. But, anyway, I need to implement this case. I selected selectpicker from bootstrap to have ability to use live searching in dropdown. HTML for adding dropdown: <select class="dropdown" data-live-search="true">     <option class="hide" value="" disabled selected hidden>Placeholder</option>     <option value="option1">Option 1</option> </select>  Javascript: const select = $('select').selectpicker(); $('.dropdown').on('click', function () { $('.dropdown').find('.hide').hide(); });

List of Queue Managers (Queue Services, Streaming Systems, MQTT)

Image
Apache Kafka A distributed streaming platform designed for high-throughput, fault-tolerant, and scalable data streaming. It uses a publish-subscribe model and is widely used for real-time data processing. ActiveMQ An open-source message broker that supports Java Message Service (JMS) and provides features like message persistence, clustering, and diverse communication patterns. ZeroMQ A lightweight messaging library that allows for asynchronous message passing between applications. It provides various messaging patterns and is known for its simplicity and high performance. Apache Pulsar A distributed messaging and event streaming platform that enables scalable and durable messaging with multi-tenancy support. It is designed for high-throughput and low-latency use cases. NATS (NATS.io) A lightweight and high-performance messaging system for cloud-native applications. NATS supports publish-subscribe and point-to-point communication patterns and is known for simplici

Symfony - Doctrine - How to save SQL query to Session

If you have separated ajax table sheet with data and filters, sometimes, you need to keep this filtered data between requests. In my case, I needed to be able to download file in CSV format, after choosing all necessary filters in table. So, it is possible to store SQL query in client Session after applying all filters and receive data from DB via DQL. To store DQL in session: $query = $this->createQueryBuilder('i')->select('COUNT(i)'); $_SESSION['query'] = $query->getQuery()->getDQL(); $_SESSION['query_params'] = $query->getQuery()->getParameters(); To get data from DB: $data = $this->createQuery($_SESSION['query'])->setParameters($_SESSION['query_params'])->getResult();

jQuery UI - Dialog - How to hide autofocus

The simplest way, just add hidden input with autofocus attribute . < input type ="hidden" autofocus > As it said in jQuery UI documentation, it will find this input firstly by priority and move focus on this input. But as this input hidden user does not see this. Choosing priority: The first element with the autofocus attribute The first :tabbable element within the dialog's content The first :tabbable element within the dialog's buttonpane The dialog's close button The dialog itself