teleren/devto huggingface dataset:
Tips to Speed Up Python
Tags: python, programming, productivity, tutorial
Published: 2021-11-19 06:41:35

Python is an interpreted language. After writing a Python program, you instruct the interpreter to run it. It executes the program one line at a time, first translating and then running each line. As a result, your Python application will run very slowly. However, by optimizing the code given in this post, we can speed up Python excretion. You may speed up your programs and code by following this method.

Read more: [Speed Up Python](https://linuxtus.com/python-tricks-code-faster/)
Lazy Loading Google Adsense
Tags: webdev, tutorial
Published: 2021-11-19 06:33:25

The speed of a website is crucial. It's so important that Google uses it as a ranking factor. You should make your website as speedy and simple to navigate as feasible. If you use Google Adsense on your website, you should consider boosting the speed of your site because Adsense slows it down.

Read more: [Lazy Loading Google Adsense](https://linuxtus.com/lazy-load-google-adsense-new-code/)
How to Test Your NGINX Configuration Before Screwing it Up
Tags: nginx, server, backend
Published: 2021-11-19 06:22:51

A little invalid change to your Nginx configuration can bring down your entire server. Before performing changes to the Nginx configuration, it is a safe idea to test the changes and then reload the server.

In this tutorial, you'll learn to get started ensuring you never take production down again!

Read the full blog on [Adam The Automator](https://adamtheautomator.com/nginx-test-config/).

Thanks for reading 💜

---

I publish a [monthly newsletter](https://www.ravsam.in/newsletter/) in which I share personal stories, things that I am working on, what is happening in the world of tech, and some interesting dev-related posts which I across while surfing on the web.

Connect with me through [Twitter](https://twitter.com/ravgeetdhillon) • [LinkedIn](https://linkedin.com/in/ravgeetdhillon) • [Github](https://github.com/ravgeetdhillon) or send me an [Email](mailto:ravgeetdhillon@gmail.com).

— [Ravgeet](https://www.ravgeet.in/), *Full Stack Developer and Technical Content Writer*
BLOCKCHAIN
Published: 2021-11-19 06:17:55

Cryptocurrencies are a form of digital or virtual currency that run on a technology called Blockchain.
we dont require a central authority and are protected by strong and complex encryption algorithms.
there are more than thousands of crypto currencies like litecoin,aetherium c cache etc.

 Blockchain can be defined as collection of records,linked with each other  is a shared,strongly resistant to alteration,protected using cryptography. immutable ledger that facilitates the process of recording transactions and tracking assets in a business network.an asset can be anything such as house,car,land,money or intellectual property etc.


blockchain is important because the business runs on information , the faster it recieves and the more accurate it is, the better.
the data within blocks are encrypted by complex algorithms.
Every users in the bitcoin network has two keys public key and private key.
public key is the address that everyone in the network knows of but private key is unique address that only the user has knowledge of like password.
the number of bitcoins is send through a wallet address through hashing algorithm all of these will be part of transaction details.these details are encrypted using encryption algorithms and using fills unique private key this is done to digitally sign the transaction and to indicate the transaction came.
different cryptocurrencies use difference hashing algorithms Bitcoin uses SHA256.
Etherium uses ETHASH.
this transaction are taking place all around world this transactions are validated and added block by block the people who validate the blocks are called miners.
Free Ringtone For Mobile
Published: 2021-11-19 04:17:38

One of the best ways to personalize your phone is to set up ringtones. These are usually short sounds that can be downloaded to your phone. They can be funny, romantic, classical, or anything else you can imagine. Most phones come with an option for customizing ringtones, too. In addition to these features, you can even add your own music. If you want to create a ringtone that will stand out from the crowd, you can create a personalized one for your phone at https://zigtone.com/iphone/

Ringtones are becoming more popular in recent years. You can create a customized ringtone to play on your phone by adding a few extra sounds to your phone. You can also upload your own sound clip to make it even more personalized. In general, Android users can use this method to create their own custom earphones. Then, you can choose the ringtone's start and stop time.

A ringtone is an audio file that sounds like a song. You can cut a certain section of a song into a ringtone and then download it to your mobile. You can also create your own ringtones on the Internet with a dedicated app. A ringtone can be about 30 to 45 seconds long. If you're using a downloadable ringtone, you may need to trim the audio file.

You can customize the tone of your phone by downloading ringtones from sites like Mobile9 or Google Play. These apps are designed to offer a range of useful services to users. These include a plethora of free books and apps, as well as ringtones for mobile phones. And as with any other app, you need to know where to look for them. The best way to personalize your phone is to download free ringtones and get them on your mobile device.

If you are looking for a ringtone for your mobile, you can download it for free using the Achtung app. The app requires that you have a song stored in your internal storage. You can also download it for free by downloading it to your phone. The Achtung app offers two ways to transfer your song. The first method does not require a computer, and the second method requires a free one uses a cellular connection.

Moreover, you can also create ringtones for mobile that represent your personality. In many cases, these songs can be downloaded for free from a number of websites. They can be downloaded and re-used over again. Depending on the type of music, you can use the same ringtone to get new music. There are plenty of different types of mp3 files for mobile phones. It's important to find a quality website for downloading ringtones for your mobile.
npm ERR! Unexpected end of JSON input while parsing near...
Published: 2021-11-19 05:37:17

---
title: npm ERR! Unexpected end of JSON input while parsing near...
published: true
description: #npm #error
tags: 
//cover_image: https://direct_url_to_image.jpg
---

###### Actual Behavior:
User tries to install npm packages using `npm i`, and gets an error message saying:
> npm ERR! Unexpected end of JSON input while parsing near...


###### Possible Solutions:
* Clear the npm cache:
```
npm cache clean --force
```
* Try updating to the latest npm:
```
npm i npm@latest -g
```
* Try deleting `package-lock.json` file. It keeps track of exact version of every package that is installed.
```
rm package-lock.json
```
Measure docstring coverage of Python packages with GitHub Actions
Tags: actionshackathon21
Published: 2021-11-19 04:42:41

[Instructions]: # (To submit to the GitHub Actions x DEV Hackathon 2021, please fill out all sections.)


### My Workflow

[Note]: # (Please make sure the project links to the appropriate GitHub Actions repository, and includes [an open source license](https://choosealicense.com/) and README.)

Workflows that enforce [code style](https://black.readthedocs.io/en/stable/integrations/github_actions.html) and [coverage](https://github.com/codecov/codecov-action) are widely used on GitHub, but... what about code documentation?

This workflow does the job by using the `docstr-coverage` package.

- Fails when the docstring coverage is lower than the score of the base branch (on pull requests) or the previous commit (on push). Files that made the job fail are blamed.

- Pushing changes to the main branch updates the current coverage of the project by creating a dynamic badge with through the [shields.io](https://shields.io/endpoint) endpoint.

- It is possible to define the range of the badge color based on the coverage results.


### Submission Category: 

[Note]: # (Maintainer Must-Haves, DIY Deployments, Interesting IoT, Phone Friendly, or Wacky Wildcards)

Maintainer Must-Haves


### Yaml File or Link to Code

[Note]: # (Our markdown editor supports pretty embeds. Try this syntax: `{% github link_to_your_repo %}` to share a GitHub repository)

{% github epassaro/docstr-cov-workflow %}



### Additional Resources / Info

An [older version](https://github.com/tardis-sn/tardis/blob/master/.github/workflows/docstr-coverage.yml) of this workflow is currently used by [TARDIS-SN](https://github.com/tardis-sn), a Montecarlo radiative transfer code that creates synthetic spectra for supernovae.

{% link https://dev.to/epassaro/how-to-keep-track-of-docstring-coverage-of-python-packages-on-ci-41fc %}

[Note]: # (Be sure to link to any open source projects that are using your workflow!)

[Note]: # (Be sure to include the DEV usernames of your collaborators, if any)

[Reminder]: # (Submissions are due on December 8th, 2021 (11:59 PM PT or 2 AM ET/6 AM UTC on December 9th)
Dev in Dev: Issue 1 Nov 2021
Tags: news, webdev, performance, nextjs
Published: 2021-11-19 04:28:26

# About D.I.D.
The Developments in (Web) Development series is about pulling together interesting updates and developments that come across my radar in web development. This can include product releases, updates conference talks and events.


# Transitional Apps?
AJAX and Single Page Apps ushered in a new age of web experiences, however it is not without it's flaws. Transitional Apps is a new paradigm of web apps that proposes a new direction. [Rich Harris](https://mobile.twitter.com/Rich_Harris) of [Svelte](https://svelte.dev/) introduces this concept at [Jam Stack Conf 2021](https://jamstackconf.com/).

{% youtube 860d8usGC0o %}

# Transitions on the Web
Transitional apps isn't the only effort to improve navigational experiences in web apps. The [shared element transition API](https://developer.chrome.com/blog/shared-element-transitions-for-spas/) is a proposal to bring native transitions to the web platform. Some of the goals of this overlap with an earlier proposal called the [Portals API](https://web.dev/hands-on-portals/). You can try out shared element transitions and give feedback at their [github repo](https://github.com/WICG/shared-element-transitions).

You can demo this [here](https://preact-with-nav-transitions.netlify.app/)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/akd4nswo7901zifdrige.gif)
 
# Powerful Performance Tooling
One really interesting announcement of Chrome Dev Summit 2021 is the [lighthouse user flows](https://web.dev/lighthouse-user-flows). This allows you to audit and profile the performance of an application throughout various user interactions.

{% youtube n57U2_-3NLQ %}

# Cutting Edge Computing
NextJS recently [announced version 12](https://nextjs.org/blog/next-12) and with it came a several features and services. One of which is [Vercel's edge functions](https://vercel.com/features/edge-functions) which is basically cloud functions that run on the [edge](https://en.wikipedia.org/wiki/Edge_computing) (CDNs). This concept isn't entirely new as [Cloud Flare Workers](https://workers.cloudflare.com/) and [Deno Deploy](https://deno.com/deploy/docs) have a similar goals. This signifies yet another shift in how we think about building and deploying web apps.

{% youtube lRQ5z7i7pxE %}

# Next level serverless

[Serverless Cloud](https://www.serverless.com/blog/introducing-serverless-cloud-public-preview) is a recently launched platform that lets build, test and deploy to cloud seamlessly right into your cloud editor!

{% youtube GtLnCy4oVPk %}

# Conclusion
That brings us to the end of the first issue of D.I.D. What is your favourite update? Do you have one you'd like to share? Please let me know in the comments!

# Need More?

I'll be giving a talk at [DevFest Caribbean 2021](https://bit.ly/DFCarib2021) today at 4:30 pm (-400 GMT) that goes deeper into this stuff. You are welcomed to check it out as well as the other amazing talks at the event.

{% youtube 3l7oy-ijKlk %}
CSS, layout, UI - Resources
Tags: webdev, beginners, anouncement
Published: 2021-11-19 04:15:55

I have the opportunity to attend the following workshops on November 9th, 2021, and hope to share the experience/resources with everyone! If you like to learn by doing, then you will have a lot of fun going through the following workshops:

### CSS Layout Workshop - Rachel Andrew, Technical Writer @ Google

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

Feel free to clone the [codepen](https://codepen.io/rachelandrew/pen/adbc27add339ce3aa34377c03827eee0) and to practice **CSS Grid**, **Flexbox**, and **Fallbacks**. Rachel walked through the workshop below with everyone in the workshop. 

This is a great workshop to practice all the CSS & Layout fundamentals! 

Speaker's Twitter: [@rachelandrew](https://twitter.com/rachelandrew?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor)

### User-Adaptive Interfaces - Adam Argyle, UI/UX Specialized Fullstack Engineer/Googler 

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

Adam walked through a [codelab](https://codelabs.developers.google.com/codelabs/user-adaptive-interfaces#0) on user-adaptive interfaces (Light/dark modes, Grid, direction, etc.). Feel free to find more resources below. This was the best CSS session and I have a lot of fun!! 

**Workshop Resources**:
- Step-by-step walkthrough: https://codelabs.developers.google.com/codelabs/user-adaptive-interfaces#0
- As recommended in the codelab step 2, you can also use codelab with some codes to start off with: https://codepen.io/argyleink/pen/abBMeeq
- This is what the final product looks like: https://googleio-adaptive-ui-workshop.netlify.app/
- Still want to hear someone to guide you through, here is the video resource: https://www.youtube.com/watch?v=NQ-FQvsR-gY&t=100s

**Other Web Resources**: 
- HTML/CSS playground: https://visbug.web.app/
- Learn anything regarding to web vitals, design, etc: https://web.dev/learn/
- Get to know the 10 powerful lines of CSS: https://web.dev/one-line-layouts/
- https://caniuse.com/ --> super great tool to find out if certain CSS layout or method is compatible with certain browsers only or not. 

Speaker's Twitter: [@argyleink](https://twitter.com/argyleink?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor)

___

If you have miss the CDS 2021 events, no worries, you can always learn more [here](https://developer.chrome.com/devsummit/courses-and-content/)!
Performing code reviews 
Tags: opensource
Published: 2021-11-19 03:54:21

Contributing to open-source doesn't stop at adding features and fixing bugs. Sometimes, you can do more than you might think just by performing code reviews.  In this week of my open-source journey, I'll share some of my experiences when performing code reviews.

The project where I'll be doing this was my school IPC144 curriculum renewal. With many students working on the repository, it is essential to review and test incoming PRs regularly. Surprisingly, I didn't have any trouble looking for issues this time.

Here are the issues that I decided to perform the code reviewing on:

- [Audit & fix `Information.md`](https://github.com/Seneca-ICTOER/IPC144/pull/81)
- [Audit & fix `Compilers.md`](https://github.com/Seneca-ICTOER/IPC144/pull/73#event-5639653957)

In the first issue, I wanted to check if the person escaped the special characters with "\," as some of them didn't get converted properly when formatting with Prettier. An example of this was on line 115-128, when the asterisks were replaced with underscores:

```
// Original
* Giga or G (=1024M): 1 Gigabyte = 1024 * 1024 * 1024 bytes ~ 10<sup>9</sup> bytes

// Expected
* Giga or G (=1024M): 1 Gigabyte = 1024 \* 1024 \* 1024 bytes ~ 10<sup>9</sup> bytes

// Actual
* Giga or G (=1024M): 1 Gigabyte = 1024 _ 1024 _ 1024 bytes ~ 10<sup>9</sup> bytes
```

For the second issue, I mainly focused on addressing what the contributor was missing in the list of requirements, specifically:

- Using backticks and all code for memory addresses and such in tables that use things like void, int, function names, memory addresses.
- Removing unnecessary changes

Code review is an excellent thing to do. By assisting others by leaving reviews and comments on the PR, not only will you improve the code quality of the PR, but you will also be able to learn some new stuff too.

To find out more about the problem in the first issue, you can check [here](https://github.com/Seneca-ICTOER/IPC144/issues/56).

Happy coding! 💻
2 - 100DaysOfCode
Tags: 100daysofcode, angular, template
Published: 2021-11-19 03:37:05

18NOV2021
Hoy busque una **plantilla** de un proyecto en angular y la aloje en Docuentation\Templates. Esta plantilla fue comprada y tiene muchos componentes hechos con html, sccs y js. Es una **ayuda muy importante para el proyecto**.

Mañana se trabajara en la planificación del diseño de los modulos en el ecommerce.
Code Smell 103 - Double Encapsulation
Tags: oop, solidity, web3, beginners
Published: 2021-11-19 03:05:05

*Calling our own accessor methods might seem a good encapsulation idea. But it is not.*

> TL;DR: Don't use setters and getters, even for private use

# Problems

- Setters

- Getters

- Exposing private attributes

# Solutions

1. [Remove setters](https://dev.to/mcsee/refactoring-001-remove-setters-26cg)

2. Remove getters

3. Protect your attributes

# Context

Using double encapsulation was a standard procedure in the 90s.

We wanted to hide implementation details even for private use.

This was hiding another smell when too many functions relies on data structure and accidental implementation.

For example, we can change an object internal representation and rely on its external protocol.

Cost/benefit is not worth it.

# Sample Code

## Wrong

[Gist Url]: # (https://gist.github.com/mcsee/6f91efd52401b93f91322f20ab6d3aab)
```solidity
contract MessageContract {
    string message = "Let's trade";
    
    function getMessage() public constant returns(string) {
        return message;
    }
    
    function setMessage(string newMessage) public {
        message = newMessage;
    }
    
    function sendMessage() public constant {
        this.send(this.getMessage());
        //We can access property but make a self call instead
    }
}
```

## Right

[Gist Url]: # (https://gist.github.com/mcsee/91d0aa627815f79d471fa79150c5dc9b)
```solidity
contract MessageContract {
    string message = "Let's trade";
        
    function sendMessage() public constant {
        this.send(message);
    }
}
```

# Detection

[X] Semiautomatic

We can infer getters and setters and check if they are invoked from the same object.

# Tags

- Encapsulation

# Conclusion

Double encapsulation was a trendy idea to protect accidental implementation, but it exposed more than protected.

# Relations

{% post https://dev.to/mcsee/code-smell-37-protected-attributes-4n4 %} 

{% post https://dev.to/mcsee/code-smell-28-setters-2hih %}

{% post https://dev.to/mcsee/code-smell-68-getters-o12 %}

# More Info

- [Stack Exchange](https://softwareengineering.stackexchange.com/questions/181567/should-the-methods-of-a-class-call-its-own-getters-and-setters)

- [Reddit](https://www.reddit.com/r/java/comments/2f3flb/is_it_considered_better_practice_for_a_class_to/)

- [InfoWorld](https://www.infoworld.com/article/2073723/why-getter-and-setter-methods-are-evil.html)

# Credits

Photo by <a href="https://unsplash.com/@rayhennessy">Ray Hennessy</a> on <a href="https://unsplash.com/s/photos/double">Unsplash</a>
  
* * *

> Encapsulate the concept that varies.

_Erich Gamma_
 
{% post https://dev.to/mcsee/software-engineering-great-quotes-26ci %}

* * *

This article is part of the CodeSmell Series.

{% post https://dev.to/mcsee/how-to-find-the-stinky-parts-of-your-code-1dbc %}
Code Reviews for IPC144 Course Notes Project
Tags: opensource, osd600
Published: 2021-11-19 02:57:12

## The Problem

As mentioned in my [previous post], we are currently working on auditing the [markdown files](https://github.com/Seneca-ICTOER/IPC144/tree/main/docs) for [Seneca IPC144 course notes](https://cghub.ca/). Another way I'm contributing to this project is by sending reviews to other students' pull requests.

There were 2 existing pull requests by [hphan9](https://github.com/Seneca-ICTOER/IPC144/pull/73) and [oliver-pham](https://github.com/Seneca-ICTOER/IPC144/pull/72) at the moment so I decided to take a look at both.

## The Process

While I could quickly look at the changes on GitHub, it's still necessary to add their repo as remotes so I could properly test their code locally.

#### Fixing `compilers.md` by [hphan9](https://github.com/Seneca-ICTOER/IPC144/pull/73)

Emily already fixed a great deal of issues on this page such as the typos, markdown syntax, Frontmatter metadata, improving page's accessibility, adding inter-site links and alt text on images. However, I also found a grammatical mistake and some minor parts that needed to be wrapped in backticks. I also suggested her to replace the plain `**Notes**` with [Admonitions](https://docusaurus.io/docs/markdown-features/admonitions).

#### Fixing `algorithms.md` by [oliver-pham](https://github.com/Seneca-ICTOER/IPC144/pull/72)

Oliver did a great job fixing the major problems of the page including: updating Frontmatter for page, fixing all code to be wrapped with backticks, replacing **`...`** used as a fourth heading level with `####`, replacing blockquote with Admonitions and adding inter-site links. The page content looks much clearer after his changes and all the links are working as intended. There are only 2 things I found which was a grammatical mistake and some extra indentations. These are minor issues but I believe that fixing them will improve the overall consistency of the document.

## Final thoughts
After both receiving and giving reviews, I believe that the best approach to do review is to also give suggestions along pointing out the issues.
Crop Image Before Upload Using Croppie Plugin
Tags: laravel, php, javascript, fileupload
Published: 2021-11-19 02:52:53

In this tutorial crop image before upload using croppie plugin, some time we need to crop image due to large size before upload in server. Here i will give you example of how to crop image before uploading in server or jquery crop and resize image before upload, croppie plugin provide circle and square crop photo and several others option of settings.

Here, I have used croppie.js CDN for crop image So copy my code and get output and i have created one folder crop_image and create index.php file into this folder for crop image before upload using croppie plugin example.

---

**_[Read More : Crop Image Before Upload Using Croppie Plugin](https://techsolutionstuff.com/post/crop-image-before-upload-using-croppie-plugin)_**
Prototype Building
Tags: html, css, productivity
Published: 2021-11-19 02:40:06

<iframe height="300" style="width: 100%;" scrolling="no" title="Generative UI - Orb Animation [pixi.js] + Frosty Elements ❄️" src="https://codepen.io/Kattegory/embed/RwZvvpz?default-tab=css%2Cresult&editable=true&theme-id=dark" frameborder="no" loading="lazy" allowtransparency="true" allowfullscreen="true">
  See the Pen <a href="https://codepen.io/Kattegory/pen/RwZvvpz">
  Generative UI - Orb Animation [pixi.js] + Frosty Elements ❄️</a> by Kat Armendariz (<a href="https://codepen.io/Kattegory">@Kattegory</a>)
  on <a href="https://codepen.io">CodePen</a>.
</iframe>