teleren/devto huggingface dataset:
The next() Function Explained
Tags: python, functions, beginners
Published: 2022-04-12 09:27:01

The `next()` function returns the next item of an iterator. It's used to iterate over an iterator in the required manner. 

It takes two arguments: 
- the iterator
- And the default value if the iterable has reached its end

Here's an example

```python
>>> new_fruits = iter(['lemon is a fruit.', 'orange is a fruit.', 'banana is a fruit.'])
>>> next(new_fruits)
'lemon is a fruit.'
>>> next(new_fruits)
'orange is a fruit.'
>>> next(new_fruits)
'banana is a fruit.'
>>> next(new_fruits)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
StopIteration
```

If the second value is not passed to the next function, it'll simply return a `StopIteration` error. 

Let's also see how we can write a `while` loop using `next()`.

```python
>>> fruits = iter(["lemon", "orange", "banana"])
>>> while True:
...     next_value = next(fruits, "end")
...     if next_value == "end":
...             break
...     else:
...             print(next_value)
... 
lemon
orange
banana
```

Why use `next()` over `for loop`? Well, the next() function definitely takes much more time compared to loops, however, if you want certainty about what's happening in each step, it's the right tool to use.

*Article posted using [bloggu.io](https://bloggu.io). Try it for free.*
How To Access Private Class Members in TypeScript
Tags: typescript, productivity, hack, testing
Published: 2022-04-12 09:05:23

I know we shouldn't access private class members. But sometimes, there is simply no way around. For instance, during unit tests we can access private members to assert the correct values. Or while debugging we want to log a private property to the console.

In TypeScript there are two ways to do this. The first option is to cast the object to `any`. The problem with this option is that you loose type safety and intellisense autocompletion. The second option is the [intentional escape hatch](https://github.com/microsoft/TypeScript/issues/19335). This is a bug (or feature?) in Typescript which was left open for this very purpose. It allows access to private members via bracket notation while maintaining type safety and autocompletion.

```ts
class Test {
    public foo: string = "Foo";
    private bar: string = "Bar";
    public constructor() { }
}

const test = new Test();

// cast as any
console.log((test as any).bar)

// intentional escape hatch
console.log(test['bar'])
```
Check it yourself at [TypeScript Playground](https://www.typescriptlang.org/play?#code/MYGwhgzhAEAqCmEAu0DeAoaXoAcCuARiAJbDQBmA9pQFzTIBOxAdgObQC80ARAGLXcA3OkzYcTAG5gk8aATAM6jFuy7cAQgqEjsuQiTLBKzRnmBJKDABQBKNKKwBfdM-RGTKGck7Rm8AO5wiEi2wm7GEJQg8AB0IJSsVl5IMVSUNiIA9Jm4ktKyALbwBQTwDNBgwMCIMMyUKGAg8f7wACbhJlGx8YnJMfIMGejZ0MCQDTBgzACe0AAWlQDWHZHRcQlWScEVkzM2-QpDIywyzEjExo3QiGM4sgtIwHMrXeu9wQDaAOQDXwC6NiAA).
iOS dev— import music from user’s device using document picker
Tags: ios, music, picker, programming
Published: 2022-04-12 09:05:22

How to import [music](https://blog.canopas.com/unit-testing-in-go-with-mysql-8db449d86722) from device using document picker?

Here's the guide to how can we import local music from your iPhone or iPad’s file app into your [iOS](https://blog.canopas.com/1-min-guide-to-ios-development-best-practices-in-2022-e3f1d009cfa1) application.

Many times, as a developer we come across requirements where we want to add some music from your local music library instead of getting it from [API](https://blog.canopas.com/automation-dynamic-sitemap-generation-with-golang-api-584f6c53ea9c).

Here's a step by step guide to learn [how to import music from user device using document picker](https://blog.canopas.com/ios-dev-import-music-from-users-device-using-document-picker-98e3e76d83c5).
Vacancy
Tags: solana, blockchain, rust, vacancy
Published: 2022-04-12 09:03:15

Skills & Requirements

Professional engineering experience with Rust
Knowledge and experience of Solana
Comprehensive understanding of the crypto/blockchain
Experience with EVM related development
Experience with Smart Contracts
Experience with backend technology is a plus
Keeping a vigilant eye on security considerations and developing with a security centric mindset.
12000USD 
Contact with me askarovakamilla96@gmail.com 
https://tlgg.ru/kamilla_tek_RedCode
Console live logging mishaps and pitfalls and how to avoid them
Tags: javascript, programming
Published: 2022-04-12 08:57:54

According to [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Console/log#logging_objects), there is one line in documenting `console.log` that sends a chill down your spine, and I could not find proper documentation for it.

> Otherwise, many browsers provide a live view that constantly updates as values change.

So I wrote a simple test to see how that may happen.
```js
var x = {name: "foo"};
console.log(x);

x.name = "bar";
console.log(x);

x = {name: "oops"};
console.log(x);
```

This will produce normal objects like this
![Console log output](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fgsznw2l5g9tu0wolnuw.png)
 
But expand the objects:
![Console log output](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i5xk2na2amkikk2l9p6o.png)
 
Notice how the first object name is no longer "foo", but rather "bar". The same happens when you are using `console.dir` and `console.log({x})`. The last log is because we reset the reference with a new object, which is not practical.

So to avoid that, you have two options. Either log out exact properties `x.name`, or as MDN suggests, clone the object before you log:
```js
var x = {name: "foo"};
console.log(JSON.parse(JSON.stringify(x)));

x.name = "bar";
console.log(x);
```
The output is

![Console log output](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2epe7aej413lb0di85ws.png)
Python Programming Language
Tags: python, programming
Published: 2022-04-12 08:50:48

As Python remains in high demand, a profession in Python can be the best path to accomplish your occupation goals.

[Python](https://insideaiml.com/blog/What-Is-The-Scope-Of-Python-In-Future%3F-1148) is created to construct a wide array of application domain names, including web-based applications, desktop computer applications, complex clinical and also numerical applications and even more.

Like many programming languages, Python works in tandem with an interpreter that carries out the settled lines of codes. There are lots of cost-free resources to discover the Python coding language, which, with its basis in English syntax, is taken into consideration among the least fussy and also most uncomplicated coding languages to find out as well as check out.
Some useful CSS Properties you Never used 😀
Tags: css, webdev, beginners, codenewbie
Published: 2022-04-12 08:50:26

CSS is not a complicated language, as long as you understand the basics, everything is alright 👍.

##Property Number 1: Box Shadow 👈

Who doesn't want a 3D website! Or a 3D button when hovered over? Well let me tell you this, you are one line of code away! 😁
![Box-Shadow](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ns1jkt0h09kmbz2hvoc1.png)

Well, here is the secret!
```
box-shadow: 1px 1px 1px 1px;
```
Now you get a box shadow with a 👇

- Height of 1px
- Width of 1px
- Blur of 1px
- Spread of 1px

Here is a syntax cheat sheet for you! 👇

```
box-shadow: h-offset v-offset blur spread color
```

H-offset is basically the height, and the v-offset is the width. For the blur, the higher the number, the more blur, and the spread is the distance the shadow goes before starting the blur.
Which to choose for my e-shop: SEO agency, freelancer or DIY
Tags: eshop
Published: 2022-04-12 08:32:59

SEO Optimization: Try it yourself, hire a freelancer or a digital SEO company? Which choice will bring us more benefits for our business? Every business owner who wants to be online and sell to customers 24/7 has been in a situation where they have to make their choice. How is it right to allocate a budget of BGN 10,000? To hire an SEO company, to test the services of an SEO specialist who is rumored in facebook groups or to try to optimize your site and make advertising campaigns on google and facebook, instagram?

In this article we will present the pros and cons that we consider important, and everyone can make an informed decision about their business. Read more [https://blog7.org/koe-e-za-predpochitane-seo-agencia-freelancer-ili-samostoyatelno/](https://rebrand.ly/d6n0m6u)
Get input element value as number
Tags: html, programming, webdev
Published: 2022-04-12 08:31:24

For the following input element:

```html
<input type="number" id="input">
```

 Instead of:
```js
document.getElementById('inpupt').value 
// '12'
```
You can do:
```js
document.getElementById('inpupt').valueAsNumber 
// 12
```
[You can read more here](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement)
Mongoss
Tags: mongodb, javascript, beginners
Published: 2022-04-12 08:22:04

**MongooseJs **:
Basically Mongoose is a package.It is a mediator between the MongoDB server and NodeJS application. It is an Object Document Mapper(ODM) that allows us to define objects with strongly-typed-schema. These objects are mapped to a MongoDB document. Mongoose also supports all the CRUD operations – Creating, Retrieving, Updating, and Deleting.
How to promote your business for free(3 easy tactics)
Tags: webdev, career, startup, wordpress
Published: 2022-04-12 07:57:54

So you got a business, and you want to promote it. Here are 3 tactics to quickly promote your business. I hope you like them!

##Tactic 1: Social Media

Register a Twitter account, or any other social media account. After that, you have another platform to generate a backlink or more views!

You've probably seen this method shown somewhere else, but this point is so important that I believe this article won't be complete without it.

#Tactic 2: Completing a survey

So basically, I made a survey, 1 lucky winner is going to get their business website promoted on mine. 

[https://s.surveyplanet.com/wf2sllmf](https://s.surveyplanet.com/wf2sllmf)

I know, this is a bit self promotional, I am really sorry about it. 

## Tactic 3: SEO

Search engines are the primary way your clients get to your website. The importance of SEO will stay.

To improve your SEO, add these few lines in between your head tags and modify the description.
```
<meta name="description" content="Basically a business planner." />
<meta name="author" content="Free Technology Help">
<meta name="keywords" content="Business Planner, Free, Online">
```

If you are using WordPress, you can install an SEO plugin.

## Conclusion

I am grateful of your time, and I really hope this helped you through your journey to start your start-up. 

Best Wishes! :)
Best SEO Automation Tools to rank higher on Google SERP
Tags: seotool, searchengineoptimization, seoautomation, seostrategy
Published: 2022-04-12 07:49:21


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

A lot of tasks involved in SEO (Search Engine Optimization) are hectic and time-consuming, most of the time. Therefore, doing such SEO chores manually could become a headache. If you ask any successful SEO strategist then they’ll say a great deal of time is drained from initial preparation to implementation. Time is money- period! You can’t afford to lose it. But if you use the right tool then you can do a lot better. We are talking about SEO automation tools. In this article, we are going to highlight some of the best automation software and how they can boost your efficiency.

**[SEO automation](https://store.outrightcrm.com/blog/best-seo-automation-tools/)** can be defined as the process of using tools to automate the SEO tasks that you generally carry out manually. The purposes of using automation tools are to save the most important assets of anyone i.e. time and resources. Also, it minimizes clerical errors since human interference is minimal.

When you are automating the manual recurring task, you will have more time to create effective strategies that can drive traffic to your website. In short, automation is the key to improved productivity and efficiency.

Task automation can be varied based on the expertise of marketers and SEO strategists. There are many tools available that can automate repetitive tasks, we’ll talk about such tools in the next section. You may require to do some initial configuration for starting automation.

Some preferred to automate tasks by writing Python scripts. This option is great if you need some personalized workflow, but for this, you will need to have expertise in Python or hire someone who can do it for you.

We understand that choosing the **[best SEO tool](https://store.outrightcrm.com/blog/seo-tool-for-lead-generation-what-steps-you-need-to-follow/)** is difficult since there are lots available in the market. Below we have mentioned some that we thought are suitable after using these tools ourselves.

**A1QA:** This tool is great for testing your website performance by creating various scenarios automatically. In this, you will get Functional testing, integration testing, multi-platform testing, etc. There are scenarios like a smoke screen, cross-platform testing, cross-browser testing, mobile testing, etc.

If you want to know more about SEO Automation tools then make sure to read our full-fledged article on the same. We have curated this blog after doing extensive market research.
Sort Weekdays in Python | Example "wed tues sat sun fri thurs mon"
Tags: python, programming, coding, webdev
Published: 2022-04-12 07:48:44

Hi Programmers,

In todays session we will try to solve a very unique and mostly asked question in interview round between the experience of 2 to 5 years range.

So the problem is there will be a string "wed tues sat sun fri thurs mon" like this and you have to sort it in the below manner.

**Input**: "wed tues sat sun fri thurs mon"

**Output**: "mon tues wed thurs fri sat sun"


So we will start our coding here:

```

m = ["Mon", "Tue", "Wed", "Thu", "Fri"]
n = ["Tue", "Wed", "Mon", "Thu", "Fri", "Tue", "Mon", "Fri"]
print(sorted(n, key=m.index))
['Mon', 'Mon', 'Tue', 'Tue', 'Wed', 'Thu', 'Fri', 'Fri']

```

**OR**

```
d = {name:val for val, name in enumerate(m)}
print(d)
{'Fri': 4, 'Thu': 3, 'Wed': 2, 'Mon': 0, 'Tue': 1}
print(sorted(n, key=d.get))
['Mon', 'Mon', 'Tue', 'Tue', 'Wed', 'Thu', 'Fri', 'Fri']
```

This could be the simplest solution for this type of problem.

[Buy me coffee](https://www.buymeacoffee.com/saim783)

[My other Blog Website over Technology](https://www.saimtechnews.in)

[My YouTube Vlog Channel](https://www.youtube.com/c/abdullavlogs)
How to Delete all Local Branches in Git?
Tags: gitversioncontrol, git
Published: 2022-04-18 12:12:35

---
title: How to Delete all Local Branches in Git?
published: true
date: 2022-04-12 07:44:26 UTC
tags: GitVersionControl, git
canonical_url: 
---

When working with a larger team and with a proper Git flow process, the number of local feature branches are grows in your local machine. Not that they do any harm to your project, but they can get quite confusing at times. This little code snippet will be able to delete all other local branches except master, develop or release/\*.

Create a file named, `deleteLocalGitBranches.sh` and add the following code snippet.

```
#!/bin/bash
# Move to master branch. Delete all other local branches except master, develop, release/* or project/*

# Move to master branch
git checkout master

# Collect branches
branches=()
eval "$(git for-each-ref --shell --format='branches+=(%(refname))' refs/heads/)"

for branch in "${branches[@]}"; do
  old="refs/heads/"
  branchName=${branch/$old/}
  if [["$branchName" != "master" && "$branchName" != "develop" && "$branchName" != "release/"*]]; then
    git branch -D $branchName
  fi
done

```

Now run the shell script

```
$ ./deleteLocalGitBranches.sh

```

The post [How to Delete all Local Branches in Git?](https://stacktips.com/tutorials/git/how-to-delete-all-local-branches-in-git) first appeared on [Stacktips](https://stacktips.com).
Array.flat() - for flatting nested arrays within an array
Tags: javascript
Published: 2022-04-12 07:29:11

In this third article of the Array method series, I'll explain the flat method and how it works.

Here's the video version: [Array.flat() YouTube](https://youtu.be/n3cV7VdrJ6I)

## What is the Flat Method?

The `flat` method of arrays is used to flatten nested arrays within an array. What are nested arrays?

```js
const array = [1, 2, [3, 4, [5, 6]]]
```

`[3, 4, [5, 6]]` is nested within the main array, and `[5,6]` is also nested in the previous array.

With the `flat` method, you can concatenate these nested arrays to the parent array.

The returned output of the `flat` method is a new array containing the concatenated items.

## Syntax of the Flat method

```js
array.flat(depth)
```

The `depth` argument specifies the nest level you want to concatenate. Using this example:

```js
[1, 2, [3, 4, [5, 6]]]
```

Depth 1 - `[3, 4, [5, 6]`
Depth 2 - `[5, 6]`
Depth 3 - There's no third depth

You can also pass a `depth` of `Infinity`, which goes deeper to unnest the deepest nested array 🔥 haha.

## Without the Flat method

Here's how to flatten an array without the Flat method:

```js
const array = [1, 2, [3, 4, [5, 6]]]
const flattenedArr = []

// for 2 levels
for (let i = 0; i < array.length; i++) {
  const item = array[i]

  if (!Array.isArray(item)) {
    // not an array
    flattenedArr.push(item)
  } else {
    // for the first level
    for (let j = 0; j < item.length; j++) {
      const item2 = item[j]

      if (!Array.isArray(item2)) {
        // not an array
        flattenedArr.push(item2)
      } else {
        // for the second level
        flattenedArr.push(...item2)
      }
    }
  }
}

console.log(flattenedArr)
// [ 1, 2, 3, 4, 5, 6 ]
```

Looping and looping, just to flatten an array. The `flat` method is definitely a lifesaver 😅

NB: This is not the only way to do it without the `flat` method. Check out more ways in [this StackOverflow discussion](https://stackoverflow.com/questions/62744911/flatten-an-array-without-using-flat)

## With the Flat method

```js
const array = [1, 2, [3, 4, [5, 6]]]
const flattenedArr = array.flat(2)
// or array.flat(Infinity)

console.log(flattenedArr)
// [ 1, 2, 3, 4, 5, 6 ]
```

## Browser Support

The `flat` method was introduced in [ES2019](https://262.ecma-international.org/10.0/) and currently, the browser support [gotten from MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat#browser_compatibility) is displayed here:

![Browser support for the Flat Method gotten from MDN](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8xatkrl53i18p2monxjl.png)

Pretty good.
CinnaChroma Reviews:(U.S Updated 2022) – Read True facts Only!
Tags: javascript, webdev, beginners, programming
Published: 2022-04-12 07:19:07

[CinnaChroma ](https://sites.google.com/view/cinnachroma-official/
)I was nearly penniless at the time. When push comes to shove, I partially concur with that wicked info. I might have to offer my apologies for the difficulty of it all. I rapidly realized this doing that had a couple of limits. That drives me batty.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zzuy51kivlyghk8fmfm2.jpg)
➤➤ Go To The Official Website ➤➤
https://ipsnews.net/business/2021/10/09/cinnachroma-review-is-this-sugar-control-formula-legit-complaints-and-side-effects-reported/ 
https://sites.google.com/view/cinnachroma-official/ 
https://linktr.ee/cinnachromaget 
https://cinnachromaingredients.tumblr.com/ 
https://bumppy.com/tm/read-blog/38769 
https://public.flourish.studio/story/1243422/ 
https://twitter.com/healthandfits01 
https://qr.ae/pvsNHp 
https://www.smore.com/6rw19 
https://www.pinterest.com/pin/996984436232144807/ 
https://www.facebook.com/Health-And-Fitness-105019168641509 
https://www.linkedin.com/events/cinnachroma6919506476675784704/ 
https://cinnachromaget.livejournal.com/285.html 
https://www.scoop.it/topic/cinnachroma-advanced-blood-sugar 
https://healthreviewstip.blogspot.com/2022/04/cinnachroma-reviewsus-updated-2022-read.html 
https://groups.google.com/g/cinnachroma-order/c/bBbp3LTIK8w 
https://the-dots.com/projects/cinnachroma-reviews-u-s-updated-2022-read-true-facts-only-707001 
https://lexcliq.com/cinnachroma-reviewsu-s-updated-2022-read-true-facts-only/ 
https://techplanet.today/post/cinnachroma-reviewsus-updated-2022-read-true-facts-only 
https://vimeo.com/698464722 
https://www.youtube.com/watch?v=27nNyMVomCE
WordPress vs HTML
Tags: html, javascript, wordpress, webdev
Published: 2022-04-12 07:09:21

WordPress is a great CMS to create a website, while using HTML, CSS and JavaScript can be another option. WordPress allows you slightly less flexibility compared to the other approach, but allows you to get started quicker.

##Quick Summary(For those of you in need of time)

I understand, not everyone has time to read every word I write, for those of you who are in a hurry, here is a quick summary.

WordPress is better at creating blogs, personal websites or simple business landing page. WordPress can get advanced, but I prefer using HTML for advanced projects.

The more technical approach is using HTML, CSS and JavaScript with backend tools like NodeJS. This approach is more for developers ready to invest a lot of their times building an advanced project.

##Speed

Now let's dive into the details! I personally host my blog on WordPress, and create tools with HTML, CSS and JavaScript. At the end of the day, we are comparing JavaScript(HTML) with PHP(WordPress). 

To be perfectly honest, JavaScript is slightly faster than PHP, but the way WordPress puts HTML into PHP does make up the difference. 

While some developers complain that PHP is slow, or hard, you actually don't need to touch the PHP code for your WordPress web app.

I host my blog and JavaScript library on the same hosting provider, SiteGround. You can visit both websites here, and compare the speed yourself.

[freetechnologyhelp.com](freetechnologyhelp.com)(Wordpress)
[cheaterjs.com](cheaterjs.com)(HTML)

##Ease of Use

Well, this is super straight forward, WordPress is way easier to get started to than HTML. But it's actually not that simple.

WordPress is made in PHP, and PHP is harder than HTML, CSS & JavaScript. So if you want to make a technical change to your WordPress website, you would need to know PHP.

##Conclusion

If this post sucks and I got nothing right, please comment below and I promise I'll respond. 

Oh, and by the way, I made this form(You can answer it if you have the time) to make sure everything on this article is accurate, please answer it if you have the time.:
[https://s.surveyplanet.com/wf2sllmf](https://s.surveyplanet.com/wf2sllmf)
Python for Data science and Machine Learning
Tags: python, programming, machinelearning, datascience
Published: 2022-04-12 06:57:18

_[The IoT Academy](https://www.theiotacademy.co)_ has come up with 3 months Online Certification Course on Applied Data Science and Machine Learning with Python by E&ICT academy IIT Roorkee. This course will make you to understand the statistics, Python programming and data analysis. Python is the most addicted language for Data Science and Machine Learning projects. In this course one will learn Python, Tableau, Bokeh, Matplotlib, Ipython, Jupyter, NumPy, Pandas, pYTorch, Scikit-Learn, Machine Learning in Python, NLTK, MySQL and more. This [**Python for Data science and Machine Learning**](https://www.theiotacademy.co/applied-data-science-with-python-certification-program) Course will teach you how to use python to analyse data and Machine Learning algorithms.