teleren/devto huggingface dataset:
Automatically Update Date & Year in WordPress Affiliate Post
Tags: wordpress, affiliate
Published: 2021-03-09 10:21:23

We all publish several articles on our website which is related to affiliate products like "*Best XYZ Under XYZ Price*". 

While publishing the post on their blogs, people use the H2 format (as we shared below) to include year or months in their affiliate posts - like I'm using on my [lifetime deal website] (https://thelifetimedeal.com/).

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

The main issue with using this type of heading is, When a year or month changed, we have to update them with the latest one and there is no easy way to do it.

Therefore, here is a code which automatically shows the current year;

```
function year_shortcode() {
  $year = date('Y'); 
  return $year;
}
add_shortcode('year', 'year_shortcode');
```

And to show the current month along with the year, the code is as follow;

```
function year_shortcode() {
  $year = date('F Y'); 
  return $year;
}
add_shortcode('year', 'year_shortcode');
```

It is a basic code which you can include in your **function.php** file or use plugins like **Code Snippets** (which I recommend).

Once you've added the code, use the shortcode **[year]** with your H2 heading or in your paragraphs, like this:

> 10 Bestselling Mixer Grinder in India [year]

The shortcode will output the current year automatically for you, like this,

> 10 Bestselling Mixer Grinder in India 2021

---------

This shortcode will not work with SEO title and meta description (Based on your SEO Plugin, there is a separate code for this)

