teleren/devto huggingface dataset:
131. Palindrome Partitioning
Tags: php, leetcode, algorithms, programming
Published: 2024-05-22 17:12:14

131\. Palindrome Partitioning

Medium

Given a string `s`, partition `s` such that every substring[^1] of the partition is a palindrome[^2]. Return all possible palindrome partitioning of `s`.

**Example 1:**

- **Input:** s = "aab"
- **Output:** [["a","a","b"],["aa","b"]]

**Example 2:**

- **Input:** s = "a"
- **Output:** [["a"]]

**Constraints:**

- <code>1 <= s.length <= 16</code>
- `s` contains only lowercase English letters.

[^1]: **Substring** A **substring** is a contiguous non-empty sequence of characters within a string.

[^2]: **Palindrome** A **palindrome** is a string that reads the same forward and backward.

**Solution:**

```
class Solution {

    /**
     * @param String $s
     * @return String[][]
     */
    function partition($s) {
        $length = strlen($s);
        $palindromeTable = array_fill(0, $length, array_fill(0, $length, true));
        for ($i = $length - 1; $i >= 0; $i--) {
            for ($j = $i + 1; $j < $length; $j++) {
                $palindromeTable[$i][$j] = ($s[$i] == $s[$j]) && $palindromeTable[$i + 1][$j - 1];
            }
        }
        
        $result = array();
        $tempPartition = array();
        $depthFirstSearch = function($start) use (&$depthFirstSearch, &$result, &$tempPartition, $s, $length, $palindromeTable) {
            if ($start == $length) {
                $result[] = $tempPartition;
                return;
            }
            for ($end = $start; $end < $length; $end++) {
                if ($palindromeTable[$start][$end]) {
                    $tempPartition[] = substr($s, $start, $end - $start + 1);
                    $depthFirstSearch($end + 1);
                    array_pop($tempPartition);
                }
            }
        };
        $depthFirstSearch(0);
        return $result;
    }
}
```

**Contact Links**

