teleren/devto huggingface dataset:
Automating code review on commit
Published: 2022-07-09 11:49:20

# HOW TO AUTOMATE CODE REVIEWS ON COMMITS

Imagine the hustle of spending hours on code review every day. Code review automation may save countless wasted efforts.

This Article may walk you through steps on how to add automated code reviews that may be executed during every code commit.

Codacy is one of the tools that may be used to achieve this.

Codacy is an automated code review tool that helps developers ship better software, faster. With Codacy, you get static analysis, cyclomatic complexity, duplication, and code unit test coverage changes in every commit and pull request. 

## Steps to integrate your project with Codacy

## 1. Sign up

You may use your Git provider such as GitHub, GitLab, or Bitbucket to sign up to Codacy. This links your Codacy user with your Git provider user, making it easier to add repositories to Codacy and invite your teammates.

![sign up](http://res.cloudinary.com/clickpesa/image/upload/v1650444797/engineering-blog/images/f47nkua8llyolvnmeqdu.png)


## 2. Grant access

Codacy will request access to your Git provider and will require you to provide a few details regarding your organization. (this helps them on use case evaluation).


![grant access](http://res.cloudinary.com/clickpesa/image/upload/v1650444920/engineering-blog/images/vtxfeitocdow3fw4uqqa.png)

## 3.  Choose organization

Now you will be required to join the organizations that contain your repositories

`	`Note:	

codacy name the organizations similar to your git repository user name. 

Example If your repository is “github.com/Fruitsandvegies”. Then the name of your organization will be “Fruitsandvegies”.

![choose organization](http://res.cloudinary.com/clickpesa/image/upload/v1650444969/engineering-blog/images/zc6idpiadlinetgvui8i.png)

## 4. Adding repository

By selecting the organization on step 3, codency will list all related repositories available. Select the “add” option to add the repository for review. Codancy will immediately set up everything so as to be ready to analyze on the next commit.

Note:

You can add the repository to Codancy only if you have permission to that repository.

![adding repository](http://res.cloudinary.com/clickpesa/image/upload/v1650445009/engineering-blog/images/eiwpirbmddgpnq1mwt8d.png)


## 5.  Review result of the analysis

`	`Select “Go to repository” once the analysis has completed reviewing the results.


Detailed analysis result

![review result of the analysis](http://res.cloudinary.com/clickpesa/image/upload/v1650445048/engineering-blog/images/yxdypvp8vbvhpsyav2kx.png)



The initial analysis from Codancy will be based on the default configuration. Codacy provides tweaks to allow you to set up a custom configuration such as files to ignore, code pattern, and adjust quality settings.
Python coding interview questions for data scientist
Tags: python, datascience, programming, tutorial
Published: 2022-07-09 11:39:31

1) How do you debug a Python program?

By using this command we can debug a python program

Example- Copy this code to your compiler

$ python -m pdb python-script.py
2) What is <Yield> Keyword in Python?

The <yield> keyword in Python can turn any function into a generator. Yields work like a standard return keyword.

But it’ll always return a generator object. Also, a function can have multiple calls to the <yield> keyword

Example- Copy this code to your compiler

def testgen(index):
weekdays = ['sun','mon','tue','wed','thu','fri','sat']
yield weekdays[index]
yield weekdays[index+1]
day = testgen(0)
print next(day), next(day)
Output: sun mon
Read Article-How to find Count pairs with given sum using python

3) How to convert a list into a string?

 When we want to convert a list into a string, we can use the <”.join()> method which joins all the elements into one and returns as a string.

Example- Copy this code to your compiler

weekdays = ['sun','mon','tue','wed','thu','fri','sat']
listAsString = ' '.join(weekdays)
print(listAsString)P

4) How to convert a list into a tuple?

By using Python <tuple()> function we can convert a list into a tuple. But we can’t change the list after turning it into a tuple, because it becomes immutable.

Example- Copy this code to your compiler

weekdays = ['sun','mon','tue','wed','thu','fri','sat']
listAsTuple = tuple(weekdays)
print(listAsTuple)
Read Article-How to Find duplicate elements of an array in python

5) How to convert a list into a set?

User can convert list into set by using <set()> function.

Example- Copy this code to your compiler

