teleren/devto huggingface dataset:
Selenium Python Exception Handling
Tags: testing, python, webdev, tutorial
Published: 2021-02-21 13:46:49

In this post, we will take a look at how to do exception handling using Selenium Python and the SeleniumBase framework. So, before we see how we can do that let’s talk about why you need to handle exceptions in the first place, usually if there’s an error within your test you would want the test to fail and that is true for 95% of the scenarios.

But, you will run into certain scenarios where you will encounter an error and you would want to handle that differently instead of just throwing the error and failing your test.

For example –

- If you are trying to find an element and if that element is not there, you want to perform some other action instead
- Or, if you want to click a button but if that click doesn’t work you might want to perform some sort of retry functionality

---

### Handling Exception using SeleniumBase

In the code below, we will try to find a product and if the product cannot be found then we will assert for the “not found” text instead –

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

When the exception was thrown after the product was not found, we handled it using the try/except block. Similarly, you can handle such exceptions for any of your use cases and perform some other action instead.

---

#### **Check out the video below to learn more about handling exceptions using the SeleniumBase framework –**

{% youtube 3V1HNR9qJXM %}

---

📧 Subscribe to my [mailing list](https://automationbro.com/mailing-list) to get access to more content like this 

👍 Follow [automationbro](https://twitter.com/automationbro) on Twitter for the latest updates

...

This post was written with the help of a high amount of caffeine. And, if this post helped you out and you would like to support my work, you can do that by clicking on the button below and continue supporting my caffeine love :)

<a href="https://www.buymeacoffee.com/automationbro">![Buy me a coffee](https://dev-to-uploads.s3.amazonaws.com/i/4aw2ub3f4qkyjk0ivwt4.png)</a>

You can also support me by liking and sharing this content.

Thanks for reading!
Mahajanapadas in Hindi
Tags: mahajanpadas, indianhistory
Published: 2021-02-21 13:36:34

महाजनपदकालीन भारत एवं मगध साम्राज्य ( Mahajanapadas in Hindi)

 प्रारम्भ में लोग कबीले के रूप में निवास करते थे । जन समूह या कबीला जितने भू-भाग पर रहता था, वह भाग जनपद कहलाया । यह वैदिक काल की राजनैतिक इकाई थी ।

इन जनपदों की अपनी शासन और कानून व्यवस्था होती थी । इनमें से कुछ जनपद राजतंत्रात्मक थे व कुछ जनपद गणतंत्रात्मक थे ।

महाजनपद (Mahajanapadas )
करीब 2500 साल पहले , कुछ जनपद अधिक महत्वपूर्ण हो गए । ऐसे महत्वपूर्ण एवं बड़े जनपदों ने छोटे जनपदों को अपने राज्य में मिला लिया ।इस प्रकार महाजनपद बन गए। प्रत्येक महाजनपद की अपनी-अपनी राजधानियां होती थी । कई राजधानियों में किलेबंदी भी की गई थी ।

महाजनपद के शासक नियमित सेना रखने लगे थी । सिपाहियों को वेतन देकर पूरे साल रखा जाता था । कुछ भुगतान सम्भवत: आहत सिक्कों के रूप में होता था । इन महाजनपदों की संख्या 16 थी ।

16 महाजनपदों की सर्वप्रथम जानकारी बौद्ध ग्रंथ अंगुत्तर निकाय में मिलती है ।
<a href="https://www.gkkitab.com/mahajanapadas-in-hindi/">mahajanapad</a>
राजपूत राजवंशों की उत्पत्ति-गुर्जर प्रतिहार वंश

Tags: indiagk, rajasthangk
Published: 2021-02-21 13:31:10

राजपूत राजवंशों की उत्पत्ति
राजपूत को आबू पर्वत पर वशिष्ठ के अग्निकुंड से उत्पन्न हुआ मानते हैं । यह सिद्धांत चंद्रबरदाई के पृथ्वीराज रासो पर आधारित है तथा प्रतिहार, चालुक्य, चौहान और परमार राजपूतों का जन्म इससे माना जाता है ।

🔸कर्नल टॉड के अनुसार राजपूत शक- कुषाण तथा हुण आदि विदेशी जातियों की संतान थे ।

🔸डॉ ईश्वरी प्रसाद तथा डीआर भंडारकर भी राजपूतों को विदेशी मानते हैं ।

🔸वी डी चट्टोपाध्याय के अनुसार राजपूत सामाजिक- आर्थिक प्रक्रिया की उपस्थित थे ।

🔸जी एच ओझा, सीवी वैद्य तथा अन्य कई इतिहासकार यही मानते हैं कि राजपूत प्राचीन क्षत्रियों की संतान हैं ।
<a href="https://www.gkkitab.com/gurjar-pratihar-vansh-history-in-hindi/">gurjar-pratihar</a>
JavaScript Interview Question #17: Sum of Two Empty Arrays
Tags: beginners, javascript, codenewbie, webdev
Published: 2021-02-21 13:28:23

![js-test-17](https://learn.coderslang.com/js-test-17.png)

Is the sum of two arrays equal to `false`?	

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

To analyze this code snippet we need to understand how type conversion works in JS.

When we try to sum two arrays using the `+` operator, the arrays are first converted to strings and then these strings are concatenated.

An empty array `[]` is evaluated as an empty string. The sum of two empty strings is still an empty string.

> Now, is an empty string equal to `false` or not?

The comparison here is done using the `==` operator. This operator is used to check `loose equality` and does implicit type conversion.

In this case, empty string and `false` are considered equal and the condition of the `if` statement will be evaluated to `true`.

If you want to use a strict comparison that respects the types of values you compare, you should use the strict equality operator `===`.

Here, you can find more information on [basic math operations is JavaScript](https://learn.coderslang.com/0002-basic-javascript-arithmetics/).

---

**ANSWER**: the string `same` will be logged to the console.

> [Learn Full Stack JavaScript](https://js.coderslang.com)
When to expand?
Tags: codenewbie, devjournal, beginners
Published: 2021-02-21 13:25:28

Happy Sunday!

How has your week been?

My week has been mixed, I've been hit with a tooth infection which has slowed my progress. Despite that I've contiued to expand my knowledge, picking up some CSS insights throughout the week.

I'm building a project (Garlic Bread Tracker) using html/css/js and have got to a point where I'd like to store some data. Not too complex, name, description and maybe one other datapoint. I haven't got any experience with data storage / databases. 

I'm not sure whether to start exploring it now, or to continue building my knowledge of JavaScript which is still quite basic.

What do you think?
WebRTC, getDisplayMedia() does not capture sound from the remote stream
Tags: webrtc
Published: 2021-02-21 13:17:16

Hi,everyone!


I have a web application, which is based on the peersjs library (It is a video conference).

I'm trying to make a recording with 'MediaRecorder', but I'm facing a very unpleasant case.

The code for capturing my desktop stream is the following:
```
let chooseScreen = document.querySelector('.chooseScreenBtn')
chooseScreen.onclick = async () => {
    let desktopStream = await navigator.mediaDevices.getDisplayMedia({ video:true, audio: true });
}
```
I then successfully apply my received **desktopStream** to videoElement in DOM:
```
const videoElement = doc.querySelector('.videoElement')
  videoElement.srcObject = desktopStream 
  videoElement.muted = false;
  videoElement.onloadedmetadata = ()=>{videoElement.play();}
```
For example, I get **desktopStream** on the page with an active conference where everyone hears and sees each other.

To check the video and audio in **desktopStream** I play some video on the video player on the desktop. I can hear any audio from my desktop but audio from any participant cannot be heard. Of course, when I put the **desktopStream** in **MediaRecorder** I get a video file with no sound from anyone except my desktop.It happens when I get desktopStream on the same page with conference, When I take out this functionality to another page, it works fine. Any ideas on how to solve it?
Best Practices Working with Billion-row Tables in Databases
Tags: sql, database, architecture, webdev
Published: 2021-02-21 13:13:48

This whole post is about a [video](https://www.youtube.com/watch?v=wj7KEMEkMUE) from Hussein Nasser I saw from youtube. This is just the summarise version of the video along with my key takeaways from the video 

## Learning: 
The discussion is on
- How to handle data in billion row based table
- What kind of approach can be taken
- How to redesign the table to handle 2 billion rows based table

## Summary: 
Here the discussion is being started with how a twitter follower table has been designed. A simple approach, make a table with which person follows whom. A 2-3 columns based rows. But it will be a huge table in the long term in sense if we use this for twitter. So what can be done 
1. Do normal query without the concept of `indexing`. Just `brute forcing` the data without the concept of anything. Do multi threading, multi processing and find the data from the table using lots of machines (`map reduce`)
2. Use `indexing` on the table and find the data from the table using the indexed data.
3. Now you have billions of data so indexing is huge, to search that use database `partitioning` in the same disk. Use pair partitioning
4. Now to optimize more use `sharding` in the system(multiple host). But it adds more `complexity` in the system. The client needs to be aware of the shard info before querying, then needs to find the proper `partition` for the query, then make an actual query. Which makes another layer of logics along with business logics.
5. Another way is to `redesign` the system like in the profile table add 2 more rows to hold db columns like follower count, followers(in json). In that way a profile holds all information about followers of a profile. The problem might generate how to write/edit this data. But that is another kind of system design like querying, CQRS, event based solution. It solves current issues.
Why is important to know marketing as a developer
Tags: marketing, products, startup, ideas
Published: 2021-02-21 13:04:36

---
title: Why is important to know marketing as a developer
published: true
description: Why I, as a developer, decided to take a digital marketing degree. 
tags: marketing, products, startup, ideas
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/scjlmttav2pyd2kzv2dl.jpg
---
*Photo by Kaboompics .com from Pexels*

I have too many domains registered and too many unfinished side projects on my "ideas" folder.

Sometimes it is because I have no time, sometimes it is because I lose interest. But many times, I don't know how to test if the idea has a good market fit. Where I find users for my app, how I create interest? Is this project worth my time, or is it an idea that nobody wants?.

I have spoken with many developers, and almost all of them have this problem.

Market fit, idea validation, promotion, target customer, and sales are part of the marketing strategy. People tend to associate marketing with infomercials and the 5 seconds ads in front of a Youtube video. But the reality is that marketing is much more than that.

Marketing gives you the tools to understand who your customers are, where they are and how to talk to them. And that is key if you want the success of your product, service, side project, and even yourself.

And that is why that every developer should learn more about digital marketing. Maybe you have an amazing idea that it's sitting on your desktop or maybe you want a better job and more opportunities. 

I see marketing as an extra tool to achieve those goals. And for me as a developer, I see it as learning a new programming language or technology.

For that reason, I started the Digital Marketing Nanodegree on Udacity. I don't want to become a marketing guru or write articles on how to make your next million, but my goals are:

* How to validate ideas
* How to find potential customers
* How to communicate with those customers
* How to promote my products

I'm just starting, so far, I have learned how to create my ideal customer and to use social media effectively. And I have a lot of work to do, but like any new programming language that I learned. I'm experimenting with it and seeing what works and what doesn't works for me.

There are many resources on digital marketing out there. Many of them are free:

* [Hubspot Academy](https://academy.hubspot.com/)
* [Moz Learning](https://moz.com/learn/seo)

If you want to take it to the next level the [Udacity Digital Marketing Degree](https://www.udacity.com/course/digital-marketing-nanodegree--nd018) has everything that you want to know.

So what are you waiting for?
App Customer Service
Tags: ios, mobile, node, api
Published: 2021-02-21 13:03:05

## Get support anywhere!

### Find answers about your apps, talk to an expert, or make a repair reservation.

I would like to share a project that I have been working on with you.

There are hundreds of apps we use on our phones. We may want to make suggestions for errors we encounter in these applications or for improvement of the application.

We wanted to help everyone on this issue by opening this site, which makes it easier for us to find contact information of application developers.

The site is currently in BETA. What features do you think we should add to the project?

We are waiting for your suggestions.

[https://appcustomerservice.com](https://appcustomerservice.com)
Circuit Breaker Pattern in Nutshell
Tags: microservices, architecture, design, webdev
Published: 2021-02-21 13:00:12

Recently I was reading a blog on [Circuit Breaker](https://martinfowler.com/bliki/CircuitBreaker.html) by Martin Fowler. I decided to summarise the content based on the blog and my experiences on this topic.

## Learning and Summery: 
In distributed systems a system often needs to call remote service calls to get proper data. But it can generate critical resource outages, cascading failures across multiple systems if the remote services went down and lots of service calls are being queued up till timeout happens. These situations can be avoided easily by implementing **circuit breaker patterns**. 

**Circuit breaker pattern** is simply like this, if there is too much error(based on desired error threshold) simply terminate the call to remote service immediately after a remote call is being received. It will start making the calls after it restores the communication with the remote service. It should check the service health after certain period to check the service availability after enabling the circuit breaker.

## Basic Example: 
Let's say we implement a circuit breaker on a remote service call. Whenever a request needs to be executed it sends to a queue. Then a consumer reads the queue later and executes the service call one by one or multiple threads and response back. 

So in this situation we set rules like if 20 service calls in the last 60 seconds are being timed out or get network/gateway errors like(5xx errors, 422 etc) we will enable circuit breaker for 60 sec. 

Means for next 60 sec no service calls will be executed or the consumer will not consume any service request from the queue. 

In the background there will be a worker who will start checking the health status of the remote service in every 5 sec right after the circuit breaker is being enabled. Once it gets the healthy service response it will monitor till 20 more sec. After that it will reset the circuit breaker or increase the circuit breaker timeout for more 60 sec.

**Benefit:** Assume we had million service requests in the queue, and the consumer has 50 threads to process the queue. Without the circuit breaker it would try to execute all the requests even if the remote service died or made errors. Right after we got errors(till the threshold) for the service calls, we started holding the requests till the service came back online and had a smooth response. This makes a smooth transaction between distributed services and less error handling.

**Sample Package to Check:** I checked one of the python packages for [circuit breakers](http://fabfuel/circuitbreaker:%20Python%20%22Circuit%20Breaker%22%20implementation). Thought i did not use that personally, but seems it has some functionality out of the bat. Will definitely try later.
Style CSS properties on an element inside of a shadow tree
Tags: html, css, shadowdom, ionic
Published: 2021-02-21 12:47:33

<p>
After introducing Shadow DOM in IONIC most of us searching and finding a way to modify style of IONIC components. Fortunately they have exposed many css4 variables to modify the components but we can't access the html elements inside the Shadow DOM.
</p>

<h3>How to update style using exposed css4 variables?</h3>
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lqp3y1gigyra3yzu09ob.PNG)
<pre>
ion-button{
  --border-radius: 2px;
  --background: #3A2926;
  --color: #DBE0A5;
}
</pre>

<h3>How to update style of properties that are not exposed?</h3>
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lqp3y1gigyra3yzu09ob.PNG)

<p>
In the above screenshot we cannot modify the properties like cursor, z-index, box-sizing etc. from outside the Shadow DOM using normal CSS like following style.
</p>
<pre>
ion-button button{
  cursor: crosshair;
  z-index: 2;
  box-sizing: content-box;
}
</pre>

<h5>How to update above properties </h5>
<p>
We can use Shadow Part selector to update the these properties. 
</p>
<pre>
ion-button{
  &::part(native) {
    cursor: crosshair;
    z-index: 2;
    box-sizing: content-box;
  }
}
</pre>

<p>
I hope this will help many developers. 
</p>

<h2>Resources</h2>
<a title="Ionic Framework" href="https://ionicframework.com/docs">https://ionicframework.com/docs</a><a href="https://ionicframework.com/docs/theming/css-shadow-parts">
https://ionicframework.com/docs/theming/css-shadow-parts
</a>
Codes of Conduct
Tags: assorted
Published: 2022-07-30 11:24:17

---
title: Codes of Conduct
published: true
date: 2021-02-21 12:37:43 UTC
tags: Assorted
canonical_url: https://www.bearveloper.dev/codes-of-conduct/
---

I am a big fan of having, following, and enforcing a Code of Conduct (CoC) in all projects where I participate. If by any chance they do not have one, I always seek to collaborate with the project maintainers to adopt one that aligns properly with their values. So far I have seen great results, we all grow together, and ensure a safe and civilized space for everyone.

My favorite Code of Conduct, is [Contributor Covenant](https://www.contributor-covenant.org). It is pretty easy to understand, pretty easy to implement, and it is backed by a lot of open source projects.
Password Creator GUI using PyCharm
Tags: opensource, python, beginners, machinelearning
Published: 2021-02-21 11:45:18

It is a tool that generates passwords based on the given guidelines that you set to create an unpredictable strong password for your accounts.

The Password generator tool creates a random and customized password for users that helps them to create a strong password which provides greater security.

**Prerequisites**
To build this project we will use the basic concept of python and libraries – Tkinter, pyperclip, random, string.

1.Tkinter is a standard GUI library and is one of the easiest ways 
  to build a GUI application.
2.pyperclip module allows us to copy and paste text to and from 
  the clipboard to your computer
3.The random module can generate random numbers
4.string module contains a number of functions to process the 
  standard python string.

```
pip install tkinter
pip install pyperclip
pip install random
pip install strings
```
**Steps**

1. Import Libraries
   The first step is to import libraries

2. Initialize Window
   *Tk()* initialized tkinter which means window created
   *geometry()* set the width and height of the window
   *resizable(0,0)* set the fixed size of the window
   *title()* set the title of the window
   *Label()* widget use to display one or more than one line of 
    text that users can’t able to modify.
   *root* is the name which we refer to our window
    text which we display on the label
   *font* in which the text is written
   *pack* organized widget in block

3. Select Password Length

4. Function to Generate Password

5. Function to Copy Password

```
from tkinter import *
import random, string
import pyperclip
rutik_root = Tk()
#width x height
rutik_root.geometry("400x400")
#width, height
rutik_root.minsize(200,100)
rutik_root.maxsize(1200,800)
rutik_root.title("Rutik - Password Generator")

Label(rutik_root,text="Password Generator", font="arial 15 bold").pack()
Label(rutik_root,text="Rutik", font="arial 15 bold").pack(side=BOTTOM)

pass_label=Label(rutik_root,text="Password Length", font="arial 15 bold").pack()
pass_len=IntVar()
length=Spinbox(rutik_root,from_ =8, to_ = 32, textvariable = pass_len, width = 15).pack()

pass_str = StringVar()
def Generator():
    password = ''

    for x in range(0,4):
        Password = random.choice(string.ascii_uppercase)+random.choice(string.ascii_lowercase)+random.choice(string.digits)+random.choice(string.punctuation)
    for y in range (pass_len.get()- 4):
        password = password+random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits + string.punctuation)
    pass_str.set(password)

Button(rutik_root,text =" Generate Password", command = Generator).pack(pady=5)
Entry(rutik_root, textvariable = pass_str).pack()

def Copy_password():
    pyperclip.copy(pass_str.get())
Button(rutik_root,text =" Copy to Clipboard", command = Copy_password).pack(pady=5)
rutik_root.mainloop()
```

And finally you will be getting an GUI Window like below.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/igfe4nlhnkqa1bl628kl.png)
8 Inspiring Tweets from Tech Twitter This Week
Tags: inspiring, advice, tips, programming
Published: 2021-02-21 11:08:25

This week, I stumbled upon a lot of inspirational and motivational tweets on Twitter that I found helpful. So, I'm putting them together in this list in the hopes that it inspires someone out there.

Note: If any of the account holders would like me to remove them from this list, please comment here or message me on my Twitter account [@shahednasserr](https://twitter.com/shahednasserr)

---

## From [@nickbulljs](https://twitter.com/nickbulljs)

{% twitter 1361933731334926349 %}

---

## From [@SeemaSaharan5](https://twitter.com/SeemaSaharan5)

{% twitter 1361945463566442496 %}

---

## From [@telmo](https://twitter.com/telmo)

{% twitter 1361842084068659207 %}

---

## From [@ASpittel](https://twitter.com/ASpittel)

{% twitter 1360302325718417411 %}

---

## From [@codewithmercy](https://twitter.com/codewithmercy)

{% twitter 1362597554152742915 %}

---

## From [@karaluton](https://twitter.com/karaluton)

{% twitter 1362477810086895616 %}

---

## From [@madsbrodt](https://twitter.com/madsbrodt)

{% twitter 1363194509287424005 %}

---

## And Lastly, A Tweet From [@VladPasca5](https://twitter.com/VladPasca5) to Motivate You For The Upcoming Week

{% twitter 1363020563111845889 %}