teleren/devto huggingface dataset:
Let's keep it green ✅
Tags: refactoring, cleancode, testing, webdev
Published: 2022-11-04 11:07:18

Working as a consultant I often carry out refactoring activities. I want to talk about that in this article. 

## Refactoring

Performing this type of activity is not easy at all because we have to incrementally refactor an application that already works and produces money.
Starting with a greenfield application is more affordable for everyone, be able to improve something is more challenging and then you can see the benefits with cleaner and more explicable code.

## Testing

But what does testing have to do with it now?
In my opinion, at the basis of a successful refactoring there must be a battery of tests that certify the operation of the application. It is like a contract that guarantees that everything is working as we expect.
If the code base we are going to refactor does not contain tests, the first thing to do is to create new ones to have a good starting base to work on.

## A real example

I take as an example a case that recently happened to me. The project I was working on had bundle size problems and among other things, I decided to replace the [Moment.js](https://github.com/moment/moment/#project-status) library because is legacy and not very suitable for tree shaking.

> In computing, tree shaking is a dead code elimination technique that is applied when optimizing code.
[wikipedia](https://en.wikipedia.org/wiki/Tree_shaking)

Here are the refactoring steps:

#### Step 1

I centralized all the calls to the library in a single file to have everything under control and avoid having to touch too many parts of the application.

> 💡 Collect third-party libraries into specific files is always a good practice
 
#### Step 2 

I went to cover the methods that communicate with the external library with the tests, this allowed me to guarantee, even after my refactoring, the same behavior.

#### Step 3 

With a working test suite I replaced Moment.js with [Day.js](https://day.js.org/), a very similar library, but with the advantage of being modular and therefore suitable for the tree shaking operation.

## Results 🚀

I analysed the bundle with [rollup-plugin-visualizer](https://www.npmjs.com/package/rollup-plugin-visualizer)

Before (Moment.js)

![Moment.js](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yiilmzbdpydzjjkth50h.png)

After (Day.js)

![Day.js](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8rlontfziz6axtar8e96.png)

---

This is just one of the operations I've done to improve the application and with this small and useful refactoring we have a leaner and more tested application.

---

You can [follow me on Twitter](https://twitter.com/giorgio_boa), where I'm posting or retweeting interesting articles.

I hope you enjoyed this article, don't forget to give ❤️.
Bye 👋

{% embed https://dev.to/gioboa %}
How to mail merge in .Net with BroggiSoft.OfficeExport
Tags: csharp, dotnet, programming, tutorial
Published: 2022-11-04 11:06:01

I created a Nuget package, [BroggiSoft.OfficeExport](https://www.nuget.org/packages/BroggiSoft.OfficeExport), to easily export data to an office document (Word, Excel and PowerPoint).

First you create a template with tags like in Angular, for example you can set a tag `{{City}}` in your document. In your .Net application, you create for example a Dictionary<string,string> with City as key and Paris as value and it will be replaced by the corresponding value. This style will be preserved, if you set a tag in italics the new value will also be in italics.

You can also send your data as a json or as an object.

Then you call the OfficeExport’s functions.

For information tags that do not have corresponding values will be removed.

The package also allows you to handle arrays. To do this, create a basic table in Word or PowerPoint and you add a tag like this `{{Lines[i].NetIncome}}` on a line, this has for effect to replace this line by the first value of your array and add a line for the other rows of your array.

 {% gist https://gist.github.com/Akutsu02/627c4ab52248cac544986107670a6b3c.js %}
 

The product key unlocks some features such as arrays support, but you can replace the basic tags without it.

In this example OfficeExport will create a new document OutPut.docx, but you can get the result as a blob.

![A Word Template](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ewidkb3smjjd1l61hxzn.png)

Become

![The output Word Document](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/343vt0h1mqu5yw9z0pob.png )

Please feel free to provide feedback to me at contact@broggisoft.com.

You will find all the documentation on [broggisoft.com](https://www.broggisoft.com/).

You can find a test project on GitHub: [OfficeExportTest](https://github.com/BroggiQ/OfficeExportTest)
This Week In Python
Tags: python, thisweekinpython
Published: 2022-11-04 11:00:00


**Fri, November 04, 2022**


This Week in Python is a concise reading list about what happened in the past week in the Python universe. 


## Python Articles


- [Where exactly does Python 3.11 get its ~25% Speedup?](https://log.beshr.com/python-311-speedup-part-1/) 
- [Make a Full Lexer in Python](https://replit.com/talk/learn/Make-a-Full-Lexer-in-Python/111397) 
- [Caching in Django Applications](https://blog.sentry.io/2022/10/24/django-performance-improvements-part-4-caching-in-django-applications/) 
- [PyCon US 2022 Recap and Recording Announcement](https://pycon.blogspot.com/2022/05/pycon-us-2022-recap-and-recording.html) 
- [Python Type Hints - Lambdas don’t support type hints, but that’s okay](https://adamj.eu/tech/2022/10/10/python-type-hints-lambda-incompatible/) 






## Projects


- [pyu2f](https://github.com/google/pyu2f) – is a python based U2F host library for Linux, Windows, and MacOS. It provides functionality for interacting with a U2F device over USB
- [spyql](https://github.com/dcmoura/spyql) – Query data on the command line with SQL-like SELECTs powered by Python expressions
- [quokka](https://github.com/marsupialtail/quokka) – Open source SQL engine in Python
- [DictDataBase](https://github.com/mkrd/DictDataBase) – A python NoSQL database that uses dicts, and provided thread and process safety
- [absurd-django](https://github.com/patrick91/absurd-django) – Run Django in the browser
Dars-2
Tags: webdev, cpp, beginners, programming
Published: 2022-11-04 10:50:59

```

```
Salom barchaga bugun 2 dars. Bugungi darsimiz qisqaroq lekn qiziqarli chunki bugun 1-2 ta belgi
ar haqida suhbatlashamz.
 
1 chi belgimiz "\" bu belgini biz shu tarzda korganmiz "\n" bu safar biz shu belgini ozini consolega chiqarishni organamz.Bu belgi chiqarip beruvchi hisoblanadi bu belgini ozini chiqarish un "\\" 2 marta bosamz agar 2 martta bossak bu belgini 1 tasini chiqarp beradi agar 4 marta qoysak con
ledan 2 ta "\\" shu belgi chiqadi

````
#include <iostream>
using namespace std;


int main(){
 cout << "\\" << endl;

  return 0;
}
```

2 chi belgi.Biz bilamzki "" qoshtirnoq faqatgina tekst larga ishlatamz bizga shu qoshrinoqni ozi kerak bolsa nma qilishimiz mumkun ?,biz 1 nchi belgini gaplashganimizda "\" shu belgini chiqarip beruvchi vazifasi bor degandik buni esa endi qoshtirnoqqa ishlatamz bu qanday boladi
 

````
#include <iostream>
using namespace std;
int main(){
  cout << " \" " << endl;
  return 0;
}
````
Mana korganingizdek shu tarzda qoshtirnoqni consolega chiqardik.@dawroun
Ecommerce App | Home Page UI - Flutter Speed Code
Published: 2022-11-04 10:49:11


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

A flutter ecommerce app home page UI project.

Clean Flutter Ecommerce Home Page App Design.

Do watch the video of flutter speed code in link down below.

https://www.youtube.com/watch?v=XwBv0Cb648I

► Figma Design Reference
www.figma.com/file/GmfAihpI80eARQF9KY0hOF/Ecommerce-App-UI-Kit-(Community)?node-id=0%3A1

► Social Media
[Instagram](https://www.instagram.com/flutter.pro.dev/)
[Twitter](https://twitter.com/slimpotatoboy)
[Website](https://dipenmaharjan.com.np)
C++ lesson 2
Published: 2022-11-04 10:47:56

#####Assalomu Aletkum bugun biz matn ichidagi maxsus buyuruqlar blan tanishamiz.

####Biz maxsus buyuruqlari ishlatish uchun `\`dan ya'ni maxsus buyuruq belgisidan foydalanamiz.

1) \n bu kodni ishlatsak biz yozayotgan satrni keyingi satrga ko'chirib beradi.
```cpp
#include <iostream>

using namespace std;

int main(){
    
    cout <<"Salom \nDunyo";
    
    return 0;
}
```
###Bunday holda manabunday javob qaytaradi:
###Salom
###Dunyo

2) `\t` bu kodni ishlatsak biz yozayotgan satrdan 3 bo'shliq tashab davom ettirib ketadi.

```cpp
#include <iostream>

using namespace std;

int main(){
    
    cout <<"Salom \tDunyo";
    
    return 0;
}
```

###Bu holda bizda manabunday javob qaytaradi:
###Salom    Dunyo


3) `\"` buyurig'dan foydalanish.Bu kod bizga matn qo'shtirnoqlarin yopib qo'ymaslik uchun kerak.


```cpp
#include <iostream>

uisng namespace std;

int main(){
    cout << "\"Kitob-bilm manbai\"";

    return 0;
}
```
###Bu holda bizga manabuday javob qaytaradi:
###"Kitob-bilm manbai"

3) `\\` buyurig'idan foydalanish.Bu kod bizga maxsus kod belgisini chiqarish uchun kerak. 

```cpp
#include <iostream>

using namespace std;

int main(){
   
    cout << "\\" ;

    
   return 0;
}
```

###Bu holda bizga manabunday javob qaytaradi:
###\

>@dawroun
Javascript Functions
Published: 2022-11-04 10:41:10

A function is a segment or block of code that is performed to carry out a particular task. In other words, it is a collection of callable, reusable code that can be used anywhere in the program, making the lives of developers easier by removing the need to repeatedly write the same piece of code. With the use of functions, developers can break up big programs into more manageable pieces. We can define a block of code, give it a name, and then execute it as many times as we like using functions.

## **JavaScript Function Overview:**
As in any other scripting and programming language, functions are one of the fundamental building blocks in JavaScript. A function is nothing but a series of statements that can be used to perform a task. In simple terms a function takes inputs and returns an output. In order to use a function, first we need to define it and then call the same.
Generally, functions always return a value. For example, a mathematical function performs calculations on the input data and returns an output. Other functions return true/false, or text. Some functions return no value but perform a side-effect; “write” is one such function whose side-effect is to send text to the HTML document.  
JavaScript Function Syntax:- We use the keyword function to define a JavaScript function followed by the name of the function, and a list of parameters(can be empty also) enclosed in  parentheses ().

## Different methods of declaring a JavaScript function

In JavaScript, there are different ways of declaring functions. Let’s examine what a function declaration is.

A function declaration, also known as function definition or statement, is a way of providing sets of instructions to be carried out in a program when executed. It is a way of saving a function with a particular parameter so it can be called when needed to perform the task for which it was defined.

The syntax (as seen below) of a function must be defined before it can be implemented:
 

-** Function** is a keyword that precedes the actual code. It is a **statement identifier**. This is why a function is said to be self-contained.

- **Name** is the name of the function to be executed on the parameters. It is user-defined and must be an action word.

- ( ) is the **grouping operator** which is a pair of parentheses and it is what envelopes the arguments that are to be run in the program.

- { } is the **block** that houses the code itself. It is the real definition of a function and is used to group statements.

The declared function can be invoked with **name ( )**; when required.

## **Function Scope**

Function scope specifies that the variables defined inside the function only accessible within the function and these types of variables are known as local variable. If we try to access local variable outside the function it will produce an Reference error — "variable is not defined”.
As per the functional scope each function can have its different set of local variables but they don’t interfere with each other.
Removing the camera overlay icon in Microsoft Edge
Tags: microsoftedge, overlay, image
Published: 2022-11-04 10:38:16

---
title: Removing the camera overlay icon in Microsoft Edge
published: true
description: Microsoft Edge puts a camera icon on every image in web sites to allow users to do a visual search. This can be annoying during development. Here's how to fix that.
tags: microsoftedge,overlay,image
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rvu689hnw3ah83tkrsoa.png
canonical_url: https://christianheilmann.com/2022/11/04/removing-the-camera-overlay-icon-on-images-in-microsoft-edge/
# Use a ratio of 100:42 for best results.
# published_at: 2022-11-04 10:21 +0000
---

If you use Microsoft Edge, you get a camera icon when you hover your mouse over any image:

![Camera icon when you hover over an image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3l64qvl53ffee2dmv95w.gif)

This is a great tool for users as it allows them to do a visual search in a sidebar for that image.

![Interaction showing more related images in a sidebar](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v6ayq4zcn4d2m49h2mjt.gif)

During local development, the icon appears on images, too, but the results don't show up. That means it interferes with your design and doesn't work. 

If you hover longer over the icon, you can access an overflow menu `…` which allows you to hide the icon for this site, to always hide it, to go to the settings and to give feedback. 

![More options menu on hover](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z4uvy9iogffqbkkujjao.gif)

You can also go to the browser settings [edge://settings/appearance/visualSearch](edge://settings/appearance/visualSearch) to add sites you don't want to see visual search by hand.

![The settings page for visual search](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zg55400njhouhbsyfjob.png)
realestate write for us
Published: 2022-11-04 10:30:27

[realestate write for us](https://sjrestates.com/write-for-us/)   Do you want to contribute an article to one of the biggest and fast growing real estate communities in the world.there are lot of contents on internet and to create unique and quality contents is so difficult that’s why we decided we will allow to everyone to include links to quality and user satisfying links to be credited.If you are looking to submit guest post on real estate blog then you are on right place write for us! We accept quality home improvement guest posts with image.
In One Minute : AWS Glue
Tags: aws, awsglue, beginners, oneminute
Published: 2022-11-04 10:30:00

AWS Glue is a fully managed ETL (extract, transform, and load) service that can categorize your data, clean it, enrich it, and move it between various data stores. AWS Glue consists of a central data repository known as the AWS Glue Data Catalog, an ETL engine that automatically generates Python code, and a scheduler that handles dependency resolution, job monitoring, and retries. AWS Glue is serverless, so there's no infrastructure to manage.

{% embed https://youtu.be/tMWUithNwJU %}

AWS Glue consists of a number of components components:

- [A data catalog](https://docs.aws.amazon.com/glue/latest/dg/populate-data-catalog.html) (implementing functionality of a Hive Metastore) across AWS data sources, primarily S3, but also any JDBC data source on AWS including Amazon RDS and Amazon Redshift
- [Crawlers](https://docs.aws.amazon.com/glue/latest/dg/add-crawler.html), which perform data classification and schema discovery across S3 data and register data with the data catalog
- [A distributed data processing framework](https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-python.html) which extends PySpark with functionality for increased schema flexibility.
- [Code generation tools](https://docs.aws.amazon.com/glue/latest/dg/edit-script.html) to template and bootstrap data processing scripts
- [Scheduling for crawlers and data processing scripts](https://docs.aws.amazon.com/glue/latest/dg/monitor-data-warehouse-schedule.html)
- Serverless development and execution of scripts in an Apache Spark (2.x) environment.

AWS Glue was introduced in August 2017.

With the ability to scale on demand, AWS Glue helps you focus on high-value activities that maximize the value of your data. 
To increase agility and optimize costs, AWS Glue provides built-in high availability and pay-as-you-go billing.

Data registered in the AWS Glue Data Catalog is available to many AWS Services, including
- Amazon Redshift Spectrum
- EMR (Hadoop, Hive, HBase, Presto, Spark, Impala, etc.)
- Amazon Athena
- AWS Glue scripts

Official website :- https://aws.amazon.com/glue
Easy steps to build NFT marketplace platform
Tags: nftmarketplace, nftdevelopment, nftplatform, webdev
Published: 2022-11-04 10:28:27

How to establish one’s own NFT Marketplace, similar to OpenSea, Axie Marketplace, Rarible, and Foundation, may be of interest to both business people and artists.

It’s a noble mission that hopefully will be successful. And carrying it out constitutes a mission in the truest sense of the word. However, before we get into the specifics, let’s quickly review some NFT fundamentals:

What is NFT Marketplace ?

You presumably already have a broad view of what an NFT marketplace is if you’re considering developing one, but here’s the gist: A platform for trading digital assets is what is commonly referred to as an NFT marketplace.

Anyone can use an NFT marketplace to buy or sell art, including music, in the virtual world, but how do you make an NFT marketplace?
Consider what will make your service unique and different from the competition before you begin developing your own NFT marketplace. Finding a specialty can help you target a willing and interested customer base.

Steps to create NFT marketplace :

Choose a Blockchain Architecture
Decide Between an Open or Closed Market
Define your style
Decide on a Commission Fee
Create or Join a Community
NFT Marketplace Development with Addus!

The NFT Marketplace is a virtual marketplace for purchasing and selling distinctive digital goods, to sum up. NFT marketplaces consist of two types: universal and specialty, and their titles very much speak for themselves. The NFT market is the subject of a lot of buzz. It becomes difficult from one angle. On the other hand, it creates opportunities, one of which is the development of an NFT market.

If you have an idea to build an NFT marketplace but lack expertise or a team of professionals, the Addus team is here. With years of experience creating products of various complexity levels and sorts, we are able to transform your concept into a fantastic product that users will adore.

**[Get in touch with us if you have any questions or to share your ideas for NFT products.](https://www.addustechnologies.com/nft-marketplace-development-company)**
Statistical Hypothesis Test in Python
Tags: python, shortcuts
Published: 2022-11-04 10:16:25

## What is Statistical Hypothesis Test?

In statistics, hypothesis test is used to test the quality of an assumption. By this test we can interpret whether the assumption made is true to factual data and situation or violates the facts.
This test is called **STATISTICAL HYPOTHESIS TESTING**.

Currently there are hundreds of statistical hypothesis testing but in this post we are going to see few of them which are most used.

**Following is the flowchart that describes the types which we will discuss in this post** : 


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


## 1. NORMALITY TEST

This statistical test helps you check whether your data has Gaussian Distribution or not.

This test again has 3 different types in it : 


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

1.1 Shapiro-Wilk Test

Python code for this test : 



```
# Example of the Shapiro-Wilk Normality Test
from scipy.stats import shapiro
data = [0.873, 2.817, 0.121, -0.945, -0.055, -1.436, 0.360, -1.478, -1.637, -1.869]
stat, p = shapiro(data)
print('stat=%.3f, p=%.3f' % (stat, p))
if p > 0.05:
	print('Probably Gaussian')
else:
	print('Probably not Gaussian')
```

1.2 D Agostino's K^2 Test

Python code for this test : 


```
# Example of the D'Agostino's K^2 Normality Test
from scipy.stats import normaltest
data = [0.873, 2.817, 0.121, -0.945, -0.055, -1.436, 0.360, -1.478, -1.637, -1.869]
stat, p = normaltest(data)
print('stat=%.3f, p=%.3f' % (stat, p))
if p > 0.05:
	print('Probably Gaussian')
else:
	print('Probably not Gaussian')
```

1.3 Anderson-Darling Test

Python code for the test : 

```
# Example of the Anderson-Darling Normality Test
from scipy.stats import anderson
data = [0.873, 2.817, 0.121, -0.945, -0.055, -1.436, 0.360, -1.478, -1.637, -1.869]
result = anderson(data)
print('stat=%.3f' % (result.statistic))
for i in range(len(result.critical_values)):
	sl, cv = result.significance_level[i], result.critical_values[i]
	if result.statistic < cv:
		print('Probably Gaussian at the %.1f%% level' % (sl))
	else:
		print('Probably not Gaussian at the %.1f%% level' % (sl))
```


Python codes about other tests shall be discussed in upcoming posts.

To be continued ....
This Week @ Grafbase - Nov 4
Tags: grafbase, graphql, news, webdev
Published: 2022-11-04 10:10:00

Happy Friday 🥳

**This Week @ Grafbase** has been all about product and documentation!

**What's new?**

🛠️ **Docs Quickstart**
There is now a Quickstart that you can follow to get up to speed with Grafbase in a few short steps.
[https://grafbase.com/docs/quickstart/get-started](https://grafbase.com/docs/quickstart/get-started)

🔍 **Update and Delete by unique fields**
You can now update and delete data by `id` and any `@unique` field.
[https://grafbase.com/changelog/update-and-delete-by-unique](https://grafbase.com/changelog/update-and-delete-by-unique)

{% embed https://www.youtube.com/embed/laY8fQUTVi4 %}

▲ **Next.js conf**
We recently sponsored Next.js conf and have a free workshop you can join happening later this month &mdash; [more info](https://docs.google.com/forms/d/e/1FAIpQLScv01U8yk8H_xYfc12IF8fiOt9hFcaQmI2kaqIAa_eSEowzHw/viewform)

📈 **Funding announcement**
You may have already seen but we announced a $7.3m raise to build the data platform of the future.
[https://grafbase.com/blog/announcing-7-3m-funding](https://grafbase.com/blog/announcing-7-3m-funding)

**What's next?**

🫐 We're attending and sponsoring [Jamstack Conf](https://jamstack.org/conf/). There's still tickets available for any last minute attendees. Get 40% off your ticket with code: `GRAFBASE40`.
[https://jamstack.org/conf](https://jamstack.org/conf)

💚 We're also sponsoring Nuxt Nation! This event happens November 16 & 17, online!
[https://nuxtnation.com](https://nuxtnation.com/)

🔓 We're working on more Data Validation topics and investigating how to properly implement migrations, resolvers, and more. [Join the community on Discord](https://discord.gg/grafbase) to have your say on how we should build the data platform for the future!

More exciting updates coming next week!

Have a great weekend 👋