teleren/devto huggingface dataset:
Most Frequent Number in Intervals
Tags: cpp, algorithms, programming, 100daysofcode
Published: 2022-02-09 20:35:22



# Description

You are given a list of list of integers `intervals` where each element contains the inclusive interval `[start, end]`.

Return the most frequently occurring number in the intervals. If there are ties, return the smallest number.

**Constraints:** 

- `n ≤ 100,000` where `n` is the length of `intervals`

## Example 1

### Input

```
intervals = [
    [1, 4],
    [3, 5],
    [6, 9],
    [7, 9]
]
```

### Output

```
3
```

### **Explanation**

```
The most frequent numbers are [3, 4, 7, 8, 9] and they all occur twice but 3 is the smallest one.
```

---

# Intuition

# Implementation

```java
int solve(vector<vector<int>> &intervals) {
    map<int, int> map;
    for (auto &interval : intervals) {
        map[interval[0]]++;
        map[interval[1] + 1]--;
    }
    int level = 0, max_level = 0, ans = 0;
    for (auto &pair : map) {
        level += pair.second;
        if (level > max_level) {
            max_level = level;
            ans = pair.first;
        }
    }
    return ans;
}
```

## Time Complexity

- Time: O(N)
- Space: O(N)
To refactor or not to refactor?
Tags: refactoring, legacy, beginners, programming
Published: 2022-02-09 20:18:54

While working with code (especially legacy one), you may often stumble upon parts of the code that needs refactoring. But... should you always refactor? 

You may say - where this question is coming form? Just refactor. There is a Scout rule! Always leave the code in the better shape.

That's true. But...

It's good to leave code in a better shape that it was before. However, refactoring (especially in complex, legacy projects) may be time consuming and may not add a clear benefit to your current work

### Before refactoring, consider things below:

-   How complex is the change I want to make?
-   Why I want to make this change? Will other devs benefit from it (or do I only want to rewrite the code in my way)?
-   Does current task benefit from this change? If so, how?
-   Would this change slow down the development?
-   What is testing scope for that? Is there any additional regression testing needed after this change is implemented?

### There are also small refactoring tasks you can usually do with no major impact, these are:

-   Code formatting so the code is more readable and follows current project standard
-   Change variables or functions names to be more descriptive
-   Extracting code to variables/functions if you see that code is being duplicated
-   Creating helper functions that can be reused

**And do you always refactor?**
Before Wordle...
Tags: java, wordle, code
Published: 2022-02-09 20:17:55

