teleren/devto huggingface dataset:
How to use Zenity with examples
Published: 2022-01-31 12:27:55

---
title: How to use Zenity with examples
published: true
description: We look into how to use Zenity showing by some examples. Zenity is a graphical tool for your scripting to show dialog boxes on the GUI and return the result from Zenity back to your script.
tags:
cover_image: https://i.ytimg.com/vi/TQQxKXQq_t0/maxresdefault.jpg
---

{% youtube TQQxKXQq_t0 %}

We look into how to use Zenity showing by some examples. Zenity is a graphical tool for your scripting to show dialog boxes on the GUI and return the result from Zenity back to your script.
Selenium CheatSheet(xpath)
Tags: programming, selenium, beginners, tutorial
Published: 2022-01-31 12:21:26



## **Different approach to create XPath and CSS Selector**

Whole WebPage ->  /html --> html
Whole WebPage ->  body  --> /html/body body
image --> element --> //img img
Link   ---> //a[@href = 'url']  --> a[href = 'url']
Direct Child //div/a div > a
Id --->//tagName[@id=’idValue’] tagName#idValue
Class --->//tagName[@class=’classValue’]
[tagName.Value of Class]
Attribute---> //tagname[@attributename=’value1′]
tagName[attribute=Value of attribute]
Multiple Attributes //input[@type='submit' and @name='btnLogin']
tagname[attribute1='value1'][attribute2='value2']
Contains //*[contains(@type,'sub')]
         <HTML tag <[attribute*=subString]>
Starts with //tagname[startswith(@attribute, ‘Start value’)] <HTML tag><[attribute^=prefix of the String]>
Ends with //tagname[endswith(@attribute, ‘End value’)]
          <HTMLtag><[attribute$=suffix of the String]>
Matches     --> //*[matches(@type,'value')] N/A
First Child --> //ul[@id=’list’]/li[1] ul#list li:first-child
Last Child  --> //ul[@id=’list’]/li[last()] ul#list li:last-child
nth Child   --> //ul[@id=’list’]/li[3] ul#list li:nth-child(3)
Text Value  --> //td[text()=‘textname'] 
Element preceding some sibling   --->//E2/preceding-sibling::E1 
Sibling element immediately preceding--->//E/preceding-sibling::*1
User interface element that is disabled - //E[@disabled]E:disabled
Checkbox---> (radio button) that is checked //*[@checked]*:checked
Text Value ---> //td[text()=‘textname']
HTML tagnames
Tags: programming, webcomponents, development, testing
Published: 2022-01-31 12:02:31

## **Tag Name Specification**

```
<ul>     ----> Defines an unordered list of items.
<tr>     ----> Defines a row of cells in a table.
<title>  ----> Represents title to an HTML document.
<th>     ----> Used for creates header of a group of cell in HTML table.
<table>  ---->  Used to defines a table in an HTML document.
<tbody>  ---->  Used for grouping table rows.
<td>     ---->  Used for creates standard data cell in HTML table.
<span>   ---->  Used to grouping and applying styles to inline elements.
```

## **Important Tagname and their Description**

```
<section>  ---->   Used to divide a document into number of different generic section.
<select>  ---->  Used to create a drop-down list.
<menu>    ---->  Used to display a unordered list of items/menu of commands.
<li>     ---->Define a list item either ordered or unordered list.
<iframe> ---->  Defines a inline frame that embedded external content into current web document.
<img>    ---->  Used to insert image into a web document.
<input>  ---->  Define a get information in selected input
<div>    ---->  Define a division part
<body>   ---->  Defines a main section(body)part in HTML document
<br />   ---->  Specific a single line break
<button> ---->  Specifies a press/push button
<a>      ---->  Specific a anchor (Hyperlink)
```
How to Hire an iPhone App Developer
Published: 2022-01-31 11:53:51

iPhone apps have been seeing a continuous growth since the covid-19 pandemic struck the world. The below graph is the proof of how rapidly businesses are developing iPhone apps to take their business offerings online.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0y95vfirhe3df48kzyxt.png)
Now, as evident from the above graph the need for quality iOS developers will also be increasing with the need and so finding a quality and expert iPhone developer is a difficult task for most entrepreneurs and businesses.

