teleren/devto huggingface dataset:
Add One To a Number
Tags: datastructure, interview, java, problem
Published: 2020-10-13 06:30:12

#**PROBLEM STATEMENT**
Given a non-negative number represented as an array of digits,
add 1 to the number ( increment the number represented by the digits ).
The digits are stored such that the most significant digit is at the head of the list.

#**INPUT**
If the vector has [1, 2, 3]
the returned vector should be [1, 2, 4]
as 123 + 1 = 124.

#**EXTRA NOTES**
>Q : Can the input have 0’s before the most significant digit. Or in other words, is 0 1 2 3 a valid input?
A : For the purpose of this question, YES

>Q : Can the output have 0’s before the most significant digit? Or in other words, is 0 1 2 4 a valid output?
A : For the purpose of this question, NO. Even if the input has zeroes before the most significant digit.

#**IDEA**
What happens when we add a number to the last if it is not a 9. Cool, we can simply add 1 and return the result directly. But the problem arises when we have 9 as last digit.
What happens when we add 1 to 9. Yes We will get a carry 1 and it has to be added with the next digit too.
Ok, that's the case when we have the last digit as 9. What if we have all the digits as 9.
EG: [9, 9, 9]
so when we add 1 to the last digit, it become 0 and we get carry 1.
When we add this carry to the other 9, it become 0 and we get carry 1.
Again we add this carry to the very first 9, it become and we get carry 1.

So the final result will [0, 0, 0] and a carry 1. So we have to add the number to the very beginning and thus we get [1, 0, 0 ,0]. This indicates that our size increases from 3 to 4. So this must also be kept in mind.

#**ALGORITHM**
1. Initialise a varible `reminder` to store the carry.
2. Precheck the edge case when we have so many 0's at the beginning and it is removed.
3.Traverse the list from the end, then:
   -> if the last digit = 9, remove it, add 0 and update the reminder = 1.
   -> if the last digit != 9, remove it, add number+1 and update reminder = 0 and exit from the loop.
4. If we have all 9,still our reminder will be 1.
5. Check if reminder = 1, if yes, add 1 to the very beginning.
6. Return the list.

```
public class Solution {
    public ArrayList<Integer> plusOne(ArrayList<Integer> A) {
        int reminder = 0;
        // to remove the very first 0
        while (A.size() > 1 && A.get(0) == 0)
            A.remove(0);
        for (int i=A.size()-1; i>=0; i--) {
            int number = A.get(i);
            if (number == 9) {
                A.remove(i);
                A.add(i, 0);
                reminder = 1;
            }
            else {
                A.remove(i);
                A.add(i, number+1);
                reminder = 0;
                break;
            }
        }
        if (reminder == 1) {
            A.add(0, 1);
        }
        return A;
    }
}

```
Time Complexity: O(lengthOfList)
Space Complexity: O(1)