weekdays = ['sun','mon','tue','wed','thu','fri','sat','sun','tue']
listAsSet = set(weekdays)
print(listAsSet)
6) How to count the occurrences of a particular element in the list?

In the Python list, we can count the occurrences of an individual element by using a <count()> function.

Example- Copy this code to your compiler

weekdays = ['sun','mon','tue','wed','thu','fri','sun','mon','mon']
print(weekdays.count('mon'))
7) What is the NumPy array?

NumPy arrays are more flexible than lists in Python. By using NumPy arrays reading and writing items is faster and more efficient.

8) How can you create an Empty NumPy Array In Python?

We can create an Empty NumPy Array in two ways in Python,

1) import numpy
numpy.array([])

2) numpy.empty(shape=(0,0))

9) What is a negative index in Python?

Python has a special feature like a negative index in Arrays and Lists. A positive index reads the elements from the starting of an array or list but in the negative index, Python reads elements from the end of an array or list.

10) What is the output of the below code?

Example- Copy this code to your compiler

>> import array
>>> a = [1, 2, 3]
>>> print a[-3]
>>> print a[-2]
>>> print a[-1]
The output is: 3, 2, 1
React won't load images...
Tags: react, javascript, images, beginners
Published: 2022-07-09 11:36:45

Hi guys, new here.

React won't load my images.  I have tried countless resources and stack overflow.  What is going on?
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/syz81l780bl85bpgmxp1.png)

Hope this image helps.  

I was getting an error from Nam saying that ESlint.  That my 'images' like 'GitHub' is an unused Var which you can see it is being used in my code
Setup ruby/debug with VSCode
Tags: ruby, rails, debugger, vscode
Published: 2022-07-09 11:32:10

Do you know Ruby's official debugger [`ruby/debug`](https://github.com/ruby/debug) provides out-of-box integration with VSCode? If you haven't tried it yet or having difficulty making it work, I hope this short post will help you set it up.



### Basic Setup