**WebClues Infotech** offers dedicated iPhone developers for hire on per hour as well as project basis. You can choose the best suitable model based on your requirement and **[hire dedicated iPhone developers](https://www.webcluesinfotech.com/hire-ios-app-developer/)** that are cost-effective.

**You can hire the iOS developer in just 3 simple steps mentioned below:**
1. Share the Developer/Project requirement on the above web address
2. Get shortlisted candidate list that can fulfil your requirement
3. Conduct interview and choose the most suitable developer to start the work

The above process is the simplest one to hire a dedicated iPhone developer with the probability of hiring the right developer at more than 95%.

I hope the post helps you hire the suitable iOS developer.
Pandas borrows a core concept from SQL and these 3 emoji tell you exactly how to use it
Tags: pandas, python, sql
Published: 2022-02-03 18:06:31

---
title: Pandas borrows a core concept from SQL and these 3 emoji tell you exactly how to use it
published: true
date: 2022-01-31 11:33:00 UTC
tags: pandas,python,sql
canonical_url: https://dramsch.net/posts/pandas-borrows-a-core-concept-from-sql-and-these-3-emoji-tell-you-exactly-how-to-use-it/
---

![](https://dramsch.net/images/banner/banner-pandas-joins.thumbnail.png)

 

Pandas borrows a core concept from SQL:

the Join

But there are so many different types of joining two DataFrames

Let's make this easy and go through Left, Right, Inner and Outer joins

Knowing these is great in interviews in addition to your usual DataFrame shenanigans

Joins always happen on two DataFrames.

This explanation will use: 🟩🟪⬛

- 🟩: The left DataFrame
- 🟪: The right DataFrame
- ⬛: The result

Don't get the word "join" wrong though, you can actually end up with a smaller DataFrame ⬛ than either or 🟩🟪

## ⬅️ The Left Join is selfish

This one takes the complete left DataFrame 🟩 and only checks for overlaps from the right 🟪

No 🟪 from outside of the bounds of 🟩 will make it into ⬛

## ➡️ The Right Join is almost the same as Left

Only take everything in 🟪 and overlapping 🟩

## ⤵️ The Inner Join

This one is tricky.

Almost always ⬛ will be smaller than 🟩&🟪.

For the Inner join, you only look at the parts of 🟩 and 🟪 that overlap.

Nothing is included in ⬛ that exists outside of this common area.

## ↔️ The Outer Join

Is possibly the simples one.

It is exactly what we would expect from a "join".

Take all of 🟩 and all of 🟪 and combine it into ⬛.

All of the data is in our result.

## TL;DR

- Pandas borrows from SQL using Joins
- Left and Right join maintain the original and whatever overlaps in the other
- Inner is only the common ground
- Outer uses all the data in both DataFrames
Top 20 Python Job Interview Questions You Should Know: 🧑‍💻

Tags: python, django, programming, challenge
Published: 2022-01-31 11:32:58

**Python**  is unquestionably one of the most popular and in-demand programming languages today. If you want to enter into the Python programming arena or perhaps advance to a Python developer career, here is a list of crucial questions to prepare for your job interview.


1. What is a dynamically typed language?
2. What is PEP 8 and why is it important?
3. What is Scope in Python?
4. What are decorators in Python?
5. What are lists and tuples? What is the key difference between the two?
6. What is lambda in Python? Why is it used?
7. What is break, continue and pass in Python?
8. What are generators in Python?
9. What is the difference between `.py` and `.pyc` files?
10. What do `*args` and `**kwargs` mean?
11. Python supports negative indexes. What are they and why are they used?
12. How do you list the functions in a module?
13. How can the ternary operators be used in python?
14. What are python libraries? name a few of them.
15. How to import modules in python?
16. Explain inheritance in python with an example?
17. What are python context managers?
18. Explain memory managed in Python?
19. How will you check if a class is a child of another class?
20. What do you understand by monkey patching in Python?

**Now** that you have read these questions, can you answer them in 30 minutes? 😁

Consider yourself in a real interview, and avoid using Google. 👀🙈
ShoPo - How to copy a text to clipboard
Tags: javascript
Published: 2022-01-31 11:29:54

#ShoPo - How to copy a text to clipboard (using JS!)

##ShoPo is a new posting session which is Short! (SHOrt POst).

Yeah! we can copy a text to clipboard at a click of a button!

so how to do it?

so do the following --
1)Add a click function to the button

> using `JavaScript` way 1
```
<button onclick="function()">Copy!</button>
```

> using `JavaScript` way 2
```
<button id="copyButton">Copy!</button>

<!--- Just add a onClick event in js --->
```

> using `Alpine`
```
<button @click="function()">Copy!</button>
```

2)Now code the function