Github Link: [Link](https://github.com/Rohithv07/LeetCodeTopInterviewQuestions/blob/master/InterviewBit/AddOneToNumber.java)
Enabling Python Virtualenv in Windows PowerShell
Published: 2020-10-13 06:23:20

Virtualenv is one of the most important tools in Python developers' toolkit. 
Now that Virtualenv supports PowerShell natively, you can run the script

`venv/Scripts/Activate.ps1` 

which is the equivalent of venv/bin/activate in Linux 

However, you might run into the following error when you try to run the script

`venv\Scripts\Activate.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies`

You may use Set-Execution Policy to allow the current user to execute scripts as follows
```
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
```
That's it! You should now be able to execute Activate.ps1 and get a fully isolated Python development environment for your projects.
Gmail Account Backup Tool for Windows OS
Tags: gmailbackuptool
Published: 2020-10-13 06:23:01


With the help of this third party tool Regain Gmail Backup Software you can easily take the backup of Gmail Account data files. This software has many advanced featuers like: Selective backup of Gmail data, filter option, Smart preview facility, Free demo version etc. This software maintain the integrity of all data files and also maintain the emails properties of all data like: to, cc, bcc, subject, date and time.

Get this software free demo version from here: https://www.regainsoftware.com/gmail-backup.html
Gmail Backup Software for safe and easy Gmail data Backup
Tags: gmailbackuptool
Published: 2020-10-13 06:22:22

Regain Gmail Backup Software can easily take the backup of Gmail data in just simple and easy process. This Software provides simple and easy steps and by following those steps you can easily take the backup of all Gmail Account data files. This Software easily take the backup from Gmail Account with all mailbox items like inbox; outbox sent-items, deleted-items, drafts, contacts, calendar, and note (to, cc, bcc, subject, date and time) accurately.

Checkout this software free trial version from here: https://www.regainsoftware.com/gmail-backup.html
🍪 Cookies in Flask 🍾
Tags: flask, webdev, python, beginners
Published: 2020-10-13 06:16:43

## What are cookies ?

Cookies are a kind of storage, but a very small storage. It is mainly used to store small information such as csrf_token, login credentials ( encrypeted ), preferences, site statics and/or user activities. By using cookies one can provide an immersive experice to the users of the websites by making the website more personalized for them.

## How to use "Cookies" in Flask ?

In flask using cookies is super simple. In flask cookies are Immutable Dictionary, we can also call as a dictionary. To view the value of the `request.cookies` attribute it will return an dictionary object. Let's see an understand it with an example,

app.py

```python
from flask import Flask, request, make_response, redirect, url_for, render_template

app = Flask(__name__)

@app.route("/")
def home():
	userName = request.cookies.get("name")
	if userName:
		return f"Hello {userName}." 
	else:
		return redirect(url_for("setName"))
```

**Continue reading here [🍪 Cookies in Flask 🍾](https://www.ketaniralepatil.com/python/flask/cookies-in-flask/)**.
QuickBooks Error Code 6000 Company File Issue
Tags: quickbookserror6000, quickbookscompanyfile, qbcompanyfileerror, opencompanyfile
Published: 2020-10-13 05:51:45

Error 6000 is a common issue in QuickBooks Accounting, that occurs when QB users are <a href="https://www.askforaccounting.com/quickbooks-error-6000/">trying to open a company file</a> or access a company file then you face an error, that's can restrict you from accessing our important data and file.

Here is a list of some 6000 series errors:

- Error 6000, 77 - While opening a company file
- Error 6000, 80 - Attempt to open Company File  >>  [QuickBooks unable to access the company file](https://www.askforaccounting.com/quickbooks-services/qb-company-file-repair/)
- Error 6000, 83 - Attempt to open file, restore, or back up of company files
- Error 6000, 301 - Trying to access the company file
- Error 6000, 305 - Incorrect network setup- Hosting is turned on .ND file name not working
- Error 6000, 107 - [.TLG file is damaged](https://www.askforaccounting.com/quickbooks-services/transaction-log-file-quickbooks/)
- Error 6000, 1076 - QB installation file is corrupted
- Error 6087, 0 - When you open a company file locally
- Error 6010, 100 - Hosting company file issue
- Error 6176, 0 - Firewall is blocking system connection
- Error 6073, 816 - One or more computers are hosting the file
- Error 6012, 1061 - Network setup not properly
- Error 
6129, 101 - QB Database server manager not working

## Causes of the QuickBooks Error 6000  Company File Issue:

- Firewall issue
- - Corrupted QuickBooks installation file
- - Maybe a virus or malware in the system 
- - User access issue on multiple systems 
- - Damaged QB company file 
- - Incorrect configurations
- - .TLG file might be damaged 
- - Incomplete installation of QuickBooks 

## Short Steps to Resolve Error Code 6000 QuickBooks

- First, Restore or backup of the QuickBooks files
- Remove viruses or malware in the system
- Repair the faulty installation of QuickBooks
- Remove corrupted/damaged QuickBooks files in the system
- Configure the Firewall settings
- Rename the .ND and .TLG files
- Restart QuickBooks Processes
Confused on Ionic update
Tags: react, ionic, angular, cordova
Published: 2020-10-13 05:51:42

I am currently working on Ionic 3 on several projects.
To keep up with the latest updates I need to upgrade to Ionic 5.

Now, the ionic 5 upgrade seems to re-work almost on all of my code. So I am confused about whether I should upgrade to Ionic 5 or should change the framework to React or Vue?

Another issue is most of the Cordova plugins I use are not currently supported(in other words, are not maintained anymore.)

Please share your thoughts.
How to show hidden files in FTP Client
Tags: ftp, winscp, filezilla, developer
Published: 2020-10-13 05:12:18

Some FTP software doesn’t show hidden files such as .htaccess files by default. In this blog, you will see how to unhide dotfiles in FTP client like WinSCP and Filezilla.

NOTE: Dotfiles are normally hidden for a reason. If someone editing it without any knowledge then it causes a break in the server. If you know properly then only can you use it.

#WinSCP Client:
Open WinSCP FTP Client.

1. From the menu bar at the top the screen select Options then 
   Preferences.
2. Select Panels from the left column.
3. Tick to Show hidden files.

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

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

4. In the panel on the right showing the remote site, you should now see all files including hidden ones.


#FileZilla Client:
Open the Filezilla FTP client.

1. From the menu bar at the top of the screen select Server.
2. Select Force showing hidden files.
3. In the Remote Site panel on the right, you should now see all of your files including any hidden ones.

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

Bingo !!! From now you know how to unhide files in FTP clients such as WinSCP & FileZilla.

You can also read it from here: 
[Codekumite](https://www.codekumite.com/2022/04/how-to-show-hidden-files-in-ftp-client.html)

Share with your mates and create a healthy network. 😉
MERN Stack Middleware: Check if an :id is a valid Object type
Tags: node, mongodb, middleware, mern
Published: 2020-10-13 05:05:11

*This middleware was made for MERN stack projects.*

When performing a GET request on a route that takes an :id to return a single object from a collect it is important to handle cases where the :id provided does not represent a valid object in our database.
```GET  http://localhost:5000/api/post/5f85294e21fcef22fd5b8f78```
Here is some middleware we can create to help us do that.

```
const mongoose = require('mongoose');

// middleware to check for a valid object id in the url
const checkObjectId = (idToCheck) => (req, res, next) => {
  if (!mongoose.Types.ObjectId.isValid(req.params[idToCheck]))
    return res.status(400).json({ msg: 'Invalid ID' });
  next();
};

module.exports = checkObjectId;
```

Now we can import checkObjectId and use it in any request that takes in an :id and return an object.

```
// IMPORTS
const express = require('express');
const router = express.Router();
// MIDDLEWARE
const checkObjectId = require('../../middleware/checkObjectId');
// MODELS
const Post = require('../../models/Post');

// @route    GET api/posts/:id
// @desc     Get post by ID
// @access   Public
router.get(
  // ROUTE
  '/:id',
  // MIDDLEWARE
  checkObjectId('id'),
  // CALLBACK
  async (req, res) => {
    try {
      const post = await Post.findById(req.params.id);
      
      if (!post) {
        return res.status(404).json({ msg: 'Post not found' })
      }

      res.json(post);
    } catch (err) {
      console.error(err.message);

      res.status(500).send('Server Error');
    }
  }
);
```
New Features of Angular 10
Tags: angular, javascript, typescript, webpack
Published: 2020-10-13 04:18:30

1. Addition Of Dependency Injection
2. Performance Improvement
3. Propagation Of Correct Value Span
4. Fix For Service Worker
5. Run The Project
6. Fixes
7. Addition Of EntryPointFinder
8. Generic With ModuleWithProviders
9. Introduction To TypeScript 3.9
10. Merging Of Multiple Transition File
Release 0.2.1, First PR for Hacktoberfest
Tags: opensource, hacktoberfest
Published: 2020-10-13 04:17:57

This post is for the first PR I sent for the Hacktoberfest, and also for the Release 0.2.1. I found a perfect one on Monday which was a Golang project and I checked the issue, I felt it should be okay for me to solve it. But I was wrong, I tried several hours and I cannot get it through. With the deadline coming in a few hours, I had to change to a much easier one to get started. 

I found a project asking help for updating their README to show correct directions for Mac, and how to set up the virtual environment, click [https://github.com/codethesaurus/codethesaur.us/issues/60](https://github.com/codethesaurus/codethesaur.us/issues/60) to check the details of the issue. And this one seems like a real project which does need some help, instead of just being created to help people finish Hacktoberfest tasks. I did some research and tried on my MacBook Air and helped with the update, and sent the [PR, https://github.com/codethesaurus/codethesaur.us/pull/63/commits/f9651d37c2186a4055873aa2ccd373c5df7add61](https://github.com/codethesaurus/codethesaur.us/pull/63/commits/f9651d37c2186a4055873aa2ccd373c5df7add61) to the owner. The owner was very kind and responded. It has not been checked and merged yet. If there is any update or more response, I will modifications based on their request. 

Sometimes I can be really picky, which would delay my progress in some way. David has empathized several times that the most important step is to get things started and done, instead of putting a lot of effort into trying to find a perfect issue. I should try to overcome this drawback and get my hands wet as soon as possible every time and every step.
Are programmers ignoring memory management while coding?
Tags: java, swift, kotlin, testing
Published: 2020-10-13 04:17:14

While analysing types of bugs reported by Finotes from live mobile apps, we noticed that close to 50% of the bugs are memory related. They manifest as crashes, UI sluggishness, screen loading delays and such, but root cause seems to be not managing memory well enough in code.

Adding object references in Lists, and not removing them after losing logical relevance is one common mistake programmers do. Easily avoidable if they are bit more careful while designing usage of Lists in their applications.

Coming from Unix - C era in software programming when memory management used to be one of the key metrics to measure quality of the code, I am thinking adding more weightage for such bugs while calculating quality score of apps in Finotes will help the developers understand the importance of keeping memory management in mind while writing code. As of now the quality score is a function of severity of the bugs alone.

Your thoughts?

[Finotes ([https://finotes.com](https://finotes.com)) is an SDK that detects bugs in live mobile apps. Finotes will start sharing the quality score of apps with developers soon.]
Memento Pattern
Tags: designpatterns, java, pattern, behavioral
Published: 2020-10-13 03:51:54

Without violating encapsulation, capture and externalize an object's internal state so that the object can be restored to this state later.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/sxqph3qon2cmbn9etl35.gif)

#Participants
* Memento: stores internal state of the Originator object. The memento may store as much or as little of the originator's internal state as necessary at its originator's discretion.
Protect against access by objects of other than the originator. Mementos have effectively two interfaces. Caretaker sees a narrow interface to the Memento -- it can only pass the memento to the other objects. Originator, in contrast, sees a wide interface, one that lets it access all the data necessary to restore itself to its previous state. Ideally, only the originator that produces the memento would be permitted to access the memento's internal state.
* Originator: creates a memento containing a snapshot of its current internal state.
Uses the memento to restore its internal state
* Caretaker: is responsible for the memento's safekeeping.
Never operates on or examines the contents of a memento.

#Code#
```java
public class Main {

	public static void main(String[] args) {
		Originator o = new Originator();
		o.setState("On");
		Caretaker c = new Caretaker();
		c.setMemento(o.createMemento());
		o.setState("Off");
		o.setMemento(c.getMemento());
	}
}

public class Originator {

	private String state;

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
		System.out.println("State = " + state);
	}

	public Memento createMemento() {
		return new Memento(state);
	}

	public void setMemento(Memento memento) {
		System.out.println("Restoring state...");
		setState(memento.getState());
	}
}

public class Memento {

	private String state;

	public Memento(String state) {
		this.state = state;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}
}

public class Caretaker {

	private Memento memento;

	public Memento getMemento() {
		return memento;
	}

	public void setMemento(Memento memento) {
		this.memento = memento;
	}
}
```

#Output#
```
State = On
State = Off
Restoring state...
State = On
```

{% github https://github.com/eidherjulian61/design-patterns no-readme %}
{% link https://dev.to/eidher/principales-patrones-de-diseno-13ao
 %}
How to create a great presentation
Tags: career
Published: 2020-10-13 04:16:35

Hello! Here are some tips about how you can create a great presentation🎤:

1. dont put too much text on each slide and add pictures to make it easier to understand and visually appealing🌅
2. think about who your audience is so you explain it on their knowledge level👨‍👩‍👧‍👦
3. talk freely and dont simply read from the slides
4. Make eye contact with your audience
5. practice with a timer before and present in front of someone else to get some feedback and practice⌚️
6. ask if the audience has questions
7. If you present software, make sure it works 😀
8. if you are nervous before the presentation, try conscious deep breathing to calm yourself down🧘‍♀️

What are your tips for a good presentation? Have a nice day. 🙂
Happy Ada Lovelace Day
Tags: adalovelace, computerscience, analyticalengine, happyadalovelaceday
Published: 2020-10-13 04:15:27

Hello peeps! How everyone? After getting a little freedom, finally, some states in Malaysia have to face CMCO again. We hope everyone stays at home and takes care of your health. Don’t be sad, at least for today, since today is ALD! What is ALD?

ALD stands for Ada Lovelace Day which celebrated every second Tuesday of October every year. Named after Ada Lovelace, the world’s first computer programmer, the day not only commemorates the lives of women in the field of science, technology, engineering, and math (STEM) but also encourages girls and young women to enter careers in these fields.

Continue read here https://malaysiandatascientist.wordpress.com/2020/10/13/happy-ada-lovelace-day/
Algorithms and Data Structures
Tags: computerscience, 100daysofcode
Published: 2020-10-13 04:09:33

## Why blog about algorithms and data structures?

I don’t know a whole lot about algorithms. In fact I don’t know a whole lot about data structures either. I have been doing some reading on the internet, trying to learn some more about these two foundational topics in computer science. Then I had an idea.

Although I have not been blogging for very long, I have found that blogging is an excellent way for me to solidify concepts in my mind. In order for me to be able to write about a subject, I first have to understand a subject. So, if I want to learn more about algorithms and data structures, then maybe I should start blogging about it!

So for the foreseeable future I am going to exclusively blog about algorithms and data structures. This post will provide a simple explanation on algorithms and data structures. Then my posts will focus on specific algorithms and data structures and I will do my best to explain them. Sounds like a good time to me!

## What is an algorithm?

An algorithm is a set of instructions that are followed, step by step, to achieve some sort of desired output. Technically recipes are algorithms, and DIY instructions you found on the internet are technically algorithms too.

In the world of computing, algorithms are able to provide computers with instructions that tell the computer what exactly it should do to complete a task.

## How do algorithms work?

The best way to think about algorithms is in terms of input and output. Most modern computers are capable of receiving lots of different possible inputs. For many of these potential inputs, the computer will have particular algorithms that it can use to transform the input into an output.

At a basic level, a search engine can be considered an algorithm. It takes a search query as an input and then searches a database for data that is relevant to the query. The results of the search are then outputted to the user.

## What is a data structure?

Data structures are what a computer uses to store and retrieve data. Data structures can be designed in different ways. These designs are constructed based on considerations like the data type and how the data will be accessed. There are four different forms of data structures:

Depending on the circumstances it may make sense for a computer to use one data structure over another. It all depends on the use case. Similarly the type of data structure that is being used will ultimately decide what algorithm is used.

Well there you go! If you didn’t know about algorithms and data structures then I hope that you do now. Future posts will go into much more detail, rest assured. Looking forward to sharing what I know about algorithms and data structures in the posts to come!
Webiny - Opensource platform for building serverless applications and APIs.
Tags: opensource, serverless, aws, webiny
Published: 2020-10-13 03:58:34

Webiny is an open-source framework for building serverless applications. It provides you with developer tools, libraries, ready-made apps and processes. It's built on top of AWS cloud and uses the latest technologies such as NodeJs, React and GraphQL.
Build Full-Stack Serverless Web Applications with Webiny

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/5jy4l18rdskislcviqym.png)

It's designed for building websites, apps and APIs that scale to millions of users and run on top of serverless infrastructure like AWS Lambda.

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

# Serverless makes infrastructure easy, Webiny makes serverless easy
<br>
BENEFITS :

1.Developer-friendly
Webiny has been made with the developer in mind. It helps them develop serverless applications with ease.

2.Open source
Webiny is created and maintained by an amazing group of people. Being open source means Webiny grows and evolves much faster. Contributors are welcome.

3.It's a community
We have an active community on slack. Talk to the core-team, and get help. Webiny team is always there for any questions.

Check their github : https://github.com/webiny/webiny-js