- **[LinkedIn](https://www.linkedin.com/in/arifulhaque/)**
- **[GitHub](https://github.com/mah-shamim)**
How to create an Azure Key Vault
Published: 2024-05-22 17:00:05

## Azure Key Vault
Azure Key Vault is a cloud service offered by Microsoft Azure that provides secure storage and management of sensitive information such as secrets, keys, and certificates. It helps protect cryptographic keys and secrets used by cloud applications and services.

Steps to create an Azure Key Vault
Step 1
On your Azure Portal search and  click Key Vault
![key vault](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/miyu039my7pham5nmwjt.png)

Step 2
Click on +create to create key vault
![+create](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/au2kko4gjlfk7lki6acx.png)

Step 3
Enter resource group and key vault name (give any)
![resource group name](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4s6iov0u2cph37479mrs.png)
Note: leave other parameters as default, unles you wish to change them

Step 4
Click on Review and Create
![review and create](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d1wbf0l9dglcoqyd8kf6.png)

Step 5
Click Create
![Create](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ep2t7elncbdp0h6j80xr.png)

Step 6
Click on go to resource
![go to resource](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ig5p0mterzig8camsddb.png)

Step 7
Click on keys on the left pane 
![keys](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mex858g5xtzfj5fsiepe.png)

Step 8
Click on Generate/Import
![Generate](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h4rhlrm3q4c1rpactv8e.png)

Step 9 (Final step)
Enter name, activation date and expiration date (if willing) and click create
![activation date](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mrrm2dqs18j584dl54xx.png)
note: you will see the key create at key vault portal
RAKE IN RUBY
Published: 2024-05-22 16:57:25

I had been working on ruby on rails from past few days and I had come across few commands like rake -T, rake db:migrate etc, but had never wondered what rake actually is. This made me to dig this topic and am sharing the little much knowledge I gained here today. 

**WHAT IS RAKE?**
           It is a tool in ruby that allows to run tasks, migrate database, test executions and some other repetitive tasks. Rake stands for "Ruby Make" and it is specially designed for ruby projects.

**HOW DOES RAKE WORK?** 
           Lets consider a example where a person tries to message and call another person.

```
task :message do
    puts "Hey!! What's up!"
end

task :call do
    puts "Hey! Its been long since we met so thought of calling you!"
end
```
We can run the above tasks using the below rake command

```
$rake message
#Output: Hey!! What's up!
$rake call
#Output: Hey! Its been long since we met so thought of calling you!
```
Rake tasks can also be dependent on other rake tasks they can also have parameters passed to them. Wondering how? Below is an example.

Consider an example where a student has exam. Writing an exam involves several sub tasks in them maybe from preparing a time table to waiting for the results it's a series of steps. So how can we sum up these sub tasks using rake tasks. Lets explore.

```
task :timetable do
     puts "Prepare timetable"
end

task :study=>timetable do
     puts "Study according to timetable"
end

task :exam=>study do
     puts "Write what you studied"
end

task :result=>[:timetable, :study, :exam]

```
In this example running 'rake result' will run 'timetable' first later 'study' and then 'exam'.

We can also create custom rake tasks using **namespace**.

```
namespace :exam do
    desc "Give exam"
    task :write do
         puts "Write exam"
    end
end
```
We can run the above rake task using 'rake exam:write'.

**RAILS SPECIFIC RAKE TASKS**
     Below are some commonly used rails specific rake commands.
rake -T                           Used do list rake tasks
rake db:migrate                   Apply database migrations
rake test                         Run the test suite
rake db:seed                      Populate database with initial data.
rake -t                           Debugging mode

**CONCLUSION**
     Rake integrates seamlessly with rails and makes it a powerful tool that can handle the development perfectly. From running test cases to migrating database rake supports a smooth workflow.
Developing a Fintech Product for the International Market
Tags: fintech, frontend, ruby, python
Published: 2024-05-22 16:44:51

Mokka, a popular BNPL service with over 16 million users and 7,500 retail partners, collaborates with us to enhance its offerings. Founded in 2012 and previously known as "Revo Technologies," Mokka now provides virtual cards, financial management tools, and various business services. We support Mokka with backend, frontend, and DevOps development, including infrastructure updates, new applications, and integrating advanced technologies like Kubernetes and TypeScript. Our team aids in maintaining seamless operations and expanding Mokka's capabilities across different markets.

[Read the full case study here.](https://evrone.com/cases/mokka)
Learning AWS Day by Day — Day 72 — Global Accelerator (GA)
Tags: aws, cloud, cloudcomputing, beginners
Published: 2024-05-22 16:44:11

Exploring AWS !!

Day 72

Global Accelerator (GA)

Improves availability and performance of our applications with local or global users.
Provides static IP addresses which acts as a fixed entry point to our application endpoints on EC2, Beanstalk or load balancers.

How does GA work?
Traffic is sent from User’s client is sent to AWS GA
Traffic then enters the nearest edge location.
AWS GA directs traffic to optimal endpoints based on proximity to client, wealth and endpoint weights.
User’s traffic traverses global network to endpoint group in AWS region. Each endpoint group consists of one or more application endpoints.
AWS GA ensures that traffic is routed to appropriate endpoint based on performance and policies configured.

If there was no GA used, it can take many networks to reach the application. Paths to and from may differ. Each hop impacts performance and introduces risk.
If we use GA, these inefficiencies may be removed. It leverages AWS network and results to improved performance.

Benefits:
Instant regional failover
High availability
Improved performance
Easy manageability
Fine-grained control

GA supports BYOIP (Bring Your Own IP) facility, which lets you have your own IP as entry point.

Use Cases:
Scales for application utilization
Protects the application

Components:
Static IP address
Accelerator
Network Zone
Listener
Endpoint Groups
Endpoints

Example, connecting 3 load balancers which are in different locations with common endpoints


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/afqxsbqp7kdtn5wh4tjg.png)
Troubleshooting slow page loads
Tags: webdev, performance, beginners, react
Published: 2024-05-22 16:33:27

Recently I encountered a slow loading page (ReactJS/webpack/node/express) ...
I did manage to pull the load time to a decent time.

I am sharing my findings on my page and the fixes I applied.

## Know what is slowing it down
Dont make assumptions, measure it.
I loaded the page and used chrome developer tools to check what was slowing it down

## My findings
1. Too many requests to my express server - At a time Chrome will open about 6 connections to a domain/ip and the rest of the requests to the same domain will be queued
2. Slow APIs (Adding to #1)
3. Some CSS and Images served from the server (Adding to #1)
4. Geography - I used browserstack and accessed it from different regions and I found some apis to be slower from geographies far away from my region
5. Big chunk sizes (ReactJS + Webpack)

## Steps I took to fix these
1. Low hanging fruit move all CSS and images to a CDN like cloudfront or cloudflare
2. Slow APIs - Some APIs were serving the same data to all users. This data was periodically updated. I created a static json for these and hosted these on the CDN. 
3. Slow APIs - Tweak my DB query which was serving some data unused by the clients.
4. Big chunk sizes - Removed unused imports, components not needed on the first render imported them dynamically, applied a terser in the webpack, enabled compression in express server
(Separate post on this coming up soon)
5. Slow APIs - It might be worth looking at moving some APIs to AWS Lamda so that they can be served well in all regions
6. The smaller chunk sizes helped overall with the other geographies and also data on the CDN helped load the page faster on the other geographies

## Key Takeaways
1. Measure before you fix 
2. Cache where necessary
3. Dont serve un-needed data in your APIs
4. Apply compression to outbound data in express
5. Look at webpack tuning (uglify, terser)
6. Look at chunk sizes - refactor code 
7. Do not import anything that needs a user action or which doesnt need rendering on the initial load, dynamically load the components also remove unused imports.

[Link to my post](https://dev.to/amythical/lazy-loading-components-in-reactjs-3aj) on Dynamic loading components in ReactJS.
Also a [post on late loading images](https://dev.to/amythical/late-loading-images-using-js-2d1d) in Chrome.
HOW I SPIED ON MY GIRLFRIEND USING WEB BAILIFF CONTRACTOR
Published: 2024-05-22 16:22:28

I found out my girlfriend cheated on me after snooping on her phone through a spyware called Web Bailiff. Just go to their website webbailiffcontractor . com. I had become suspicious of her behaviour after she started acting weird a few months after getting her new job. I became suspicious of her and her co workers and it turns out a lot was going back behind my back. I ended it last week!
⚠️ CentOS 7 Support is Ending Soon!
Tags: linux, ubuntu, devops, cloud
Published: 2024-05-22 16:14:56

CentOS 7 will reach its end-of-life on June 30, 2024. After this date, no more updates or security patches will be provided. This change has created uncertainty for users who relied on CentOS as a free, stable alternative to Red Hat Enterprise Linux (RHEL).

Red Hat has shifted CentOS to CentOS Stream, which previews future RHEL updates rather than mirroring the stable RHEL releases. This move complicates maintaining exact compatibility with RHEL and has led to the rise of alternatives like Rocky Linux and AlmaLinux. However, these alternatives face challenges due to limited access to RHEL's source code.

[Follow this link to know more!](https://www.redhat.com/en/blog/centos-linux-going-end-life-what-does-mean-me)
Handling ASP.NET Core Exceptions Globally
Tags: dotnet, csharp
Published: 2024-05-22 16:09:18

---
title: Handling ASP.NET Core Exceptions Globally
published: true
description: Heyo! I'm Michael and in this video I’m going to talk about 3 ways to globally handle ASP.NET Core exceptions using the .UseExceptionHandler built-in middleware, writing custom middleware, and the new with .NET 8, IExceptionHandler interface. Plus a bonus on how to have multiple exception handlers.
tags: dotnet, csharp
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/12pr80s0ioqpbfmcmoyi.png
---



{%youtube d0Eah9-t9tY %}
Enhancing Live Stream Moderation with Real-Time Detection Technology
Tags: webdev, javascript, programming
Published: 2024-05-22 16:03:34

In today's digital age, live streaming has become an integral part of our online experience, offering a dynamic way to engage with a wide range of content, from sports events to concerts and award ceremonies. However, with the rise of illegal streaming activities, ensuring the integrity and security of live streams has become a paramount concern for content creators and platforms alike.

Enter ContentCore Live, a cutting-edge solution that revolutionizes live stream moderation by enabling video platforms to detect and combat illegal streams in real time. This innovative technology provides a robust defense mechanism against unauthorized streaming of time-sensitive live events, safeguarding the rights of content creators and ensuring a seamless viewing experience for legitimate audiences.

The ability to detect and take action against illegal streams of live events is crucial for maintaining the value and exclusivity of premium content [https://webkyte.com/](https://webkyte.com/). ContentCore Live utilizes advanced algorithms and machine learning capabilities to monitor live streams continuously, identifying unauthorized broadcasts and taking immediate measures to prevent their dissemination. By leveraging real-time detection technology, video platforms can effectively combat piracy and uphold the integrity of their content distribution networks.

Sports enthusiasts, music lovers, and fans of live entertainment can now enjoy their favorite events with peace of mind, knowing that ContentCore Live is actively working behind the scenes to protect the authenticity and quality of the live streaming experience. Whether it's a high-stakes sports match, a star-studded awards ceremony, or a captivating concert, content creators can rely on this innovative solution to maintain control over their intellectual property and combat piracy effectively.

In conclusion, ContentCore Live sets a new standard for live stream moderation by offering a proactive and technologically advanced approach to combating illegal streaming activities in real time. By empowering video platforms with the tools they need to detect and prevent unauthorized broadcasts, this solution helps to preserve the value and integrity of live events while enhancing the overall viewing experience for audiences worldwide.

As the digital landscape continues to evolve, technologies like ContentCore Live play a pivotal role in shaping the future of live streaming, ensuring that content creators and platforms can deliver premium content securely and effectively. With real-time detection technology at their disposal, video platforms can stay ahead of the curve and protect the interests of all stakeholders involved in the live streaming ecosystem.
day 03
Tags: python
Published: 2024-05-22 15:58:39

date:- 22 May, 2024.
Errors --> 1) Syntax error - Every programming language has to be written in a specific way. In simple words, it's the grammar of that language. These rules are called syntax. Violating them will result in syntax error. 

2) Indentation error - In Python, we use indentation to indicate if a code is a part of a block or not. By block, I mean some function or control flow statements. If not then there shouldn't be any space before the code else it would result in an indentation error.

Built-in functions:-
1) lower --> In this method(function) we pass a string which is then returned by changing all its characters into lowercase. To call it - string_to_convert.lower()
2) count --> This is a method that returns the number of times a character(s) appears in the string passed. To call it - string.count('char') 

Comparison operator:- They are used to compare two values.
To check if a is equal to b: a == b
To check if a is greater than b: a > b
To check if a is less than b: a < b
To check if a is less than or equal to b: a <= b
To check if a is greater than or equal to b: a >= b
To check if a is not equal to b: a != b
The comparison operator auto converts the result in boolean values, True or False.

**Control flow statements**:- Python interpreter executes the code from top to bottom. Control flow is the code statements that change this flow of interpreter based on some conditions defined by us.
1) If-else statement - With the help of it we execute the code which satisfies some condition. Syntax is below:

![if-else statement](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fd6eogarvh6r8dn8owvb.png)
First condition 1 will be checked, if it comes to be True,
the indented code inside the if-block will get executed. The interpreter will skip the else-block. If it is False, the if-block code is skipped and the else-block code will be executed. 
We can use an if statement inside another if/else statement. Also, we can use multiple if statements one after another. But then the interpreter has to check all the conditions. To save this we have an elif statement. It is used when conditions are related, if one occurs others can't.   

Program-- I made a leap-year calculator.

![leap year calculator](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jd0lrf8x1afaczjpa01l.png)



----------------------------------------------------------

Personal--> Yesterday, due to a loss in the market, I had to revisit my charts and strategy. So have to give a miss to coding. I am sorry for this, and I promise to do at least one coding exercise on such days so that no day go wasted.
I have to use a photo, as in the preview indentation is not shown. I have seen other people's blogs. Those are well formatted. I hope I will improve my blog also. Right now, I won't be able to give time to it. However, I have started English grammar lessons to improve my written skills.
STORAGE CREATION FOR THE IT DEPARTMENT TESTING AND TRAINING
Published: 2024-05-22 15:55:56

In the Azure portal, search for and select Storage accounts.
Select + Create.
On the Basics tab, select your Resource group.
Provide a Storage account name. The storage account name must be unique in Azure.
Set the Performance to Standard.
Select Review, and then Create.
Wait for the storage account to deploy and then Go to resource.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b7y1wt5x26jbnb8k70g3.png)

In your storage account, in the Data management section, select the Redundancy blade.
Select Locally-redundant storage (LRS) in the Redundancy drop-down.
Be sure to Save your changes.
Nb: The data in this storage account doesn’t require high availability or durability. A lowest cost storage solution is desired.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3pm0vxkz6tf62g6kbe90.png)

In the Settings section, select the Configuration blade.
Ensure Secure transfer required is Enabled.
Developers would like the storage account to use at least TLS version 1.2
In the Settings section, select the Configuration blade.
Ensure the Minimal TLS version is set to Version 1.2.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9dmjol5av2orbtubklv8.png)

