teleren/devto huggingface dataset:
Javascript vs Python
Tags: javascript, python, programming
Published: 2021-05-06 05:11:30

My first programming language is Javascript and we've had a back and forth relationship. I've now started learning my second programming language Python. My first impressions are positive. One area of difference between the two languages that caught my eye was the difference in equality operators.

Javascript: ==, !=, ===, !== 
Python: ==, !=, is, is not

It is nice to see english words in code but then I got to thinking about people who don't speak english. Does this make it harder for them? The way Javascript does it is definitely more universally understandable I would imagine. That being said and knowing english, I do like the actual words. I also noticed Or, Not, AND instead of ||, !, &&, AND I like that too!

What do you think?
How to solve Graph Coloring problem using Backtracking
Tags: graphcoloring, backtracking
Published: 2021-05-06 04:59:55

What is Backtracking ?

Backtracking is nothing but its a technique based on algorithms. It uses recursion to find the solution step by step increasing values with time and also it removes the solutions which don’t rise the solution based on constraints given in problem.

This backtracking is used in depth first search,graph coloring, Hamiltonian cycle.

What is graph coloring?

In graph coloring problem we color the vertices of graph in such a way that no two adjacent vertices or neighboring vertices share the same color. Same vertices can be colored in different ways so there are more one solutions possible here we want all possible solution what are the ways that can be colored so its like a permutations or trying out all possibilities and then picking up the one which are satisfying the condition, so the condition is neighboring vertices should not have same color so this type of problem can be solved using Backtracking then if you want multiple solutions and there is a different possible solution go for backtracking.

In this problem we have given a chromatic number m which is the least number of colors needed to color a graph.

EXAMPLE:

Now we take a simple graph and show you how this can be solved by using backtracking

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bvdxvetsoo5ns3rrutas.png)
 
                    
STATE SPACE TREE:

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n4npe3bedpk5z0wtu936.png)

EXPLANATION:

1. State space is tree is mainly used to find out all possible solutions of the graph which satisfies constraints.
2. Initially A has the possible cases 1,2 and 3 if A takes the color 1 then B has two cases, and adjacent is 1 remaining two colors are 2 and 3 .Similarly this procedure is followed for vertices 2 and 3.
3. Suppose B is colored with 2 then C has two cases either 1 and 3
4. Now for D, A is 1 and C is 1 so possible combinations are 2 and 3.
5. For example in the above tree C is 3 ,A is 1, B is 2 so the adjacent are 1 and 3 only possible case is 2.
6. In the 3rd level A is 1 ,B is 3 and only adjacent is B,B is called 3 so the only possibility are 1 and 2. SO, C color is 1 and A color is 1 so two cases are 2 and 3. And A color is 1, B color is 3 and C color is 2 so, A and c are adjacent vertices, A color is 1, C color is 2 so remaining color is 3.
7. Second level represents all the possible colors which can be placed in vertex A.
8. Third level represents all the possible colors which can be placed in vertex B.
9. Fourth level represents all the possible colors which can be placed in vertex C.
10. Fifth level represents all the possible colors which can be placed in vertex D.

The chromatic number of the graph is 3(the minimum number of colors required to satisfy this problem).
Mejorar una librería, Utilizar GitHub Actions
Tags: spanish, perl, github
Published: 2021-05-06 04:47:30

---
title: Mejorar una librería, Utilizar GitHub Actions
published: true
description: 
tags: spanish, perl, github
//cover_image: https://direct_url_to_image.jpg
---

Estoy aprendiendo Español por dos años y media y pienso que la mejor manera para mejorar mi conosimiento es practicar.

Por eso empecé hacer eventos de programacion por pares en Español. Vale, en Español se roto que tengo.


{% youtube D2rn54h0BDM %}