If you've been on the internet recently, you've probably come across [Wordle](https://www.powerlanguage.co.uk/wordle/). If you haven't, you should definitely check out this highly addictive internet word game where you try to guess a 5-letter word using color-based clues. Each day, you will get six tries to guess a new word. After submitting a guess, the letters of your guess will turn different colors. Green letters indicate a correct letter in the correct spot, yellow letters indicate a correct letter in an incorrect spot, and grey letters indicate a letter that is not in the word at all.

![Wordle 235 4/6](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rfloe3qsgq7mi9rs1e29.png)
 
When I first came across this wildly fun word game, something about it felt familiar, and for a good reason. I created my own version of Wordle about 5 years ago. 

Back in high school, everyone would play what we called "The 5 Letter Word Game" on our school whiteboards. Two players or teams would each come up with their own 5-letter word and keep it a secret. Then, just like Wordle, each team would take turns trying to guess the word. After each guess, the opposing player or team would circle or X out letters that they got right or got wrong respectively with different colored circles corresponding to correct placement or not. 

Seems pretty familiar right? Well, for the final project for one of the first programming classes I ever took, two friends and I decided to digitize the game. Students could log on to the school computers and connect with their friends using their IP address to play. The online interface made it so that we didn't have to spend time thinking about X-ing out and circling the right letters, the game did it for us, so we could play much faster. To say it was popular would be an understatement. My classmates and I played until we graduated. It was my first truly successful programming project and one of the reasons why I started believing in the idea that I could be a software engineer one day. 

This was long before I knew about software hosting on websites such as [Github](https://github.com/), so although I had a copy of the repository holding the blood, sweat, and tears that went into the creation of the 5-Letter Word Game on my laptop for many years, somewhere along the way I lost it. The only remnants I have of the game is a clipping from a paper I wrote about the project.  

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

A few days ago it was announced that Wordle, which began as a Covid side project, was purchased by The New York Times for a price "in the low seven figures." I couldn't help but laugh to myself that perhaps in another universe, my 5-Letter Word Game could've taken off just like that. Moral of the story: You're never too young or too inexperienced to create something awesome. All you need is a great idea, and you never know...you might have the next Wordle on your hands.
Agrippa 1.4 is out 🎉🎊
Tags: react, javascript, webdev, news
Published: 2022-02-09 20:15:23

The fourth minor version of Agrippa, the React component CLI, is finally out!

Once again, Agrippa's community has grown a lot since the release of the previous minor update, v1.3.0, [back in December](https://dev.to/nitzanhen/agrippa-13-is-out-4g0n). **Agrippa has grown by over 230 stars since the previous release** - in absolute terms, that's our biggest growth yet!

Releasing a new version is always a good opportunity to *express my deep gratitude to everyone using Agrippa*, and especially those of you who've given your feedback, suggested features, or opened other issues on our GitHub repository. You're the best!

If you're not using Agrippa, join us! Read the [Getting Started](https://dev.to/nitzanhen/getting-started-with-agrippa-the-react-cli-24i8) guide or [visit us on GitHub](https://github.com/NitzanHen/agrippa).

## v1.4.0

We have some exciting new features released in v1.4.0:

### New terminal UI 🎨
Agrippa's terminal UI has been revamped! it should now be more informative, a lot cleaner, and especially much more ✨*aesthetic*✨.

As an example:
![New Agrippa output](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/20xwatxk14tah0i1jnat.png)

### Styled-components 💅
Agrippa now supports styling with `styled-components`! This is actually the [second issue](https://github.com/NitzanHen/agrippa/issues/2) opened for Agrippa, and it's been open for quite a while now. It's truly nice to see it finally implemented. To check it out, use the value `styled-components` for the `styling` flag.

### tsPropsDeclaration
TS users can now select between `interface`s and `type`s for component props declarations.
For more info, see [the docs on `tsPropsDeclaration`](https://github.com/NitzanHen/agrippa/wiki/The-complete-list-of-generation-options).

### New post-command variables
Two new variables, `<ComponentName>` and `<component-name>`, can now be used with post commands.
The first is the generated component's name in pascal case (e.g. `NiceButton`), while the second is in kebab case (e.g. `nice-button`).

### Dependency cleanup 
Two packages that Agrippa has been using up to now, but hasn't really needed to, were removed, and Agrippa should now be a little lighter.

<div/><br/>

That's pretty much it! We've already begun to work on the next features for Agrippa. Our main focus in the near future is on implementing test file generation, further expanding Agrippa's flexibility to suite custom use-cases, and more. 
That being said, we're always on the lookout ideas for new features and improvements, so if you have one - please share it with us!

To get started with Agrippa, read the [Getting Started](https://dev.to/nitzanhen/getting-started-with-agrippa-the-react-cli-24i8) guide or [visit us on GitHub](https://github.com/NitzanHen/agrippa).
*Your thoughts and feedback, as always, are most welcome*.
If you've found a bug with this release, or want to suggest a new feature, please [submit an issue](https://github.com/NitzanHen/agrippa/issues).

Cheers!
Automate Job search with LazyApply 
Published: 2022-02-09 20:05:30

Earning money is one of the most important things in one's life. Without money, we cannot survive a single day on earth as most of the things we own or use are obtained after spending money.

The most popular option to do such is to work in a company and earn from them. To get hired for jobs in such companies one needs to provide an [application for a job](https://lazyapply.com) to that company.

And this process is now made easier in today's world where one can just sign in to websites like Lazyapply and fill up a bit of information and the rest of the work would be done by the application itself. With the advancement of technology applying to jobs is as easy as drinking water.

How does [LazyApply](https://lazyapply.com) work?

At first, you would need to register to one of these websites, like [LazyApply](https://lazyapply.com) in this case. Then you would simply submit your resume and a bit more information like your qualification, types of jobs you are looking for, etc.

They have a separate panel to just select filters based on your needs and then you can directly click on "Start Applying" for jobs. And with that one single click, you can apply to more than 100 jobs at a time, which if you were planning to do by the traditional method would have taken days and is so frustrating. Job application from [Lazyapply](https://lazyapply.com) has become easier than ever.

What they do is they take information from you about your qualifications and choices and search accordingly for the jobs available to you.

And then their automated system applies for jobs one by one like you would have done manually. In other words, think it of something like you are working but just superfast.

They also provide the feature of applying for a job by email where you have a particular company that you want to apply to. You can just directly go to their LinkedIn profile and get their official email address in one click only if you are registered to their services.

Are these services free of cost?

No, they are not. They charge a very small and fair amount for this job, payment for which needs to be done during the registration process itself.

They have the feature of one-time payment as their subscription plan so you don't have to pay a monthly or yearly amount throughout your life. Once you have registered with them, you can use their services throughout your lifetime.

They are doing the tiring work for you and applying to more than 100 jobs in a fraction of a second. And in return, they are taking a one-time payment of a very genuine amount.

This is totally a fair process and if you are someone who is on a tight program or a person with no experience of applying for jobs, LazyApply is totally a lifesaver as it is cheap, convenient and, fast at the same time. It lets you sit back and relax while it does all of the work on your behalf.

Contact LazyApply

Official Website Link: 

https://lazyapply.com/

Email:  

info@lazyapply.com

###
Beginner tutorial on AWS transcribe with a recorded file during classroom
Tags: aws, tutorial, productivity
Published: 2022-02-09 20:04:27

I've started school at distance for a month with recorded sessions. Going back on premise would be slightly challenging with all the setup I had. Big monitor, larger screen estate and a much more powerful computer. It got me thinking, why not record the audio during class. I have spent sometime searching for an ideal app to do the recording and surprisingly Windows already have one. It's surprisingly good! The most important feature is to mark an audio track and it's there. The output file is a mp4.

With a 2 hours audio file on hand, let's get started with AWS Transcribe!!!

**1 -** We first need to create a s3 bucket and import our audio file there. On your AWS management console, search for s3 and create a bucket name XYZ. You can leave all the settings as default.

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

**2 -** Once the bucket is created, click on it and start uploading your file. My file is 2 hours long, you can upload a maximum file of 4 hours.


**3 -** We have one major part done. Let's get to Transcribe via the AWS management console. Look for "Transcription jobs" on the left pane and click on it. Enter a job settings name, I used "2022-vng-transcribe". On input data section, click on the input file location on s3, you'll have a helper to guide you to your s3 file. Leave everything on default, create the job and let the service do its job.

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

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

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

**4 -** Once your job is done, the status will change to Complete. It took me about 15 minutes and cost me "around" 1.40$.

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

What you get after the processing is the text and a json file available to download.

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

For a beginner with AWS services, it was extremely easy to perform this task. If your planning to try, I've included some links regarding the cost and to the actual documentation. What is important to take into account, it is the length of your file and the filetype. When recording make sure that your not in a noisy environment. In my situation, my laptop fan was running non stop, therefore I couldn't get a good result. I'll definitely try again with my phone or with another appropriate hardware.

I hope you enjoyed this short tutorial!


Here are some links, on the [pricing](https://aws.amazon.com/free/?all-free-tier.sort-by=item.additionalFields.SortRank&all-free-tier.sort-order=asc&awsf.Free%20Tier%20Types=tier%23always-free&awsf.Free%20Tier%20Categories=*all) and on the [documentation](https://docs.aws.amazon.com/transcribe/latest/dg/how-input.html).
How I built a "Text to Handwriting Converter" ✍️ 
Tags: html, css, javascript, webdev
Published: 2022-02-09 19:29:28

Hi everyone, I hope you are all fine. 😊

Today, I want to talk about how I developed a **[text to handwriting](https://10015.io/tools/text-to-handwriting-converter)** converter for my all-in-one toolbox project - 10015.io. 

When I decided to code a text to handwriting converter, I analyzed the tools on the web and the main problem was there are lots of settings which confuses people in these tools and it is not easy to get the result immediately. So, my main aim was to build a "_minimalistic converter_" which does all the dirty job behind the scenes. 

There are just 3 settings in the tool I developed. You can choose:

- Handwriting font
- Ink color
- Paper type

That's it. I didn't add any other settings which will make the tool complicated. Here is the settings section of the tool.

![Text to Handwriting Converter](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/batknnxvoundw6f4uwo7.png)

You can choose different paper types as background. I have a configuration file for each paper type which adjusts the paddings and line heights automatically. You can even send a love letter to your lover by using this tool. 😉

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

Here you can create your own handwriting text.

[https://10015.io/tools/text-to-handwriting-converter](https://10015.io/tools/text-to-handwriting-converter
)

I used "html2canvas" npm package for converting the results into jpeg and "jspdf" package for converting it to PDF. All other process is to adjust the paper layout and text. For adding Google Fonts to the project dynamically, I used react-webfont-loader by dr-kobros.

For more online tools, you can visit [10015.io](https://10015.io).

If you have any question about the development or suggestions about the text to handwriting converter, feel free to ask.
6 Reasons to Build a Chat App with React Native
Tags: reactnative, chatapp, sdk, quickblox
Published: 2022-02-09 19:16:43

---
title: 6 Reasons to Build a Chat App with React Native
published: true
description: 
tags: ReactNative, ChatApp, SDK, quickblox 
//cover_image: https://direct_url_to_image.jpg
---
![React Native Chat App](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/irjv9pvix8oggudora7y.png)

Can you think of 6 reasons to build a chat app with React Native?  Since the release of our React Native SDK, we have seen a significant rise in the number of developer sign-ups looking to build chat with this platform. 

Our React Native SDK enables developers to add real-time chat, audio and video calling, plus a host of other features to their app.

Check out our [recent blog] (https://quickblox.com/blog/6-reasons-to-build-a-chat-app-with-react-native-in-2022/) that highlight 6 reasons why you might want to build a chat app with React Native and share your thoughts below.
What are DApps
Tags: beginners, blockchain, web3, webdev
Published: 2022-02-09 19:11:40

Most apps today run on **centralized** networks, operated by a controlling authority. For example, social media networks, banks, and streaming services hold your data on centralized servers.

While this **centralization** is efficient, it generates huge amounts of user data. And that means unwanted exposure to hacks, creepy advertising.


**Dapps** might feel like regular apps. But behind the scenes, they have some special qualities because they inherit all of the *blockchain superpowers*.

Here's what makes DApps different Apps

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

## 1. No Owners

Dapp code cannot be removed once it has been deployed on Blockchain. Furthermore, anyone may utilize the dapp's functionalities. Even if the dapp's team disbanded, you may still utilize it. Once it's on Ethereum, it's there to stay.


## 2. Free from censorship

You can't be blocked from using a dapp or submitting transactions. For example, if Twitter was on Ethereum, no one could block your account or stop you from tweeting.


## 3. One anonymous login

Most dapps do not need you to divulge your real-world identity. Your account serves as your login, and all you need is a wallet.

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

## 4. Plug and Play

Dapp code is frequently available and compatible by default. Teams frequently build on the work of other teams. If you want to allow users to exchange tokens in your dapp, just copy and paste the code from another dapp.

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

## 5. No down time

The dapp will only go down if Ethereum itself goes down once it is live on Ethereum. Attacks on networks the size of Ethereum's are notoriously tough.


## 6. Backed by Cryptography

Assailants won't be able to fabricate transactions or other dapp activities on your behalf because of cryptography. To keep your credentials safe, you authorize dapp actions with your Ethereum account - normally via your wallet.

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

## 7. Free from censorship

It is not possible to be prevented from utilizing a dapp or submitting transactions. No one could restrict your account or prevent you from tweeting if Twitter was run on Ethereum, for example.
Extending Email Activity History
Published: 2022-02-09 18:46:42

Hello there,

I needed to access the emails I've sent one week ago, but then I realised that I have only 3 days history and I need to pay to extend it.

https://app.sendgrid.com/settings/billing/addons/email_activity

My question is; Can I access to emails that I sent a week ago, if I pay for it right now, or is it going to start working from today and I'm not going to be able to access the emails I sent before?
Rollbar featured in Silicon Angle
Tags: apps, debugging, developers, newfeature
Published: 2022-02-09 18:37:26

Rollbar announces real-time adaptive alerts feature for developers. [See Article](https://siliconangle.com/2021/12/02/rollbar-announces-real-time-adaptive-alerts-feature-developers/) 

“Adaptive Alerts is the next generation of trendline alerting in Rollbar,” said Brian Rue, co-founder and chief executive at Rollbar. “Compared to the previous generation, which Rollbar customers know as the 10^nth Occurrence and High Occurrence Rate, Adaptive Alerts sends 86% fewer notifications, thanks to automatically adjusting thresholds, and a broader exception-level view that effectively detects application-level trends.”

Rollbar is constantly improving and with our free account anyone can access 25k errors every month forever. It's our way of helping all developers. Weather you are working with a few friends brainstorming new ideas or an entire enterprise Rollbar fits anywhere. We will find where, when and how bugs got into your code; All this information brought to you in 1 second, seriously 1 second!

Happy Coding
Simple Rust Macros: 
Tags: rust, programming
Published: 2022-02-09 18:26:39

---
title: Simple Rust Macros: 
published: true
description: First attempt at use Rust's Declarative Macros
tags: #rust #programming
//cover_image: https://direct_url_to_image.jpg
---
I don't often think of macros as a resource in Rust. But I've been playing with a Rust substrate for Paul Graham's [Bel](http://www.paulgraham.com/bel.html) dialect of Lisp.

```rust
/// Bel has four fundamental data types:
/// symbols, pairs, characters, and streams.
/// Instances of the four fundamental types are called objects
/// https://sep.yimg.com/ty/cdn/paulgraham/bellanguage.txt
#[derive(Debug, PartialEq, Clone)]
pub enum Object {
    Symbol(String),
    Pair(Box<(Object, Object)>),
    Char(String),
    Stream,
}
```

There's a lot of code like this: 
```
Object::Pair(Object::Symbol("a".to_string()), Object::Symbol("nil".to_string()))
```

In [Rust for Rustaceans](https://rust-for-rustaceans.com/), Jon Gjengset says:
> Declarative macros are primarily useful when you find yourself writing the same code over and over, and you'd like to, well, not do that.

So I added some simple macros. I got a lot of help from  [Rust by Example](https://doc.rust-lang.org/rust-by-example/macros.html)

```rust
/// nil object (aka 'false')
macro_rules! nil {
    () => {
        Object::Symbol("nil".to_string())
    };
}

/// 'true' object (true is not a good name for a macro)
macro_rules! t {
    () => {
        Object::Symbol("t".to_string())
    };
}

/// general symbol
macro_rules! symbol {
    ($n:expr) => {
        Object::Symbol($n.to_string())
    };
}

/// pair, probably part of a list
macro_rules! pair {
    ($a:expr, $b:expr) => {
        Object::Pair(Box::new(($a, $b)))
    };
}
```

Now I write:
```rust
pair!(symbol!("a"), nil!())
```

Much better, and not nearly as hard as I expected.

You can see the WIP code [here](https://github.com/dougfort/smolbel)