```
function(){
  navigator.clipboard.writeText("text goes here!")
}
```
Fast indexing of 200 pages via google api
Published: 2022-01-31 11:24:48

STEP 1:


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

Setting up the Indexing API: creating a service account and JSON key Let's start by setting up access in the Indexing API console. Go to Google Cloud Platform and create a service account https://console.cloud.google.com/projectselector2/iam-admin/serviceaccounts?supportedpurview=project.

Here you can enter the desired project name or leave the suggested one. We leave the location as it is, editing is optional.

We continue to create a service [doolix](https://194.233.81.30/) account: you should see the following window in front of you (you will have a different project name):

1. Next, enter another arbitrary name.
2. Assign the role of this account - Owner.

Next, create a new key and download it to your computer.


STEP 2:
The ready key is needed to run the scanning script (https://github.com/swalker-888/google-indexing-api-bulk).
The script will be in the form of a folder, one of the files of which will be called service_account.

Next, you need to replace the content of the service_account file with the content of your downloaded JSON key. As a result, the service_account file in the script folder will look something like this:

The script is ready. Now it needs to be linked to Google Search Console.

STEP 3.
Linking the script to the Google Search Console To do this, assign the client_email from our JSON key as the full owner. This is how it looks in Google Search Console:

It remains only to enable the use of the Index API in our project. To do this, follow the https://console.developers.google.com/apis/api/indexing.googleapis.com/overview. Select a service account and enable the API.


Our script is now ready to use.
3 Things You Should Know about Memoization in React
Tags: javascript, react, performance
Published: 2022-01-31 11:14:32

Memoization is a technique of caching the results of a computationally expensive function. In React we can use this technique to avoid unnecessary re-renders and expensive recomputations. React provides three methods for this:

- **memo**: a higher-order component used for memoizing components.
- **useMemo**: hook for memoizing a value which is expensive to compute
- **useCallback**: similar to useMemo, used for memoizing a callback function. 

Even though memoization is great for improving performance, if used inappropriately it can have the opposite effect. Let's look at the top three things you should be mindful of before using these methods in your react projects. 

## 1. Memoization is meant for performance optimization 

Unless you encounter performance issues in your application, it is probably not a good idea to use any of the memoization methods. Your code should work without memoization(however slow it may be). As a rule of thumb, you should consider optimizing after implementing your components. 

If you notice performance issues, the React DevTools can help in finding performance bottlenecks. But also keep in mind that all performance issues can't be solved with memoization. So it is best to always check if there is any improvement gained from it.

Also, be wary of premature optimization, so you don't waste time optimizing without the need for it. Most operations in JavaScript are optimized and overall the React framework is very performant. So, in most cases, further optimization might not be needed.  

## 2. Memoization has performance overheads

Performance optimizations mostly come with some trade-offs. This is especially true with memoization. By caching previous results, we are using more memory in turn for better speed. So, you should always consider if the cost of memoization is worth it. This depends on the use case, but it is worth noting that there can be an extra overhead to its use if performance improvements are not substantial.

## 3. React doesn't always guarantee memoization

On the React docs if you see the section on useMemo it reads:

> You may rely on useMemo as a performance optimization, not as a semantic guarantee 

If you also look at React.memo in the docs you will find this:

> This method only exists as a performance optimization. Do not rely on it to “prevent” a render, as this can lead to bugs.

React will cache results for as long as possible, but in some cases, it may also choose to invalidate the cache. So, there is no guarantee that the memoized value has not been discarded. This means you can't rely on React to always memoize values for you. To avoid introducing bugs to your application, always use memoization methods to optimize performance and nothing more.

## Conclusion
I hope you now have all the information you need to use memoization in React responsibly. Please do share your comments and suggestions, and thank you for reading.

> This article was originally published [here](https://tealfeed.com/3-things-know-memoization-react-cynmx)
How To Include Jekyll Liquid Tags in Code Snippets
Tags: jekyll, howto, tutorial, codesnippets
Published: 2022-01-31 10:50:59

When I write about Jekyll on my website I often include code snippets to provide more context for how something works. You can easily copy these code snippets and paste them into your own Jekyll website to make them work for you. This is the advantage of being able to include code snippets in a how to article.

However when you include Jekyll specific code in default code snippets you'll notice all kinds of error messages start to appear in your terminal.

In this quick how to guide I'm going to show you how to include Jekyll-specific code into code snippets without breaking your Jekyll website.

---

## Here's How To Do It

Inside of the code snippet, wrap the code block with the following two tags: raw, endraw.

Here's what it looks like in my code editor:

![Code Editor Screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/etnnvyhu3zirsbauocci.png)

Here's what it looks like in the front end:

![Front End Screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/00y4x5slzmyvob540dvy.png)
Top 9 Apps That Will Make Money - A Weekend Project That Anyone Can Build
Tags: webdev, ios, android, mobile
Published: 2022-01-31 10:50:25

Hey, in this video, I want to show you the top 9 apps that will make you money, and experience.

These are all weekend projects that you can build.

They're not difficult, but they're definitely worth it if you want to start making some extra cash on the side and build your experience.


[![Top 9 Apps That Will Make Money](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z9wq0uxurq7p2zazndfg.png)](https://youtu.be/k72RXVldMYg)


[Watch Here](https://youtu.be/k72RXVldMYg)
How to set focus on angular material autcomplete input field
Tags: angular, angularmaterial, codever, snippets
Published: 2022-01-31 10:50:08

**Project** [`Codever`](https://www.codever.dev)

1. get access to the input field via template variable `@ViewChild('publicSearchBox') searchBoxField: ElementRef;`
2. get access to the autcomplete trigger to close the panel (we don't want that when the page loads) - `@ViewChild(MatAutocompleteTrigger) autocompleteTrigger: MatAutocompleteTrigger;`
3. call `focus()` and `closePanel()` on the two elements in one of Angular's lifecycle hooks - here in `AfterViewInit` : 

```typescript
@Component({
  selector: 'app-searchbar',
  templateUrl: './searchbar.component.html',
  styleUrls: ['./searchbar.component.scss']
})
export class SearchbarComponent implements OnInit, AfterViewInit {

  @ViewChild('publicSearchBox') searchBoxField: ElementRef;
  @ViewChild(MatAutocompleteTrigger) autocompleteTrigger: MatAutocompleteTrigger;

  ngAfterViewInit(): void {
    this.searchBoxField.nativeElement.focus();
    this.autocompleteTrigger.closePanel();
  }

}
```

Below you can see how the referenced template variable (`publicSearchBox`) and the angular autocomplete trigger are defined in the angular html template:

```html
  <input
    #publicSearchBox
    #autocompleteTrigger="matAutocompleteTrigger"
    matInput
    type="text"
    class="form-control"
    [formControl]="searchControl"
    placeholder="{{getPlaceholderTextForSearchbar()}}"
    [matAutocomplete]="auto"
    (focus)="focusOnSearchControl()"
    (focusout)="unFocusOnSearchControl()"
    [class.my-snippets-selection]="searchDomain === 'my-snippets'"
    [class.my-bookmarks-selection]="searchDomain === 'my-bookmarks'"
    [class.public-snippets-selection]="searchDomain === 'public-snippets'"
    (keyup)="watchForTags(publicSearchBox.value)"
    (keyup.enter)="$event.target.blur(); autocompleteTrigger.closePanel();searchBookmarksFromSearchBox(publicSearchBox.value)"
  >
```


<hr/>

> Shared with :heart: from [Codever](https://www.codever.dev/snippets/61f7a191a6871e0e9eee347b/details). Use :point_right: [**copy to mine**](https://www.codever.dev/snippets/61f7a191a6871e0e9eee347b/details) functionality to add it to your personal snippets collection.
Pandas cheat sheet 1
Published: 2022-01-31 10:47:19

##Pandas Cheat Sheet for Data Science in Python
A quick guide to the basics of the Python data analysis library Pandas, including code samples.
The Pandas library is one of the most preferred tools for data scientists to do data manipulation and analysis, next to matplotlib for data visualization and NumPy, the fundamental library for scientific computing in Python on which Pandas was built. 

The fast, flexible, and expressive Pandas data structures are designed to make real-world data analysis significantly easier, but this might not be immediately the case for those who are just getting started with it. Exactly because there is so much functionality built into this package that the options are overwhelming.

That's where this Pandas cheat sheet might come in handy. 

It's a quick guide through the basics of Pandas that you will need to get started on wrangling your data with Python. 

As such, you can use it as a handy reference if you are just beginning their data science journey with Pandas or, for those of you who already haven't started yet, you can just use it as a s a guide to make it easier to learn about and use it. 

The Pandas cheat sheet will guide you through the basics of the Pandas library, going from the data structures to I/O, selection, dropping indices or columns, sorting and ranking, retrieving basic information of the data structures you're working with to applying functions and data alignment.
###Python For Data Science Cheat Sheet: 
Pandas Basics
Use the following import convention:

``` import pandas as pd ```
Pandas Data Structures
###Series
A one-dimensional labeled array capable of holding any data type

```s = pd.Series([3, -5, 7, 4],  index=['a',  'b',  'c',  'd'])```
```
A	3
B	5
C	7
D	4
```
###DataFrame
A two-dimensional labeled data structure with columns of potentially different types

``` data = {'Country': ['Belgium',  'India',  'Brazil'],
'Capital': ['Brussels',  'New Delhi',  'Brasilia'],'Population': [11190846, 1303171035, 207847528]}```

 ```df = pd.DataFrame(data,columns=['Country',  'Capital',  'Population'])```
```
Country	Capital	Population
1	Belgium	Brussels	11190846
2	India	New Delhi	1303171035
3	Brazil	Brasilia	207847528
```

Please note that the first column 1,2,3 is the index and Country,Capital,Population are the Columns.

###Asking For Help
```
 help(pd.Series.loc)
I/O
```
###Read and Write to CSV
```
 pd.read_csv('file.csv', header=None, nrows=5)
 df.to_csv('myDataFrame.csv')
```
###Read multiple sheets from the same file
```
 xlsx = pd.ExcelFile('file.xls')
df = pd.read_excel(xlsx,  'Sheet1')
```
###Read and Write to Excel
```
 pd.read_excel('file.xlsx')
 df.to_excel('dir/myDataFrame.xlsx',  sheet_name='Sheet1')
```
###Read and Write to SQL Query or Database Table.
(read_sql()is a convenience wrapper around read_sql_table() and read_sql_query())

```
from sqlalchemy import create_engine
engine = create_engine('sqlite:///:memory:')
pd.read_sql(SELECT * FROM my_table;, engine)
pd.read_sql_table('my_table', engine)
pd.read_sql_query(SELECT * FROM my_table;', engine)
df.to_sql('myDf', engine)

```
Build Your Own Technical Documentation Page
Tags: javascript, programming, tutorial, beginners
Published: 2022-01-31 10:33:03

As part of this series, you'll learn how to build a Technical Documentation Page using HTML and CSS.

The technical documentation page should have functionality that is similar to this:
https://codepen.io/freeCodeCamp/pen/NdrKKL

You will be able to use HTML elements to create a documentation page and style it with CSS.

The documentation page should meet the following criteria:

I can see a main element with a corresponding id="main-doc", which contains the page's main content (technical documentation).

Within the #main-doc element, I can see several section elements, each with a class of main-section. There should be a minimum of 5.

The first element within each .main-section should be a header element which contains text that describes the topic of that section.

Each section element with the class of main-section should also have an id that corresponds with the text of each header contained within it. Any spaces should be replaced with underscores (e.g. The section that contains the header "JavaScript and Java" should have a corresponding id="JavaScript_and_Java").

The .main-section elements should contain at least 10 p elements total (not each).

The .main-section elements should contain at least 5 code elements total (not each).

The .main-section elements should contain at least 5 li items total (not each).

I can see a nav element with a corresponding id="navbar".

The navbar element should contain one header element which contains text that describes the topic of the technical documentation.

Additionally, the navbar should contain link (a) elements with the class of nav-link. There should be one for every element with the class main-section.

The header element in the navbar must come before any link (a) elements in the navbar.

Each element with the class of nav-link should contain text that corresponds to the header text within each section (e.g. if you have a "Hello world" section/header, your navbar should have an element which contains the text "Hello world").

When I click on a navbar element, the page should navigate to the corresponding section of the main-doc element (e.g. If I click on a nav-link element that contains the text "Hello world", the page navigates to a section element that has that id and contains the corresponding header.

On regular sized devices (laptops, desktops), the element with id="navbar" should be shown on the left side of the screen and should always be visible to the user.

My Technical Documentation page should use at least one media query.

Click the link below to access the prototype IMMEDIATELY...
https://codepen.io/hr21don/full/abVvxyG

Speak Soon!