[links](https://es.code-maven.com/utilizar-github-actions)

Sí tú tienes la paciencia para hablar conmigo y quieres hacer una sesión conmigo, ¡contactarme!

Yo hice [otros eventos](https://code-maven.com/live) sobre otras tecnologias pero en inglés.
My Criteria For Picking Startup Ideas
Published: 2021-05-06 04:38:38

After having failed with more than seven startups and finally achieved some success with my latest one Proxies API, here are a bunch of criteria I follow when picking a startup idea to bootstrap from the website

1. I am a bootstrapper, so I am interested in making recurring revenue and build an asset. So it has to be a SAAS idea. No consumer internet.

2. It has to have a competition. Again, I want to make money, not be a pioneer.

3. It need not be a multi-million dollar potential startup. I prefer it if it’s possible never exceeds a million dollars at its peak. It is because I don’t want to offer a platform, but a small subset of features that people find useful and the big guys find too small a market niche to address.

4. I prefer it if it does not need any design skills. With Proxies API, it is all about technology and how it works. I am in my element when I can run with just code and not have to pause for ‘prettifying stuff.’

5. I want a self-serve model. It is because I want to acquire customers by marketing rather than by sales. I have nothing against sales. I prefer this as I like to code, and I am a bit shy and introverted. I can write, in any case.

6. I want a field where I can write a lot about it. Just by looking at the area, I should be able to imagine what my first ten blog posts will be. If I can’t write, I can’t market. So I would slightly not touch it as I am not good at the rest of them.

7. The product should not be commoditized. It’s happening in almost any market after about five years. Social media tools are an example. They were selling at $100 pm a few years back now people are offering it free.

8. The technology should provide a moat against every amateur trying to start a company. That’s why there are a million to-do list apps. That’s practically the first thing they teach in any course.

9. I want to identify the primary keyword that drives traffic and search for that keyword on Google Trends. Google Trends should show the keyword gaining in popularity ideally, or at least it should be a flat line for the last five years. I will stay away from anything that is on its way out.

10. I want the users to get the AHA moment in one line or one image and not in multiple steps or after they “add 18 friends and two monkeys” rubbish. Just one look and the value prop is right there. With Proxies API, it was always this image and line. In essence, it immediately drove home this visceral power of using a single API call to solve an entire gamut of problem-related to scaling web crawling.

The author is the founder of Proxies API the rotating proxies service.
Unbounded by Dell - Hackathon from May 14-16, 2021
Tags: pravega, hackathon
Published: 2021-05-06 04:30:56

This three day virtual hackathon aims to bring together developers, designers and entrepreneurs to solve challenges using Pravega, an open-source storage system that exposes stream as the main primitive for continuous and unbounded data.

Register Here: https://unboundedhackathon.com/?source=Dev.to

Join us to test your creativity, network with like minds, and collaborate on real-world solutions incorporating durable, elastic, append-only, unbounded technology from Pravega.

Sign up and compete to win your piece of $10,000 in prizes.
Unleash your curiosity and happy streaming!

{% youtube aQjxx80W9mQ %}

Register Here: https://unboundedhackathon.com/?source=Dev.to
Support Developers: Get Your Always Free PolarDB on Alibaba Cloud
Tags: database, cloudskills, cloudnative
Published: 2021-05-06 04:25:21

Hey, good news to all developers. To support developer community, we decide to give benefits to all those who wanna take advantages of cloud native era to develop application with high scalability and less O&M.

Engines Support
* MySQL
* PostgreSQL 
* Oracle

Register now, you will get following resources for FREE.
1> One always free 2C8G PolarDB instance
> Need to apply every month.

2> One always free 50GB PolarDB Storage Package 
> Need to apply every month.


![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vsf2tj1lz03asygl81bk.png)

 [Apply Now >](https://www.alibabacloud.com/product/polardb#J_5764451150)
[Learn More About PolarDB >](https://www.alibabacloud.com/help/product/58609.htm)
[PolarDB Tutorials >](https://www.youtube.com/playlist?list=PL54EFTJJZrwg8E8HINabBLkQF_4oWukp4)
NABARD Grade A Free Material - Download PDFs & Notes
Tags: nabardgradea, nabardgradeanotes, freestudymaterial
Published: 2021-05-06 04:07:16

Get FREE NABARD Grade A Study Material for Phase 1 and Phase 2 with PDFs, Videos, Study Notes, and Mock Tests.

Hi friends. Seeing you on this page, I think it is safe to assume that you have your sights fixed on the upcoming <a href="https://www.anujjindal.in/nabard-grade-a-complete-info/">NABARD Grade A</a> exams. 

However, it’s my duty to inform you that cracking the NABARD Grade A exam won’t be an easy task.

Aspirants prepare for the exams with all their hearts and minds, and this means you will face tough competition.

This heavy competition that you are so definitely bound to face during the NABARD Grade A recruitments easily causes it to be one of the toughest exams in the country today. 

Now just for a while let’s divulge and ask ourselves why so many people flock to compete in this exam annually.

Well, it’s because cracking the NABARD Grade A exam is what will grant you the opportunity to be a NABARD Grade A officer, have guaranteed career stability, great compensations, work steadiness, work fulfillment, and the opportunity to play a part in the nation’s rural, agricultural, and economic development. 

So, getting back to the topic at hand, to crack the <a href="https://www.anujjindal.in/nabard-grade-a-notification-admit-card-eligibility-and-salary/">NABARD Grade B exam</a> or any other exam for that matter would require you to keep in mind something that I have written about in the next lines. So read carefully. 

There are two points that will decide whether someone will make it through in their exams or not. The first is the willpower and determination of the candidate. This is something that will make him work really hard to prepare for the exam. 

The second is the right study material for that particular exam, without which even the hardest and the most motivated of workers can’t make it through to the other side. 

Furthermore, the candidate needs to make sure that he carries both of the above points together while preparing for the exam if he wishes to succeed.

Both of the aforementioned points are useless in and of themselves if taken individually.

Therefore I repeat, the candidate needs to carry both of the points together if he wishes to succeed in his exams.  

Having said that, I want to say that the first point, which is the required motivation and willpower, is a responsibility that will be entirely yours to take. I’ll play no part in that.
Determine Whether Two Date Ranges Overlap in PHP
Tags: php, algorithms, zeroblog
Published: 2021-05-06 04:02:21

An interval is represented as a combination of start time and end time. Given a set of intervals, check if any two intervals intersect.

Examples:
```php
$periods = [
   ['start_time' => "09:00", 'end_time' => '10:30'],
   ['start_time' => "14:30", "end_time" => "16:30"],
   ['start_time' => "11:30", "end_time" => "13:00"],
   ['start_time' => "10:00", "end_time" => "11:30"]
];
```
Expected time complexity is O(nLogn) where n is number of intervals.

```php
/**
 * Check the two time periods overlap
 *
 * Example:
 * $periods = [
 *      ['start_time' => "09:00", 'end_time' => '10:30'],
 *      ['start_time' => "14:30", "end_time" => "16:30"],
 *      ['start_time' => "11:30", "end_time" => "13:00"],
 *      ['start_time' => "10:30", "end_time" => "11:30"],
 * ]
 *
 * @param $periods
 * @param string $start_time_key
 * @param string $end_time_key
 * @return bool
 */
public static function isOverlapped($periods, $start_time_key = 'start_time', $end_time_key = 'end_time')
{
    // order periods by start_time
    usort($periods, function ($a, $b) use ($start_time_key, $end_time_key) {
        return strtotime($a[$start_time_key]) <=> strtotime($b[$end_time_key]);
    });
    // check two periods overlap
    foreach ($periods as $key => $period) {
        if ($key != 0) {
            if (strtotime($period[$start_time_key]) < strtotime($periods[$key - 1][$end_time_key])) {
                return true;
            }
        }
    }
    return false;
}
```
In this script, i use <=> Spaceship operator, you can check it [here](https://www.tutorialspoint.com/php7/php7_spaceship_operator.htm)

Copy from [Zeroblog](https://www.zeroblog.net/2021/05/determine-whether-two-date-ranges.html)
LeetCode 188. Best Time to Buy and Sell Stock IV (javascript solution)

Tags: algorithms, javascript
Published: 2021-05-06 04:00:23

###Description:
You are given an integer array prices where prices[i] is the price of a given stock on the ith day, and an integer k.

Find the maximum profit you can achieve. You may complete at most k transactions.

Note: You may not engage in multiple transactions simultaneously (i.e., you must sell the stock before you buy again).

###Solution:
Time Complexity : O(n^2)
Space Complexity: O(n)

```javascript
 var maxProfit = function(k, prices) {
    if(!prices.length) return 0;
    // Create dp arrays
    const even = Array(prices.length).fill(0)
    const odd = Array(prices.length).fill(0)
    
    for(let i = 1; i < k+1; i++) {
        let prevMax = -Infinity
        // Switch arrays to proper values when we are on an odd or even number
        const current = i % 2 === 0 ? even : odd;
        const prev = i % 2 === 0 ? odd : even;
        // Fill dp arrays with max profit on each day when making i amount of transactions
        for(let j = 1; j < prices.length; j++) {
            prevMax = Math.max(prevMax, prev[j-1] - prices[j-1])
            // current[j-1] means we will do nothing on the j day and take the max profit from the previous day
            // prices[j] + prevMax is the profit from gained on this day (prices[j]) and the max profit we could make from a previous transaction (prevMax)
            current[j] = Math.max(current[j-1], prices[j]+prevMax)
        }
    }
    // Current and prev change based on i. This chooses the correct curent array
    return k % 2 === 0 ? even[even.length-1] : odd[odd.length-1]
};

```
Fix AMD Radeon (Arch) Linux failed to start LightDM on boot
Tags: displaymanager, lightdm, amd, radeon
Published: 2021-05-06 03:42:44


## Background

I use [Artix Linux](https://artixlinux.org/) as my workstation, which is based on [Arch Linux](https://archlinux.org/) and adopts [Systemd](https://www.freedesktop.org/wiki/Software/systemd/)-free approach. In my case, the init system is [OpenRC](https://wiki.gentoo.org/wiki/OpenRC).
My current machine is home-built using [AMD](https://www.amd.com/) [Radeon](https://www.amd.com/en/graphics/radeon-rx-graphics) as graphics card and GPU.

## Problem

It always failed to start [LightDM](https://wiki.archlinux.org/title/LightDM), a [display manager](https://wiki.archlinux.org/title/display_manager), on boot, and just showed blank screen except a single underscore.
I had to:

1. push Alt + F4 to meet [XDM](https://wiki.archlinux.org/title/XDM) console
2. enter login password
3. run `startxfce4`
4. enter password again

... every time🤒
Also, [Fcitx](https://wiki.archlinux.org/index.php/Fcitx) hadn't worked well for every first boot recently.
It was inconvenient and uncomfortable.

## Solution

I followed the Arch Linux documentation below and have become happy😃

- https://wiki.archlinux.org/index.php/Kernel_mode_setting#Early_KMS_start

First, I edited `mkinitcpio.conf`:

```console
# nvim /etc/mkinitcpio.conf
```

to enable `amdgpu` module like this:

```diff
- MODULES=""
+ MODULES=(amdgpu)
```

Then I rebuilt initial ramdisk for [Linux](https://www.linux.org/) kernel:

```console
# mkinitcpio -p linux
```

That's it. I have got along with LightDM ever since😊

![successful](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wqqyezrga2sai5qkcoqm.jpg)
Animated Flying Birds
Tags: javascript, animation, birds, css
Published: 2021-05-06 03:41:18

{% codepen https://codepen.io/lemmin/pen/QWpWMNV %}

Very simple bird flapping animated by CSS with some JS moving them across the screen.

Use the options array at the top of the JS to adjust the speed range, angle range, size range, and the delay between birds.

Ocean waves from a previous pen: https://codepen.io/lemmin/pen/mdrGYaW
Django\Python Question
Published: 2021-05-06 03:15:57

Hey everybody!

So, I had asked this on Stack overflow, but I don't think it was the right forum.

Does anybody have any advice when it comes to building simple business reviews for a company? Not product reviews, but just reviews for a service company.

I was thinking of just building the models, views, and forms, and then rendering in the index. But I couldn't quite formulate the best way to do this without authentication and without spam risks.

Anybody got any ideas?
49 Days of Ruby: Day 40 -- Web Frameworks: Sinatra
Tags: ruby
Published: 2021-05-06 03:09:40

---
title: 49 Days of Ruby: Day 40 -- Web Frameworks: Sinatra
published: true
description: Join us on a 49 day learning journey through Ruby!
series: 49 Days of Ruby
tags: #ruby
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/9m73qaetuse3nm3y3it8.png
---

**Welcome to day 40 of the 49 Days of Ruby! 🎉**

For the next few days, we are going to cover the world of web frameworks in Ruby!

Today, we are starting with **Sinatra**.

[Sinatra](http://sinatrarb.com/) is a very lightweight web framework to help you get up and running.

**What is a web framework, first of all?**

Web frameworks take care of a lot of the overhead in building web applications for you. It allows you to focus on *what* you want your application to do, and less about how to do it.

When we say that Sinatra is a lightweight web framework, we mean that it automates less of that overheard. That could be helpful because it gives you more freedom to customize, but it also can mean potentially more work.

To start with a new Sinatra web app, it could be as simple as the following, taken from the project's [introduction](http://sinatrarb.com/intro.html):

```ruby
require 'sinatra'

get '/' do
  'Hello world!'
end
```

Sinatra lets you build routes based on those HTTP verbs that we learned about earlier, as such there are `get` and `post` routes among others.

You can also build classes and blocks of code to use inside your routes, again from the introduction:

```ruby
class Stream
  def each
    100.times { |i| yield "#{i}\n" }
  end
end

get('/') { Stream.new }
```

In the above example, we create a new class called `Stream`, and we redefine the `#each` method. The method prints each number from 1 to 100 and a new line.

Then, we invoke the `Stream` class inside the `get('/')` route.

Spend some time exploring the [Sinatra docs](http://sinatrarb.com/documentation.html) today and see what you can build. See you tomorrow!

**Come back tomorrow for the next installment of 49 Days of Ruby! You can join the conversation on Twitter with the hashtag [#49daysofruby](https://twitter.com/hashtag/49daysofruby).**
What I've learned today - 4 - Elixir - Executing a code after load
Tags: elixir, programming
Published: 2021-05-06 02:53:16

## Quick tip

Executing code Immediately after loading a Module

Elixir has @on_load which accepts atom as function name in the same module or a tuple with function_name and its arity like {function_name, 0}.

## Examples

```elixir
#Hello module 
defmodule Hello do
@on_load :onload     # this executes after module gets loaded 
  def onload do
    IO.puts "#{__MODULE__} is loaded successfully"
  end
end
# Execution .... Just copy and paste the code in the iex terminal
# You will see the output something like this ....
Elixir.Hello is loaded successfully  
{:module, Hello,
 <<70, 79, 82, 49, 0, 0, 4, 72, 66, 69, 65, 77, 65, 116, 85, 56, 0, 0, 0, 130,
   0, 0, 0, 12, 12, 69, 108, 105, 120, 105, 114, 46, 72, 101, 108, 108, 111, 8,
   95, 95, 105, 110, 102, 111, 95, 95, 9, ...>>, {:onload, 0}}
```

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mbk4rsnt7nq6v375i64s.png)

Obtained from: [https://github.com/blackode/elixir-tips](https://github.com/blackode/elixir-tips)

I appreciate everyone who has read through here, if you guys have anything to add, please leave a comment.
Java Spring Boot: Is there a specific learning path?
Tags: programming, java, beginners, springboot
Published: 2021-05-06 01:29:19

### Long story short, I have been asked to learn Java Spring Boot for work, in two months.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g3dwmg7uqg2qbenczo5e.jpg)

I searched for many online resources, from Udemy to Baeldung, but I am totally unaware of the correct learning path. Some of them are very expensive while some of them are unpaid but very basic.

I do not wish to invest more time in exploring and getting even more confused. I wish to understand more about the dependencies and use cases.

Being from a python background, I am not very well aware of the Java environment. I can code in Java, but limited to DSA. 

* Is there a specific learning path that I must follow? If yes, please guide me.

* Is there any kind of hands-on course that'll help me build and learn simultaneously? 

What would you prefer?

Thanks!
¿Cómo ser más productivo?
Published: 2021-05-06 01:25:12

En esta pandemia y trabajando remoto es posible que tengamos muchas más actividades por hacer, sean del trabajo, personales, de salud, etc. 


Y lo mejor es ordenarnos, para realizar las diferentes actividades, pero es posible que les asignemos poco tiempo, por lo que la cantidad de tiempo necesaria tenga que ser distribuida en más de 1 día. Y si por ejemplo, varias de esas actividades toman 3 o 4 días, entonces, tendríamos que esperar hasta el día 3 o 4 para tener el resultado terminado. Eso no estaría mal, si los resultados los compartimos semana a semana. Sin embargo, a veces, poder ir por el camino de presentar actividades terminadas durante la semana, para ese caso, lo mejor es concentrarnos en las actividades y terminarla en 1 o máximo 2 días.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oty51778dbsddn5mrur2.png)

Es la misma situación, si las actividades son distribuidas en semanas o meses. Incluso en años. Según la actividad, prioridad e importancia, podríamos tomar el camino del enfoque o de la distribución en un mayor tiempo.
Boom Box with pure css
Tags: webdev, css, html
Published: 2021-05-06 01:21:32

Created this boom box with animation using pure html and css
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sq8cv049f32m64xb55nf.gif)

CodePen:
https://codepen.io/Abdullah_Noor/pen/BaWaRmX

My twitter:
https://twitter.com/ANoorDev