1. Install the [VSCode rdbg extension](https://marketplace.visualstudio.com/items?itemName=KoichiSasada.vscode-rdbg) in VSCode
2. Create the `launch.json` file
   1. Click `Run and Debug` button on the left side
   2. Click `create a launch.json file` - this is quite small and under `To customize Run and Debug`
   3. Save the created `launch.json`
3. Put `gem "debug", require: false` in your `Gemfile` and run `bundle install`

### Debug Simple Ruby Script

If you want to debug a simple Ruby script, you can follow [these steps](https://github.com/ruby/debug#using-vscode).

### Debug Rails/Web Applications

If you want to debug a Rails/web application, do these instead:

1. Open the files in VSCode and add some breakpoints.
2. Start your program with the `rdbg` executable - `bundle exec rdbg --open -n -c -- bundle exec rails s`
    - `--open` or `-O` means starting the debugger in server mode
    - `-n`  means don't stop at the beginning of the program, which is usually somewhere at rubygems, not helpful
    - `-c`  means you'll be running a Ruby-based command
3. Go back to VSCode's `Run and Debug` panel, you should see a grean play button
4. Click the dropdown besides the button and select `Attach with rdbg`
5. Click the play button
6. It should now connect the VSCode to the debugger
  - If it stops at somewhere in your web server (like [puma](https://github.com/puma/puma)). Hit `continue` or `F5`. This will be resolved in the next `1.6.0` release.
7. Send some requests and it should stop at your breakpoints

**Video**

![Connect the debugger with your Rails server](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v0elr5otucfojq1vdoyz.gif)

I also have built this [`repl.it`](https://replit.com/@st0012/rubydebug-demo?v=1) to let you try out [`ruby/debug`](https://github.com/ruby/debug)'s console commands in your browser (it'll only take you 5 minutes).

If you want to see more articles/tips about the powerful features [`ruby/debug`](https://github.com/ruby/debug) has, you can follow me on [Twitter](https://twitter.com/_st0012) 🙂
Finally joined this amazing dev community. dev.to
Published: 2022-07-09 11:07:00

Started my coding journey January 2022, I've heard the numerous advantages of joining a dev community but I've always felt I'm not ready yet, little did I know that they is no perfect time to be ready.
So I've decided to just do it.
Looking forward to meeting new people and making new friends here to help each other grow in our respective endeavors. cheers
Task::Date::Holidays bug fix release 0.12
Tags: perl, release, opensource
Published: 2022-07-09 10:39:51

---
title: Task::Date::Holidays bug fix release 0.12
published: true
description: A minor fix to adjust tests which had not been updated accordingly
tags: perl, release, opensource
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
---
With the [releases 1.31 of Date::Holidays and 0.11 of Task::Date::Holidays](https://dev.to/jonasbn/release-130-of-dateholidays-more-holiday-for-the-french-36o7) I apparently forgot to test properly, so an issue was not observed. I believe I have accidentally tested [Task::Date::Holidays](https://metacpan.org/pod/Task::Date::Holidays) 0.11 with [Date::Holidays](https://metacpan.org/pod/Date::Holidays) 1.30 not 1.31.

This resulted in a lot of reports on failing tests from CPAN testers.

![Test matrix for Task::Date::Holidays 0.11](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pdh7yc2gnu4tiy181ack.png)

Ref: [cpantesters.org](http://matrix.cpantesters.org/?dist=Task-Date-Holidays%200.11)

Since it is my holiday I was able to find the time to dig into  the _holidays_ and Yesterday I found the issue, adjusted the tests and shipped 0.12 and already today the results look much better.

![Test matrix for Task::Date::Holidays 0.11](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xxcaklzovw29debvjw9h.png)

Ref: [cpantesters.org](http://matrix.cpantesters.org/?dist=Task-Date-Holidays%200.12)

One more item on the TODO list ticked off...
Why seeing yourself in future after time travelling is impossible ?
Tags: physics, timetravel, future
Published: 2022-07-09 10:33:56

**How beautiful it would be if you can see what you will be doing in the future ?**
Maybe you would take over SpaceX or would be the next big billionaire.

TV Shows show you so-
![No Desc](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cb19jpcs8r5fjur9fmij.jpg)
But here's the logical reality to it.
Maybe you are going in the future with a time machine and when you land there you saw the utopian future but its not having you. You are no where in the future except yourself.

You expectedto see yourself in a great position in the future but you cannot find yourself there in the future. What happened ?

Actually the thing is since you were time travelling you might have forgot that you were racing with time instead of building the future. You were going ahead of it. So when you reached there you didn't saw the future version of yourself. 

Simply you can understand it like this :-
1. You are time travelling in the same universe therefore you cannot expect to see your dopleganger in the future.

2. You were travelling faster than the speed of light and that's why you reached in the future you were travelling with time.

Merge the points one and two :-
You donot have a dopleganger to replace you in the world when you are time travelling so who will you see when you go there , you weren't there to build your future , therefore you will only be able to see one version of yourself in the future and that's you.
Deploy/Host your website for free
Tags: beginners, webdev, javascript, html
Published: 2022-07-09 10:10:55

Hey there, so you have a awesome website ready to be shared with the whole world or just looking to flex in front of friends/family🔥, but don't know how to do it. No worries I am here to help. Well there are many websites for it, but today we will be talking about [Github Pages](https://pages.github.com/). 

**Why GitHub Pages?**
TBH I have deployed my first [website](https://coditdoc.github.io/Palindrome-Checker/) using GitHub pages, so I will able to explain it better, and it's very easy and fast too⚡.

**Enough chitchat tell me how to deploy🙄**
Fair enough, let's get the website up in no time-

- Go to the repository (If you don't know how to create one [this will help](https://docs.github.com/en/get-started/quickstart/create-a-repo)).

- Click on settings 

![Repo Settings](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hah5d3trdh47lj5ri0r0.png)


- Pages 

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

- Under Source select the branch which you want to deploy.

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

- Select root folder if not preselected.

![Root folder](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sc5g3sxm05s4stq8l8yq.png)

- Click on save.


- Wait few seconds for it to complete the build process(You can check it in the action tab).

![Action Tab](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u8hmzmum8ci0z4poka2g.png)

- And Your awesome website is up on internet.

![Deployed website](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ajnjgwc72au6wpydhc0.png)



**Deployed website is just showing readme page**
 

1. Just change the xyz.html file name to index.html.

2. Problem not solved add index.md file and it will definitely fix the issue.

Note- Make sure to wait few more minutes for it to complete the build process then refresh the website.

**I Got some suggestions✨**
That's great I'm always looking to improve, please comment below your suggestion (s).

**You are Awesome where can I Connect with you😎?**
🚀[Github](https://github.com/Coditdoc)

🌱[Instagram](https://instagram.com/jay_g.7?igshid=YmMyMTA2M2Y=)

📨[Email] - loficode777@gmail.com

🐦[Twitter]- Soon


<a href="https://www.buymeacoffee.com/codeitdoc7" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-red.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
Help!! twitter Atymic intergration laravel 8
Published: 2022-07-09 09:57:29


I am tring to intergrate my laravel 8 project with twitter API but i seem to get an error, any one who can help please.

when i run i get this error

> A request error occurred. Client error: `GET https://api.twitter.com/2/tweets/search/recent?place.fields=country%2Cname&tweet.fields=author_id%2Cgeo&expansions=author_id%2Cin_reply_to_user_id&query=232323` resulted in a `401 Unauthorized` response: { "title": "Unauthorized", "type": "about:blank", "status": 401, "detail": "Unauthorized" }


And when i test it in postman it works ok.
Today's Fun Joke For Developers - Daily Developer Jokes
Tags: jokes, dailydeveloperjokes
Published: 2022-07-09 08:00:20

---
title: "Today's Fun Joke For Developers - Daily Developer Jokes"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
published: true
tags: #jokes, #dailydeveloperjokes
---

Hi there! Here's today's Daily Developer Joke. We hope you enjoy it; it's a good one.

![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e12591b4fccd.png)

---

For more jokes, and to submit your own joke to get featured, check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/). We're also open sourced, so feel free to view [our GitHub Profile](https://github.com/dailydeveloperjokes).

### Leave this post a ❤️ if you liked today's joke, and stay tuned for tomorrow's joke too!

_This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit._

<!--
Joke text:
___Q:___ Why don't parents teach their kids about regular expressions?

___A:___ Because they don't want them playing with matches
 -->
First Post - Intro
Tags: intro
Published: 2022-07-09 09:52:17

After being on here for about 28 months. It's time to start writing posts here.

I start with an intro

I am Tim #timoye
```
Tech Stacks: PHP/Laravel, Javascript/Vuejs, jQuery
Databases: MySQL, MSSQL, SQLite
Reporting: Metabase
Infrastructure: Azure, Heroku, Forge, Digital Ocean, AWS
Industry: Logistics, Procurement, Finance, HR, Health
```
...and growing
React Image Editor like Figma or Canva
Tags: opensource, webdev, react, showdev
Published: 2022-07-09 09:31:32

Hello!

I recently opened one of my projects. It’s a React image editor. It’s like Figma + Canva + React + Konva. 

![Live Demo Screenshot](https://github.com/swimmingkiim/react-image-editor/blob/main/screenshots/screenshot-1.png?raw=true)

Any contribution is welcomed!

### Project Link

Github: [https://github.com/swimmingkiim/react-image-editor](https://github.com/swimmingkiim/react-image-editor)

Live Demo: [https://swimmingkiim.github.io/react-image-editor/](https://swimmingkiim.github.io/react-image-editor/)

<a href="https://www.buymeacoffee.com/swimmingkiim" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/arial-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
This week’s newsletter is out! (09-07-2022) - Mindblowing Crypto
Tags: javascript, tech, webdev, discuss
Published: 2022-07-09 08:53:50

---
title: This week’s newsletter is out! (09-07-2022) - Mindblowing Crypto
published: true
description: Another week of great javascript, tech and web development links.
tags: javascript, tech, webdev, discuss
---

Mindblowing Crypto

https://markjgsmith.substack.com/p/mark-smiths-newsletter-09-07-2022

Would love to hear any comments and feedback you have.

[@markjgsmith](https://twitter.com/markjgsmith)
JavaScript Proxy a first introduction
Tags: javascript, webdev, beginners
Published: 2022-07-09 06:58:47

Recently I had my first production use-case for the Proxy object. So let me tell you a bit more about it and how you can use it in your code.

A Proxy object is a method that copies an object and can apply overwrites to specific functions.

This is a great way to intercept essential object functions like `get` or `set`.

## JavaScript Proxy object

Let's start with a basic object definition.

```js
const user = {
  firstName: 'Chris',
  lastName: 'Bongers',
  age: 10,
};
```

Now, let's proxy this object.

```js
const proxyUser = new Proxy(user, handler);
```

The Proxy object takes two arguments, the first one is the original object and the second one is a handler. The handler defines which operations will be intercepted or modified.

Let's say we want to modify the `get` function.

```js
const handler = {
  get(target, prop) {
    console.log('get called', target, prop);
    return target[prop].toUpperCase();
  },
};
```

In the above example, we log what is being called and modify the get always to return an uppercase variant.

Let's now try to get the first name of the person.

```js
console.log(proxyUser.firstName);
console.log(proxyUser.lastName);

// Returns: CHRIS BONGERS
```

Pretty neat!

Let's quickly take a closer look at the variables we received.
The target holds the entire object, and the prop has the one that is being changed.

You can also only act on specific properties.

```js
const handler = {
  get(target, prop) {
    if (prop === 'firstName') {
      return target[prop].toUpperCase();
    }
    return target[prop];
  },
};

console.log(proxyUser.firstName);
console.log(proxyUser.lastName);

// Returns: CHRIS Bongers
```

In this case, only the firstName property will be returned in uppercase.

## Type of handlers

We have seen the `get` handler being used, but there are more handlers we can leverage.

These handlers are often called traps, as they trap calls to the target object.

Here is a list of the traps we can overwrite.

- `apply`
- `construct`
- `deleteProperty`
- `defineProperty`
- `enumerate`
- `get`
- `getPrototypeOf`
- `getOwnPropertyDescriptor`
- `has`
- `isExtensible`
- `ownKeys`
- `preventExtensions`
- `set`
- `setPrototypeOf`

Each handler comes with its own set of properties. You can find the complete list on MDN.

[MDN trap list](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy#a_complete_traps_list_example)

You can also try out the sample I prepared in this CodePen.

{% codepen https://codepen.io/rebelchris/pen/vYRYaGq %}

## Conclusion

We can use the Proxy object to overwrite or catch specific object actions.

By using proxies, we can leverage some normally inaccessible handlers. These handlers can then be applied to all or some of the properties of an object.

### Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on [Facebook](https://www.facebook.com/DailyDevTipsBlog) or [Twitter](https://twitter.com/DailyDevTips1)
Login/logout link depends on user is logged in WordPress
Tags: wordpress, woocommerce
Published: 2022-07-09 06:47:22

It's common problem to create Login/Logout links in WordPress depended on user current state. We want to achieve this:

* Login/Register link - for not logged users
* Logout link - for logged users

Especially we want to have these links in WooCommerce where clients usually create accounts and log in or out. We want to have these links in the footer or inside of some widget. We can do this creating  [shortcode in WordPress](https://madlon.eu/blog/shortcode-in-wordpress/). Open `functions.php` file of your theme and paste there this code:

{% gist https://gist.github.com/texe/c82c465056ca6f05bbc4ed30c81e819a %}

The last thing we should do is put our shortcode in the right place. For instance edit the footer and paste `[md_login_logout]`. You don't have to edit source file in your theme! We created shortcode and simply paste it in Gutenberg or other editor you use in WordPress.
43 leetcode solution in CPP
Tags: leetcode, challenge, cpp
Published: 2022-07-09 03:12:43

```
class Solution {
 public:
  string multiply(string num1, string num2) {
    string s(num1.length() + num2.length(), '0');

    for (int i = num1.length() - 1; i >= 0; --i)
      for (int j = num2.length() - 1; j >= 0; --j) {
        const int mult = (num1[i] - '0') * (num2[j] - '0');
        const int sum = mult + (s[i + j + 1] - '0');
        s[i + j] += sum / 10;
        s[i + j + 1] = '0' + sum % 10;
      }

    const int i = s.find_first_not_of('0');
    return i == -1 ? "0" : s.substr(i);
  }
};

```
#leetcode
#challenge
here is the link for the problem:
https://leetcode.com/problems/multiply-strings/description/