For example, You can use %currentmonth% and %currentyear% in Rankmath and Yoast to show the fresh month and year in [SERP Results] (https://thewpx.com/best-serp-tracking-tools/).
Women's day !More then half of the population of this world
Tags: wecoded
Published: 2021-03-09 10:16:15

<!-- ✨This template is only meant to get your ideas going, so please change/add/remove these prompts as you wish! We also encourage you to create your own title if you’d like! ✨ -->

## My most recent achievement was…

## Advocating for myself looks like…

## My biggest goal is…

## My advice for allies to support underrepresented folks who code is...

<!-- Once your post is published, it will not appear on the /t/shecoded page until an admin approves it. This is an extra step to ensure there is no abuse on this important tag. --!>
Nevertheless, Mariam Coded!
Tags: wecoded
Published: 2021-03-09 10:14:58

<center> ✨Happy International Women's Day! ✨ </center>
<p>&nbsp;</p>
## My most recent achievement
My most recent achievement this year so far is transitioning into Cloud engineering from Web development. It has not been a walk in the park, learning it with other things, but I never expected it to be. Having to dedicate a minimum of 5 hours a day to learn, provide solutions to tasks, and also document what I have learnt that day. Nevertheless, I’m happy for my growth, even with the obstacles and challenges.

Advocating for myself is not letting conscious or unconscious bias get to me as I try to navigate this industry. Documenting my journey on blogs and taking chances on myself.

## My advice for allies to support underrepresented folks who code is...

* Provide more jobs for underrepresented folks as there are many boot camps.
* Underrepresented folks shouldn’t have to be 2x better or put in twice the work as others before they can be noticed and not underestimated.
* Provide mentorship and training for underrepresented folks and take chances on them as you do adequately represented people.
Svelte and Cloudflare Pages
Tags: svelte, cloud, webdev
Published: 2021-03-09 09:30:11

_As I was writing this blog post Cloudflare Pages was still in open beta._

So here is a quick tour on how you can set up [your svelte project](https://svelte-cloudflare-pages.reitzner.at/) on cloudflare pages.

## Basic setup
First things first.
Login to your cloudflare account (if you don't have one yet, it is really easy to set one up).
Select the icon on the right for cloudflare pages.
![cloudflare pages button](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9a8auvthh7okfbmxea1q.png)
After that you can create a new project.
![create new project](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ypbdahek13gc3yubox54.png)

## Connect Repository & build
To continue you need to connect your github repo to cloudflare pages. After that you can select one of your (svelte) repositories.
![select you svelte repository](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rafol18stucojlzldg22.png)

On the next page you can set you project name and build settings. There is already a configuration for svelte that you can select from the dropdown. If needed you can adapt the values to your specific setup.
![build settings with svelte selected](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m3m1c6irx1ylztfl25zl.png)

The first build took a little longer, so no need to worry if it is not immediately done (I guess this is due to the fact that the first setup of your instance takes some time).

## Add a custom domain
So after your first build you can access your site on _your-project_.pages.dev. If you have your domain set up with cloudflare you can easily set up a custom domain for your project.

Just go to your pages dashboard and select your project.
After that you can go to the custom domains tab.
![custom domain tab](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uoksd6o6s5cnt9txfeky.png)

After that your svelte site is ready to shine on cloudflare pages.

## Links

- [cloudflare pages](https://pages.cloudflare.com/)
- [docs](https://developers.cloudflare.com/pages/)
- [cloudflare dashboard](https://dash.cloudflare.com/)
- [example page](https://svelte-cloudflare-pages.reitzner.at/)

Repo used:
{% github dreitzner/svelte-cloudflare-pages %}
How to add your GitHub activities to your GitHub Profile
Tags: github, git, markdown, githubactions
Published: 2021-03-09 09:00:08

---
canonical_url: https://blog.natterstefan.me/how-to-add-your-github-activities-to-your-github-profile
---

Yesterday I showed you [how to share your blog posts or YouTube videos on your GitHub profile](https://blog.natterstefan.me/how-to-present-your-latest-blog-posts-and-youtube-videos-on-your-github-profile). Today I have another tip for you on how to take your GitHub profile to the next level.

Especially if you contribute to open source projects or have published your own, you will always be active on GitHub. You write comments or merge pull requests. Just like blog posts, you can add these activities to your GitHub profile. This gives recruiters and other visitors to your GitHub profile a quick picture of what you've done recently. In this case, we also use GitHub Actions to get there.

## GitHub Action Setup

This time we are using an action from James George: [github-activity-readme](https://github.com/jamesgeorge007/github-activity-readme). He contacted me [on Twitter](https://twitter.com/natterstefan) months ago and asked if I could test his GitHub Action. I gladly did.

If you haven't set up your GitHub profile yet, here's a quick reminder:

- create a GitHub repository with your username: https://github.com/natterstefan/natterstefan
- add a README.md
- the contents of README.md will be displayed on your profile (e.g. [github.com/natterstefan](https://github.com/natterstefan)) as soon as you commit and push changes.

Now paste the following content into a new GitHub action file under the following path `.github/workflows/update-readme.yml`.

```yml
name: Update README

on:
  schedule:
    # Runs every 30 minutes
    - cron: '*/30 * * * *'

jobs:
  build:
    runs-on: ubuntu-latest
    name: Update this repo's README with recent activity

    steps:
      - uses: actions/checkout@v2
      - uses: jamesgeorge007/github-activity-readme@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

And finally, add the following into your README.md wherever you want to place the GitHub activity feed:

```md
### Recent Activity

<!--START_SECTION:activity-->
<!--END_SECTION:activity-->
```

Once the GitHub Action was triggered according to your schedule you will see a new section in your GitHub profile similar to mine:

![GitHub Activities Overview](https://cdn.hashnode.com/res/hashnode/image/upload/v1612765624430/L8J6wGjOo.png)

There are some more options for this GitHub action, which are documented in the  [repository](https://github.com/jamesgeorge007/github-activity-readme).

That's it. Now you have your GitHub activities on your profile! Congrats!

---

## Questions and Feedback

You got any questions or want to add your thoughts? Let me know in the comments below, please.
Add/ Remove Worksheet in Java
Published: 2021-03-09 06:59:31

This article will give two examples of how to insert and remove worksheet with a free Java API--Free Spire.XLS for Java.

**1# Installation**
**Method 1:** Download the [free API](https://www.e-iceblue.com/Download/xls-for-java-free.html) and unzip it, then add the Spire.Xls.jar file to your project as dependency.

**Method 2:** You can also add the jar dependency to maven project by adding the following configurations to the pom.xml.
```xml
<repositories>
        <repository>
            <id>com.e-iceblue</id>
            <name>e-iceblue</name>
            <url>http://repo.e-iceblue.com/nexus/content/groups/public/</url>
        </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>e-iceblue</groupId>
        <artifactId>spire.xls.free</artifactId>
        <version>3.9.1</version>
    </dependency>
</dependencies>
```

**2# The input Excel Workbook with three sheets:**
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nnst2k1yad6chluna6im.png)

**3# Add a worksheet to an existing Excel workbook in Java:**
```java
import com.spire.xls.*;

public class AddWorksheet {
    public static void main(String[] args) throws Exception {

        String inputFile = "file1.xlsx";
        String outputFile = "AddWorksheet.xlsx";

        //Create a workbook and load a file
        Workbook workbook = new Workbook();
        workbook.loadFromFile(inputFile);

        //Add a new worksheet named "AddedSheet"
        Worksheet sheet = workbook.getWorksheets().add("AddedSheet");
        sheet.getCellRange("C5").setText("This is a new sheet.");

        //Save the Excel file
        workbook.saveToFile(outputFile, ExcelVersion.Version2010);
    }
}
```
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7frv2o3dl8ntpstrnr2f.png)

**4# Remove a worksheet from Excel workbook in Java:**
```java
import com.spire.xls.*;

public class RemoveWorksheet {
    public static void main(String[] args) throws Exception {

        String inputFile = "file1.xlsx";
        String outputFile = "RemoveWorksheet.xlsx";

        //Create a workbook and load a file
        Workbook workbook = new Workbook();
        workbook.loadFromFile(inputFile);

        //remove the second worksheet
        Worksheet sheet1 = workbook.getWorksheets().get(1);
        sheet1.remove();

        //Save the Excel file
        workbook.saveToFile(outputFile, ExcelVersion.Version2010);
    }
}
```
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qj1amvfx2keebg2qmwk6.png)
NumPy Meshgrid Tutorial
Tags: python, tutorial
Published: 2021-03-09 08:41:02

---
title: NumPy Meshgrid Tutorial
published: true
description: 
tags: #python #tutorial
//cover_image: https://direct_url_to_image.jpg
---

What is a meshgrid?
What are the benefits of meshgrid?
Creating a 2D NumPy meshgrid from two 1D arrays
Creating a NumPy meshgrid with sparse=True
Creating a NumPy meshgrid of polar coordinates
NumPy meshgrid with ‘matrix indexing’
Flip a NumPy meshgrid
Creating Meshgrid with NumPy matrices
Creating a 3-dimensional meshgrid
Creating a 3D surface plot using NumPy meshgrid
Avoiding NumPy meshgrid memory error
Conclusion

https://likegeeks.com/numpy-meshgrid/
Best Data Science Course
Published: 2021-03-09 08:37:23

Hello Folks,

If you're a Data Enthusiast and want to build your career as a Data Scientist then you must go through  [Webdrills](https://webdrills.com/) Data Science Crash or Master Course.

You will be getting lots of benefits while you pursue the course
like:-
1- 100% Placement Assistance
2- Live On Job Training
3- One-to-one Interaction with Industry Experts
4- Live Based Online Classes

[Enroll Now](https://webdrills.com/home/course/data-science-master-program/15) To learn this Skill
Is Native development is really better than cross-platform frameworks like flutter & React Native?
Tags: discuss, flutter, reactnative
Published: 2021-03-09 08:28:46

Today, I came accross a post in Medium where the author has explained why native development is better than cross-platform frameworks like flutter and react native, although they really help to increase productivity. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lnmybqq3wtargcgn3tk6.gif)

I would like to know what everyone thinks, and what should be choosen or preferred in certain cases.

Kindly provide your views on the topic.
Brave - The underdog of browsing
Published: 2021-03-09 08:22:37

As Ted Nelson said:

###### _“What we now call the browser is whatever defines the web. What fits in the browser is the World Wide Web and a number of trivial standards to handle that so that the content comes.”_


It’s common in this day and age to use a web browser more than any other application. Being efficient, private and secure is one thing that crave’s the attention of the human brain. I’ve been switching back and forth many browsers throughout my teens and then one day out of the blue I’ve discovered Brave!.


With mixed bag feeling, I hesitated at first and then tried it out, it was similar and different from Chromium (Opensource Fork of Chrome), my Ex, and Firefox, my helper friend, in many many ways. Even though brave is built on top of chromium (Webkit on IOS though), it has inherited few good traits from privacy-oriented Firefox plus more super cool options as well.

__Pros__

* Ad blocking
* Close to zero data selling
* Phishing protection
* Malware protection
* Malvertising protection
* Per-site Shield settings
* Built in torrent client
* Built in tor connection
* Block Trackers
* Get paid for viewing Ads.
* Built-in Crypto Wallets
* Faster browsing (Better than chrome and firefox)
* Ram usage (Better than chrome and firefox)
* IPFS – downloading large files more decentralised.
* Block social media content embedded on other websites
* Secure sync
* Opensource
* Cross Platform

__Cons__

* Uses Brave sync and no Google sync/password manager (I use opensource password manager – (Bitwarden)[https://bitwarden.com/])
* Brave shield could break parts of some websites.
* Not the best android browser out there.
* Reward program is not very clear at start.


There are many tweaks under the hood, So instead of me talking, just give brave a shot at: https://brave.com/download/


Happy Browsing.
Social_Distancing_Measurer

Published: 2021-03-09 07:55:08

Computer Vision and AI are used to detect if people are at a specific distance and adhere to social distancing or not.
This algorithm estimates the social distance between humans. Social distancing is very important for protecting against COVID-19. We must follow the rules for our health. This algorithm created for analyzing social distancing rules. The algorithm calculates the distance between humans. Distance is bounded by 180 centimetres. If humans close each other fewer than 150 cm, you can see humans in the red bounding box. Otherwise, between 150–180, you can see humans in the yellow bounding box. Others safe zone in the green bounding box. This algorithm uses YOLO-v3 for human detection.
Used CLAHE preprocessing algorithm for better detections.
Requirements Python 3.6, Opencv 4.2.0 or above numpy 1.14.5 and argparse
Weights not added for sizes you can download from this link: https://pjreddie.com/media/files/yolov3.weights
Image for post
Output
Image for post
You can find the source code on my GitHub account. (https://github.com/qusaionali/Social_Distancing)
Sopping App (React Native)
Tags: mobile, javascript, redux, mobileapp
Published: 2021-03-09 07:42:46

Small Demo ecommerce App for show products list,add to cart and buy products.

Screens-
1.Login Screen.
2.Product Listing.
3.Product Detail (In this product can add in cart and also see cart products).
4.Cart Screen.
5.Reciept Screen.


Github repo link--
https://github.com/SimaRajput/SoppingApp
Why you need DS&A to be a great software engineer!
Tags: computerscience, algorithms, programming
Published: 2021-03-09 07:38:12

Recently, I have been having discussions with software engineers from all across the globe on a platform called Dogehouse. On DogeHouse there has been a common opinion about DS&A(data structures and algorithms) which is the idea that learning DS&A is useless. In these discussions, I am always the disagreeing party because learning these ideas will help you optimize your software for scalability and speed.


###Before learning the ideas of time complexity and how complexity impacts the overall software performance I was writing very complex code


 Looking back at my code from high-school I realized that my average complexity in data-intensive methods was O(n^2). This at the time was beyond my understanding but if I knew where to implement a hashtable my programs would have performed better.


###The common argument that I hear is that "I never have to resort to the use of the taught algorithms in the workplace"

This is a valid argument but in the underlying implementation of almost all software, there are optimized algorithms that handle certain tasks. Sure you can just use the software without knowing anything about it, but this type of abstraction destroys fundamental understanding. 

###DS&A saved me from many different nightmares!
Every time I have a problem that I have to solve, the first thing that comes to my mind is: "Will I need to be inserting items constantly ?,  Do I Need a key-value pair? Will the data set need to be static? " etc. Based on these questions I clearly get an idea of what type of data structure should be implemented in that specific case, but if I knew nothing about data structures it would have taken me longer to come up with a viable solution!
How to resolve async timeout in jest test case for async callback?
Published: 2021-03-09 07:30:16

How to resolve async timeout in jest test case for function?

I worked with node js and jest test. I am facing issue while execute test case for one function "getValidData()" that function sometimes getting late to provide response. So jest test case was failed and provide error related to below async timeout.

**Error : Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.**

Please refer below for "getValidData()" function and test case for the same.


**Actual Function: In data.js file**
```
exports.getValidData = function(){
return new Promise(function(resolve, reject){
    const payloadData = {
        'user_id': userid,
    };
    
    const res = await fetch('https://<token-url>',{
        method: 'POST',
        headers: {
            'Accept': 'application/json'
        },
        body: new URLSearchParams(payloadData )
    });
    
    if(res.status != 200){
        reject(res.message);
    }
    let responseData = await res.json();
    resolve(responseData);
    
});
}
```

**Test Case for Above function:In data.test.js file**

```
const dataTest = require("../data");
it("Test case for function getValidData", async()=>{
   await dataTest.getValidData().then(res => {
       expect(res).not.tobeNull();
   }).catch(err => {

   });
}, 30000);
```

How can i resolve this issue related to timeout with test case for above "getValidData()" function? Please let me know your thoughts and guidance on how to pass and execute without failed the above test case for "getValidData()" function.
Nevertheless, M__ Coded in 2021!
Tags: wecoded
Published: 2021-03-09 07:13:07

<!-- ✨This template is only meant to get your ideas going, so please change/add/remove these prompts as you wish! We also encourage you to create your own title if you’d like! ✨ -->

## My most recent achievement was:
*Going back to the drawing board to relearn web development all over again because after being in a certain internship, I realized that I did not know as much as I thought and that I had a long way to go.*

*I'm currently going through [the Odin Project](https://www.theodinproject.com/home) Foundations course and I'm happy that I'm able to grasp the concepts a bit better than I did before. That's progress.*

## Advocating for myself looks like:
*Being courageous enough to stand up for myself when I feel like I'm not being heard. It's very important to speak up regardless of the situation because it's worse to be silent especially when a matter affects you or others either on a personal level or not.* 

#### The truth will always win. 

## My biggest goal is:
*Become a notable developer regardless of my gender or race or religion and stand out by my work and ensure that whatever I do is of help to anyone and everyone. Sharing knowledge is part of growth.*
*Have mentors and be a mentor to anyone struggling with tech in one way or another.*

## My advice for allies to support underrepresented folks who code is:
*Never downplay or undermine any questions a new developer asks. Be willing to help because how you guide them will affect how they learn and eventually how they assist developers who come after them.*
*Always check up on them because some of us(like me) are introverted and might be afraid or shy to ask questions because we might be told off. Checking up on us always makes us feel like yes, someone does care and wants to see me succeed as well.*
## Kindness goes a long way in helping someone.
JavaScript Non-garbage-collection in Objects
Tags: javascript, tutorial, webdev, codenewbie
Published: 2021-03-09 07:03:15

Garbage collection is a term used in computer programming to describe the process of finding and deleting objects which are no longer being referenced by other objects. In other words, garbage collection is the process of removing any objects which are not being used by any other objects &mdash; [MDN](https://developer.mozilla.org/en-US/docs/Glossary/Garbage_collection)

JavaScript engines store values in memory for reachability and these values reference can be changed or removed.

See the example below:

```js
let bello = { name: "Bello" }; //accessible

bello= null; // reference changed or object removed
```

An object in an array implies that the object will remain alive provided the array is alive even if there are no other references to it.

```js
let bello = { name: "Bello" };

const array = [ bello ]; // if array exist, object will exist

bello = null; // changed/overidden reference

console.log( array[0] ); // { name: 'Bello' }
```

The above is not a garbage-collection because the object still exists in the array.

Same as the example above, an object as a key in a `Map` exists in the memory provided the `Map` is alive.

See another example:

```js
let bello = { name: "Bello" };

const map = new Map(); // if map exist, object will exist
map.set(bello);

bello = null; // changed/overidden reference

console.log( map.keys() ); // [Map Iterator] { { name: 'Bello' } }
// Map prevents garbage-collection 
```

> `weakMap` doesn't prevent garbage collection of key objects.

We will see the use of `weakMap` in the next article.

Learn more on [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakRef)

---
[![Buy me a Coffee](https://res.cloudinary.com/bizstak/image/upload/v1610317510/ko-fi-trans_fr3su4.png)](https://www.buymeacoffee.com/techstackmedia)

---