Wednesday 31 January 2024

Replace, Substring and Words Count in MySQL

Some useful string functions in MySQL.

If you want to replace a string in a given string.

SELECT name, REPLACE(name, 'Demo', 'Test') AS `replaced_string` FROM `table_names`;


If you want to get the first word in a given string.

SELECT name, SUBSTRING_INDEX(name, ' ', 1) AS first_word FROM `table_names`;


If you want to get the count of words in a string.

SELECT name, (LENGTH(name) - LENGTH(REPLACE(name, ' ', '')) + 1) AS word_count  FROM `table_names`;










Tuesday 30 January 2024

Kafka

KAFKA is an open source developed by LinkedIn for data pipelining, data streaming, data processing, and data transferring with maximum throughput. It's managed by Apache.

We use Kafka on the AWS environment under Python and PHP technologies to manage a high volume of data to load in a fraction of a second.

Kafka helps in real-time data streaming, connecting to any sources like AWS S3, can be auto-scale and optimize data streams. Many big giants using Kafka.



Create .ICS file using PHP code

Recently worked on creating a .ics file in PHP after a very long time, code so thought to share with everybody. Please find below the comple...