Until the storage is needed again, disable requests to the storage account. Learn more about disabling shared keys.
In the Settings section, select the Configuration blade.
Ensure Allow storage account key access is Disabled.
Be sure to Save your changes.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/29jdkyln10rlrr3zwfli.png)

Ensure the storage account allows public access from all networks.
In the Security + networking section, select the Networking blade.
Ensure Public network access is set to Enabled from all networks.
Be sure to Save your changes.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8bay2vnc9bwv7xa9ox36.png)
Deploying gitea into kubernetes with custom domain
Tags: kubernetes, helm, proxmox, bind9
Published: 2024-05-22 15:40:00

---
title: Deploying gitea into kubernetes with custom domain
published: true

tags:
 - kubernetes
 - Helm
 - Proxmox
 - Bind9

published_at: 2024-05-22 15:40 +0000
---

Hello, lately I have been trying to deploy a custom Docker image into my local Kubernetes cluster. It turned out I needed to host my Docker image on a container registry, either Docker Hub, which is not suitable for my use case, or deploy and use a local registry. During my research, I found Gitea, which I liked as it allows me to deploy all my projects on it and also host the containers.

to continue, read this [article](https://hamzabouissi.github.io/posts/deploy-gitea-k8s/)
MJSQ 101: Function.prototype.bind
Tags: codenewbie, javascript
Published: 2020-03-25 05:54:08

## More JavaScript Questions 101(MJSQ 101): 
Continuing from my original [blog post]("https://dev.to/danvyle/more-javascript-fundamentals-101-4d5d"), I give you more javascript 101 questions answered!:

Question this week:
## Explain Function.prototype.bind

Taken word-for-word from MDN:

The bind() method creates a new function that, when called, has its `this` keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function is called.


```js
const module = {
  x: 42,
  getX: function() {
    return this.x;
  }
}

const unboundGetX = module.getX;
console.log(unboundGetX()); // The function gets invoked at the global scope
// expected output: undefined

const boundGetX = unboundGetX.bind(module);
console.log(boundGetX());
// expected output: 42


```
In their example, the unboundGetX variable cannot call on the module variable's getX function until it has been bound with the Function.prototype.bind method.

This approach would be good when you're wanting to bind the value of `this` to pass into other functions.


References
https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_objects/Function/bind


That's all for today, please leave any comments/questions/corrections in the comments. Thanks!


###### Sources:
Huge huge thanks to github user: yangshun for aggregating the most popular JS, CSS and HTML questions and giving us his answers to it. My weekly blog posts are to go over several questions at a time to reinforce my knowledge of fundamental javascript as I grow my expertise in it. Many of my blog will be paraphrasing if not direct quotes from his github. Find his tech interview handbook [here]("https://github.com/yangshun/front-end-interview-handbook/blob/master/questions/javascript-questions.md#whats-the-difference-between-call-and-apply") and please support him!

And an additional thank you to Flatiron alum: Marissa O. who is a badass developer at Forbes magazine for directing me to his blog!