teleren/devto huggingface dataset:
March LeetCoding Challenge 2021 — Day 2: Set Mismatch
Tags: computerscience, codenewbie, algorithms, programming
Published: 2021-03-03 07:13:06


## **Problem Statement**

You have a set of integers s, which originally contains all the numbers from 1 to n. Unfortunately, due to some error, one of the numbers in s got duplicated to another number in the set, which results in **repetition of one** number and **loss of another** number.

You are given an integer array nums representing the data status of this set after the error.

Find the number that occurs twice and the number that is missing and return *them in the form of an array*.

**Example 1:**

    **Input:** nums = [1,2,2,4]
    **Output:** [2,3]

**Example 2:**

    **Input:** nums = [1,1]
    **Output:** [1,2]

## **Solution**

So in the problem, we have to find the missing and repeating number in the array. Here we will discuss 2 approaches to solve the problem.

Approach 1 — Sorting: At first we can sort the array and find the missing and repeating number. To check the missing number we will find the difference between two adjacent numbers. If it is greater than 1, then the missing number will be the number in between those two numbers. For finding the repeating number, we will check whether two adjacent numbers are equal. If they are equal, then we have found our repeating number.

Store the values in the array and return them.
{% gist https://gist.github.com/sksaikia/fd8208b3f320085951678ce69722722f.js %}
Time Complexity: O(nlogn), nlogn time is required to sort the array

Space Complexity: O(1)

Approach 2 — HashMap: We can store the frequency of numbers in an HashMap . In another iteration, we will go through 1 to n , and check its occurrence, if a number’s occurrence is 2 then that number is repeating and if it is not present in the hashmap then that is the missing number.
{% gist https://gist.github.com/sksaikia/f0ba04950080eb1ddfde4321ce99fb36.js %}
Time Complexity: O(n)

Space Complexity: O(n)




The code can be found here
{% github sksaikia/Leetcode %}
Cara Beralih Versi Python Di Ubuntu
Tags: python, ubuntu, linux, programming
Published: 2021-03-03 07:10:29

## Cara beralih alternatif versi Python langkah demi langkah

* Langkah pertama adalah memeriksa versi python apa yang tersedia di sistem Ubuntu Anda. Untuk melakukannya, jalankan perintah berikut:

```
 $ ls /usr/bin/python*

/usr/bin/python2  /usr/bin/python2.7  /usr/bin/python3  /usr/bin/python3.7  /usr/bin/python3.7m  /usr/bin/python3.8  /usr/bin/python3-futurize  /usr/bin/python3m  /usr/bin/python3-pasteurize
```

* Selanjutnya, periksa apakah Anda sudah memiliki beberapa alternatif python yang dikonfigurasi. Untuk melakukannya, jalankan:

```
$ sudo update-alternatives --list python

update-alternatives: error: no alternatives for python
    Saat ini sistem tidak memiliki alternatif python yang dikonfigurasi.
```

* Pada langkah ini kita akan mengatur dua alternatif Python, yaitu alternatif Python2 dan Python3. Jalankan perintah berikut:

```
$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 1

$ sudo update-alternatives --install /usr/bin/python python  /usr/bin/python3 2
```

Konfirmasikan bahwa kedua alternatif siap digunakan:

```
$ sudo update-alternatives --list python

/usr/bin/python2
/usr/bin/python3
```

* Ubah ke versi alternatif python. Misalnya untuk mengubah ke Python 2 jalankan perintah berikut:

```
$ sudo update-alternatives --config python

There are 2 choices for the alternative python (providing /usr/bin/python).

  Selection    Path              Priority   Status
------------------------------------------------------------
* 0            /usr/bin/python3   2         auto mode
  1            /usr/bin/python2   1         manual mode
  2            /usr/bin/python3   2         manual mode

Press  to keep the current choice[*], or type selection number: 1
```

Masukkan nomor pilihan. Dalam hal ini untuk beralih ke Python versi 2 kami memasukkan 1 nomor pilihan.

* Periksa versi python Anda:

```
$ python -V

Python 2.7.17
```

> NB: Untuk beralih ke alternatif Python 3, ulangi Langkah 5 dan masukkan nomor pilihan yang sesuai dengan versi python yang Anda inginkan.
Typescript - Tips & Tricks - Optional modifier
Tags: typescript, webdev
Published: 2021-03-03 07:03:28

Hi guys and welcome back,
Today I'll talk about the optional modifier.
Sometimes we have objects that have some optional properties.
In these cases, we need to identify the optional and the required properties, so the consumers can know what is required and what not.
To do this in typescript we have a special modifier named "optional" and it is identified by a question mark (_?_).
Let's see an example:
```ts
export type Person = {
  name: string;
  surname: string;
  email: string;
  phone?: string;
};

const person1: Person = {
  name: "name1",
  surname: "surname1",
  email: "email1@email1.it",
};

const person2: Person = {
  name: "name2",
  surname: "surname2",
  email: "email2@email2.it",
  phone: "123",
};
```
In this example we can see the optional modifier in action, the "phone" property is marked as optional so in the "person1" object we can avoid setting the "phone" property.
This modifier, also, could be used in the functions' parameters if we have one or more optional parameters.
A simple example.
```ts
function printPerson(name: string, email: string, phone?: string): void {
  console.log(`Name: ${name}`);
  console.log(`Email: ${email}`);
  if (phone) console.log(`Phone: ${phone}`);
}

printPerson("name1", "email1@email1.it");
/*
  Name: name1
  Email: email1@email1.it
*/
printPerson("name2", "email2@email1.it", "123");
/*
  Name: name2
  Email: email2@email1.it
  Phone: 123
*/
```
We can see how in the first example we can avoid setting the phone parameter because it's optional.

From the optional modifier, it's all.
See you soon guy!
How to download IPA file from AppStore
Tags: appstore, ipa
Published: 2021-03-03 07:00:01

I still remember the days downloading IPA files from AppStore is very easy through iTunes. But Apple has removed AppStore from iTunes in version 12.7.

These days, to download IAP files you have to use Apple Configurator 2. It has to do many steps to download an IPA from the App Store, And you can't do it on windows.

### The steps:
1. Install [Apple Configurator 2](https://apps.apple.com/us/app/apple-configurator-2/id1037126344?mt=12)

2. Login with the Apple account which used to install the application before
![Login](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7zmy7x9gfghcneyoa795.png)

3. Connect your device to MacBook.

4. Add the application that you want to download the IPA file.
![Add](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nd5i4zgjh8eu1h2kt0s0.png)

5. If it has been installed on your device, the message box will be displayed. Note, Don't select any button on that message box.
![Don't select any button on that message box.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gi5g4bvj3fc41ojiiflw.png)

6. Open folder `~/Library/Group Containers/K36BKF7T3D.group.com.apple.configurator/Library/Caches/Assets/TemporaryItems/MobileApps/` to find out your IPA file.


That's all. 

------

### P.S
In my case, my client raised an error when they updated the application through AppStore. Then they required me to give them the commercial IPA file to keep track.
calling a web API in event handle is not working,
Tags: angular
Published: 2021-03-03 06:38:24

I've tried to setup a service to call data and also tried to create a method to call data but still facing the same error 
I want to select a value from Lookup and on its value change I want to call a web API, I can log the event and edit values in my Form Model but cannot call a API, I'm getting a uncaught error at *this.http* and http declared in constructor as *private Http: HttpClient* in both caeses
UGC NET Result & Scorecard June 2020
Tags: ugcnetresult2020, ntaugcnetresult, ugcnetexamresult, ugcnetscorecard
Published: 2021-03-03 06:24:05

UGC NET Result 2020 (Out): Download Eligibility Certificate Now

Get your UGC NET result 2020 in easy steps at Anujjindal.in and also check the UGC NET Exam scorecard, rank list, and top colleges in India.

UGC NET eligibility certificate 2020 has been released by National Testing Agency (NTA). Candidates can download the NTA UGC NET eligibility certificate from the official website of the exam. The NTA UGC NET JRF award letter 2020 will be released soon.

UGC NET 2020 result was released by National Testing Agency on December 1. The result was released in the form of a scorecard on the official website of the exam. Candidates can check their result and download UGC NET scorecard by logging into their registered accounts using the application number and date of birth/password.

https://www.anujjindal.in/ugc-net-jrf-admit-card-eligibility-result/

UGC NET JRF Job Profile: Types Of Job Opportunities
No degree or no qualification can ever refrain you from going after what you want even if that means that goal isn’t aligned with what you’ve studied in the past.

I’ve seen people with engineering degrees and job experience of 20 years going after their passion for becoming an actor, so it is impossible for me to write all the job opportunities for you out there because trust me, you can be whoever you want.

So let’s just say I am going to list the few that are aligned with the UGC NET JRF:

1. Assistant Professor – The most obvious choice of maximum students after clearing the UGC NET exam is to fulfill their dream of becoming a college professor.

After clearing NET, you can be an assistant professor in any private or government university. The Payscale obviously depends on the university you work with.

2. Researcher – Now if you’re one of those who always liked being the boss of your own work, being a researcher is right up your ally.

Choose a topic that you’re absolutely passionate about and that has the scope of developing into a long-term project.

You never know if you attain enough credibility in your project, you can find huge organizations that believe in your research and would provide you with enough resources and techniques to brush your skills.

3. Public Sector Job (PSU) – Most of you are unaware of the fact that many UGC NET JRF holders can go for a Public Sector Job.

The UGC NET JRF scorecard serves as a gateway to many Public Sector Jobs.

Check: UGC NET Application form 2021 here

https://www.anujjindal.in/ugc-net-apply-online-syllabus-selection-criteria/
Flashlight Website
Tags: html, css, javascript, codepen
Published: 2021-03-03 06:22:13

In “How To Avoid a Climate Disaster”, Bill Gates writes about kids, who're doing their homework by candle- or flashlight, either because of unstable electricity — or no electricity at all.

Imagine if you had to browse the web in a similar way — pretty annoying.

To show you just **how** annoying that is, I've made a fun little "flashlight-only"-website here (click on the flash and move it around):

{% codepen https://codepen.io/stoumann/pen/wvoeVZx %}

We need to reduce carbon emissions *and* upgrade the living conditions for millions of people, so nobody have to study by candelight.

Quite a challenge.

---

## How I Did It

I looked into ways of “cutting a hole” using clipping or masking, but ended up with something much simpler: **a radial gradient**.

```css
body {
  background: radial-gradient(circle at var(--x) var(--y), rgba(255, 255, 224, 0.77) var(--w), rgba(0, 0, 0, 0.97) calc(var(--w) + 1%));
}
```

The `--w` is the width of the inner, semi-transparent ring, while the `--x` and `--y` are coordinates, set by JavaScript:

```js
function move(event) {
  document.body.style.setProperty('--x', parseInt((event.pageX / document.documentElement.offsetWidth) * 100, 10)+'%');
  document.body.style.setProperty('--y', parseInt((event.pageY / document.documentElement.offsetHeight) * 100, 10)+'%');
}
```

Thanks for reading!
String find C++
Tags: cpp
Published: 2021-03-03 06:21:05

Problem Link: https://codeforces.com/problemset/problem/96/A
We can solve this problem using the string find() function.

```CPP
#include<bits/stdc++.h>
using namespace std ;
int main()
{
    string s ;
    cin>>s;
    string s1 = "0000000";
    string s2 = "1111111";
    size_t found  = s.find(s1);
    size_t found1 = s.find(s2);
    if(found!=string::npos || found1!=string::npos){
        cout<<"YES"<<endl;
    }
    else {
        cout<<"NO"<<endl;
    }
    return 0;
}

```
here  "size_t" is the signed integer data type. "size_t" can store the maximum size of a theoretical object of any type.
reference: https://en.cppreference.com/w/c/types/size_t
Here we check substring isfound or not in the given string.
Then if the string found then print Yes.

string::npos is a constant representing a non-position. it returns my function find when pattern was not found.
Is there a way to set the visibility of the entire class?
Tags: csharp, dotnet, help
Published: 2021-03-03 05:22:03

By default, members of classes are `private`. So, to manually have everything be internal, I need to prefix everything in all other classes to `internal`.
I tried doing `internal class {/* */}` to see if that'd fix the issue, but it didn't.
So, is there any way I can set the default visibility of the entire class w/o having to manually do it? The closest thing I found were questions that basically just asked what the modifiers were.

<div alt="Thanks! Cheers!">
##<b><center><b><strong>Thanks!<br/>Cheers!</strong></b></center></b>
</div>
Recursion in C Programming
Tags: c, programming, tutorial, beginners
Published: 2021-03-03 05:04:06

In this tutorial, we will study  [what is recursion in c](https://usemynotes.com/what-is-recursion-in-c/)  programming, the structure of the recursion function, the advantages and disadvantages of recursion in c, the types of recursion, and the factorial of a number using recursion.

## Recursion in C Programming
Recursion is a process in which the function calls itself. Recursion is used to solve a problem by dividing it into small parts. Such functions which call themselves are called recursive functions.

## Structure of Recursive Function
```
return type myFunction(Parameters-list)
{
  statement 1;
  statement 2; 
  …
  statement N;
  myFunction(Arguments-list);
  …
  other statements;
}
```

## Advantages and Disadvantages of Recursion in c

### Advantages
- If we solve a problem through Recursion, then there is no need to call the function again and again. If we call the function 1 time, it keeps calling itself till the end result comes.
- The same problem is easily solved in recursion.

### Disadvantages
- Recursive programs are slower than normal programs.
- Requires consuming extra memory.

## Types of Recursion in C
### Direct Recursion
Direct recursion is a recursion in which a function calls itself.

```
return_type MyFunction(parameter-list)
{
  statements;
  MyFunction(argument-list);
  other statements;
}
```

### Indirect Recursion
In this, one function calls another function which in return calls it itself.

**First Function**
```
return_type FunctionOne(parameter-list)
{
statements;
FunctionTwo(argument-list);
other statements;
}
```
**Second Function**
```
return_type FunctionTwo(parameter-list)
{
statements;
FunctionOne(argument-list);
other statements;
}
```
## Factorial of a Number Using Recursion
```
#include <stdio.h>
#include <conio.h>
long int fact(int n);
int main()
{
  int n;
  printf("Enter a positive integer: ");
  scanf("%d", &n);
  printf("Factorial of %d = %ld", n, fact(n));
  return 0;
}
long int fact(int n)
{
  if (n >= 1)
  return n*fact(n-1);
  else
  return 1;
}
```
**Output**

```
Enter a positive integer: 4
Factorial of 4 = 24
```
Originally posted on [alimammiya.hashnode.dev](https://alimammiya.hashnode.dev/recursion-in-c-programming)
I came, I saw, I coded!
Published: 2021-03-03 04:40:27


## My most recent achievement was…
... accepting my intern offer for the upcoming Summer! Applying for internships and programs is always stressful and always consumes up my time. If felt good to accept my offer and be done with applying for the rest of the year, and just relax until the summer. I will be a Engineering Intern this Summer at Twitter!

## Advocating for myself looks like…
... me putting myself first. Sometimes I have often felt like I am obligated to do certain things, complete certain projects, be apart of this certain organization, put out this certain image, but in 2021 I am committing to putting myself first and not doing things I feel obligated to do, but rather things *I* want to do. When I put myself first and work on things I actually want to do, the projects I work on have better outcomes and end up motivating me more to be a better programmer. 

## My biggest goal is…
... to be independent and self sufficient. I think that comes with age, but since working remotely in COVID, it makes me anxious to get back out into the world, and living on my own and doing my own thing. 

## My advice for allies to support underrepresented folks who code is...
... be transparent! If you are unsure how to be a good ally, ask how you can support your underrepresented peers and their coding journeys. Being clear and open about things like this will make you a better ally, and you may learn a new way of how to support that you might've not thought of.

Thank you for reading! If you want to chat, connect with me on  [Twitter!](https://twitter.com/therachelplan)
Style console.log() output with CSS - Part 2
Tags: javascript, webdev, codenewbie, beginners
Published: 2021-03-03 04:31:54

This video is part 2 of [How to style `console.log()` output with CSS](https://dev.to/palashmon/style-console-log-output-with-css-55n6). In this video, I am going to explain about how can we create a generic logic so that we can easily style console log output and do it a bit faster. 

### Issue Faced

So, right now in order to apply a css styling to multiple `console.log()` output, we would do something like this:

```js
console.log("%cSome text here 1", "color:green" );
console.log("%cSome text here 2", "color:red" );
console.log("%cSome text here 3", "color:blue" );

console.log("%cSome text here 4", "color:green" );
console.log("%cSome text here 5", "color:red" );
console.log("%cSome text here 6", "color:blue" );
```

You can see in the above examples, only the console log text is changing and the style is being repeated multiple times. I think we can create a generic logic and just call few functions and pass the text as a parameter to those functions and that would handle the styling for us.

### Solution

So first, we will create a main `logColor` function:

```js
function logColor(color, args) {
  console.log("%c" + args.join(" "), "color:" + color);
}
```

Then we will create a generic `log` object:

```js
const log = {
  green: (...args) => logColor("green", args),
  red: (...args) => logColor("red", args),
  blue: (...args) => logColor("blue", args),
};
```

and then we can call it like:

```js
log.green("Some text here 1");
log.red("Some text here 2");
log.blue("Some text here 3");
```

As you can see, we can now use these methods anywhere in your project without typing `%c` (CSS format specifier) and color name part every time. Yay!

Please check out this video where the solution for this issue is explained in full details:

{% youtube uFCjqHzfECc %}

<center>[How to style console.log() output with CSS - Part 2](https://youtu.be/uFCjqHzfECc)</center>

<hr/>

### Wrap Up

I hope you will find this video useful and learn something new in the process. If you want to learn more HTML, CSS, JavaScript and web development tips & tricks, please make sure to [subscribe on YouTube](https://www.youtube.com/channel/UCnnhIfN-A4JPs2ogiN59MRA?sub_confirmation=1).

Happy Coding!
GitHub Profile README Generator
Tags: python, opensource, github, markdown
Published: 2021-03-03 04:28:58

<h2> A few inputs + ~15 mins = Your Github Profile reaches a new level 🔥 </h2>
<p>
Github has a 'secret' repo feature that can be used to create a cool README for your Profile. If you are like me, you probably already knew about it but were too lazy to actually write Markdown and create a README. 
</p>
<p>
I used Python and Streamlit to build a web app that takes a few inputs from the users (you) and generates a cool README. The app also contains an editor in case you want to make adjustments to your README.
</p>

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/290b701xspl7in6tn29o.gif)
Below is an example README Generated <br>
https://github.com/rahulbanerjee26/rahulbanerjee26

## Features
- Gifs
- Social Icons
- Skill Icons
- Visitors Badge
- Github Stats
- Ability to change the theme of GitHub Stats Card
- WakaTime Stats
- .yml file to display Blog Posts from your feed
- Ability to add image banners at beginning of README. Just Paste the URL and the dimensions and you are good to go :)
- Editor to edit Markdown with live update
- Random Jokes Card

## Plans for Future Release
- Add ability for users to select between various README Designs
- Add more badges
- Add a Resources Section
- Improved Existing README design
- Add more Cards 
- Add  a page to showcase various READMEs built using this application



## How to Contribute
### Contributing Guidelines
- Fork the Project
- Create your Feature Branch git checkout -b feature/AmazingFeature
- Commit your Changes git commit -m 'Add some AmazingFeature'
- Push to the Branch git push origin feature/AmazingFeature
- Open a Pull Request
- After your PR is merged, I will add you as a contributor :)
I- f you wish to add yourself to 'Users who used this app' list, simply fork the repo, update the README and make a PR.
- Follow the below format <br> ``` <a href = 'Your Github URL'> Your Name </a>```
Or just reach out to me on Twitter/LinkedIn and I'll add you :)

### As a User
- There is a section in the README where you can list down your name. Others who view the repo will see your name and this might help you gain more exposure
- To submit, simply go to the section 'Users who used this app to generate a README'
- Add your name at the end in the following format <br>
```- <a href = 'Your Github URL'> Your Name </a> ```

### As a Contributor
1. Submit README Design Suggestions by creating an issue and either uploading the README file or posting the URL to the README

2. Build one of the above features

3. Fix Bugs

4. Suggest Features by creating an issue

## Current Known Issues
- The web app doesn't support pagination, i.e The data is not saved when you move from one page to another. 

## Technology Used
- Python
- Streamlit
- HTML/CSS
- Markdown

## How to Support
A simple star to my repo would mean a lot :D

--- 
Thank You for taking the time to read my article, I hope you find the web app I built useful :)
Java vs Python a Simple Comparison Part-1
Tags: java, python, computerscience, android
Published: 2021-03-03 04:26:08

#INTRODUCTION 
Java and Python are the most famous programming languages in the world. Python is famous for its easy syntax as well as libraries while
Java is famous for its object oriented syntax as well as multi-platform usage. So today I am going to write about a comparison between Java and Python.

##Note: THESE ARE MY OPINION ONLY


#About Java
Java is a class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible. It was originally developed by James Gosling at Sun Microsystems and the name was Oak and was first released in 1991.
Later it was renamed to Java and released in 1995.

#About Python
Python is an interpreted, and general-purpose programming language. Python's design philosophy emphasizes code readability with its notable use of significant indentation.
It was developed by Guido van Rossum and first appeared in 1991.

#*To Be Continued....................................*