teleren/devto huggingface dataset:
"Setdestination" can only be called on an active agent that has been placed on a navmesh.
Tags: c, unity3d
Published: 2022-03-15 13:43:50

Problem :
I am new to Unity5. I am facing the following error while trying to do setDestination.

"SetDestination" can only be called on an active agent that has been placed on a NavMesh. UnityEngine.NavMeshAgent:SetDestination(Vector3) CompleteProject.EnemyMovement:Update() (at Assets/_CompletedAssets/Scripts/Enemy/EnemyMovement.cs:30)

Please find below my code for your reference.

using UnityEngine;
using System.Collections;
namespace MyCompleteProject
{
    public class MyEnemyMovement : MyMonoBehaviour
    {
        Transform players;              
        PlayerHealth playerHealths;     
        EnemyHealth enemyHealths;       
        NavMeshAgent navs;              
         void Awake ()
        å{
         players = GameObject.FindGameObjectWithTag        ("Player").transform;
            playerHealths = players.GetComponent <PlayerHealth>  ();
            enemyHealths = GetComponent <EnemyHealth> ();
            navs = GetComponent <NavMeshAgent> ();
        }
       void Update ()
        {
            if(enemyHealths.currentHealths > 0 &&     playerHealths.currentHealths > 0)
            {
              navs.SetDestination (players.position);
            }

            else
            {
               navs.enabled = false;
            }
        }
    }
}
May I know what is wrong with the above code? Does anyone have any solution to my issue?

Solution :
I have lots of industry experience in writing complex Unity5 code. I have gone through your post and understood your problem.

So to begin with you must follow the below approach to resolve your issue:

1. Please make sure that your thirdPersonController is above the ground.
2. Please go to the Window->Navigation->Bake and click on bake.

The blue area is where the third person can reach the ground.

Another Solution:
STEP 1: You need to add a Navmesh to your scene before you can use NavMeshAgent or anything else related to Navigation.
STEP 2: Ensure that your thirdPersonController is above the ground.
STEP 3: .Go to Window->Navigation->Bake and click bake.The blue area is where the thirdperson can reach in the ground.
STEP 4: Your floor (plane or quad) must be static.
STEP 5: Add NavmeshAgent component your player or your enemy.

You can find a static checkbox on the inspector panel

STEP 6:
If you create a NavMeshAgent and set its position via transform.position=... and then try to SetDestination, it fails because the NavMeshAgent did not recognize the position change and does not know that it already is on the NavMesh. Use NavMeshAgent.Warp instead of transform.position to initialize the position before calling SetDestination.

STEP 7:
set up some params (The tutorial has Radius=0.75, Height=1.2 and Step Height=.0.1, and the rest of the settings from the tutorial are gone in Unity 5, as far as I can tell.

STEP 8:
The following code will solve this problem

nav.enabled = false;
Illustrated Typescript: is keyword
Tags: typescript, react, vue, node
Published: 2022-03-15 13:38:42


This is my first article and I'm trying to visualize my articles and called it **Illustrated** series. 

> I hope the attached  photos are really better than 1000 words for you.


What is `is` keyword in Typescript? Let's see:

Imagine, you want to publish a lib that contains some utility functions like below:


![User-Defined Type Guards](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d3yv4sdm9a1xtwyqi934.gif)


We do not have any access to `Date` methods because the function returns a `boolean` and why we should access to `Date` methods?

Typescript performs **User-Defined Type Guards** and it would be better if we performed a type checked:

![User-Defined Type Guards](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cle9vyeplflqhcmzklal.gif)


If the `isDate` function returns true, TypeScript will narrow the type to `Date` in `if` block and now, we have access to `Date` methods.

[Try it online.](https://www.typescriptlang.org/play?#code/GYVwdgxgLglg9mABDAzgEQIZQKYAoBuGANiNgFyIZgCeAlBYSdsiopjogN4CwAUIogBO2KCEFJGpZGBRQqEbHGBss2ANx8Avnz4B6AFSJwEOAFtT2MFEpgAJoiiDqfUJFgIW7PJPI26FACM4OCJsKh5+IRExCWIpGBk5SEVlLw1ebV59fV0dXhNElgAhbGA4YUQAXkRcBIAHECgKWUEEgHNEAB8VHHpEIJCwpEqAPi4+ARhgWvRVWrAGqFpaccjJhcaAOgnETIFhUXFEYGIUdS08vKA)

Have a good day/night with Typescript.
If-So Review - Dynamische Inhalte und WordPress Automatisierung
Tags: wordpress, automatisierung, dynamischeinhalte, ifso
Published: 2022-03-15 14:32:18

---
title: If-So Review - Dynamische Inhalte und WordPress Automatisierung
published: true
date: 2022-03-15 13:21:27 UTC
tags: WordPress,automatisierung,dynamischeinhalte,ifso
canonical_url: https://bloggerpilot.com/if-so-review/
---

![If-So Review - Dynamische Inhalte und WordPress Automatisierung](https://bloggerpilot.com/wp-content/uploads/2022/03/if-so-review.png)

Nutze mit IF-So eine datengesteuerte Marketingstrategie. So kannst du die...

Der Original-Artikel erschien auf [If-So Review - Dynamische Inhalte und WordPress Automatisierung](https://bloggerpilot.com/if-so-review/).

Der Aufbau eines Publikums und die Generierung von Traffic auf einem Blog kann viel Arbeit und Zeit erfordern. Mit ein paar WordPress-Plugins kannst du jedoch einige der Prozesse automatisieren, die normalerweise viel Zeit in Anspruch nehmen. Hier sind drei der beliebtesten, basierend auf den Lieblingsplugins des Power User Magazins von 2018.

Dynamische Inhalte sind ein Begriff, den ich in letzter Zeit immer häufiger höre, und er macht Sinn - [dynamische Inhalte](https://bloggerpilot.com/if-so-review/) ändern sich je nach den Eingaben des Nutzers. In WordPress kommen dynamische Inhalte in Form von Formularen vor, und es gibt viele Möglichkeiten, Standardformulare in WordPress in dynamische Formulare umzuwandeln.

Die Zeit wird zeigen, ob sich der Aufwand lohnt. Die Website wurde so gestaltet, dass sie einfach zu bedienen und zu verstehen ist. Administratoren können leicht neue Inhaltsseiten hinzufügen und die Seite ist vollständig responsiv.
Nuxt 3's useLazyAsyncData is a MAGIC function 🪄
Tags: nuxt, vue, javascript
Published: 2022-03-15 13:16:42

---
title: Nuxt 3's useLazyAsyncData is a MAGIC function 🪄
published: true
description: How to use Nuxt 3 useLazyAsyncData to improve UX.
tags: Nuxt, Vue, Javascript
//cover_image: https://direct_url_to_image.jpg
---

{% embed https://www.youtube.com/watch?v=bhjwGTVwEpc %}
Pattern for Git commits
Tags: beginners, programming, productivity, discuss
Published: 2022-03-15 12:36:11

It's boring to write commit, but even more boring is not knowing where that change happened.

Many of you may have already uploaded at least one commit to a github repository, but as not every junior is committed to open source to take inspiration as they do, maybe you've made commits without any pattern in the message. totally normal.

In my case I also do this from time to time, in the projects I want to commit quickly. Now in a project with several devs it's much easier by the title of your commit to know what it's about, standardizing this first interaction with the new code then becomes a must-have.

**Is there an industry standard?**
Look, each team chooses how they do it, there are people who use cute icons, there are people who go through the previous projects they worked on, but I use and recommend ConventionalCommits.org, based on that structure you're ready to send code to the whole world.

The structure is very simple, as follows:

<type>[optional scope]: description

Just looking at this cake recipe may seem abstract to some, so let's put it in real examples:

**Commit with new feature**.
- feat: "Add payment methods to xyzUseCase"

**Commit with bug fix.**
I've never seen a developer not have doubts about this one, because in our minds we thought it should be like this "fix: "fix the something..." But the proper way would be:

- fix: "Correct the foo class method"

**Documentation commit.**
- docs: (changes to the documentation)

**Another interesting examples.**
- style: (formatting, missing semi colons, etc; no production code change)
- refactor: (refactoring production code, eg. renaming a variable)
- test: (adding missing tests, refactoring tests; no production code change)
- chore: (updating grunt tasks etc; no production code change)

That's it for today, I hope you adopt these more organized commits, after automating this routine in your development process, it becomes easier to organize your day-to-day.
Test 1
Published: 2022-03-15 12:31:35

1.Siz hozir **$HOME** papkada turibsiz. Shu papkadan chiqmasdan **Downloads** papkasi ichidagi keraksiz.txt deb nomlangan faylni qanday o'chiriladi?

To'gri javob: **rm -rf~/Downloads/keraksiz.txt**

2.Siz turgan papka ichidagi **tekst.txt** nomli faylni ichidagi kontentini terminalga chop etuvchi komanda nima?

To'gri javob: **cat tekst.txt**

3.Terminalda bugungi sana nomi **(yyy-mm-dd)** formatda papka ochish komandasi qanday?

To'gri javob: **mkdir $(date'+%Y-%m-%d')**

4. Siz hozir **~/Documents** papkasidasiz. Shu papkadan chiqmasdan **~/Downloads** papkasidagi barcha narsalarni ro'yxatini chop etadigan komanda nima?

To'gri javob: **ls~/Downloads**

5.Terminalda bugungi sanani **YYYY-MM-DD** formatda chop etish uchun qanday komanda ishlatiladi?

To'gri javob: **echo $(date'+%Y-%m-%d')**

6.Siz turgan papka manzilini chop etish komandasi nima?

To'gri javob: **pwd**

7.Joriy papkadagi **main cpp** faylini kompilatsiya qilib uni **'tayyor'** nomli faylga dastur sifatida saqlaydigan komandani yozing?

To'gri javob: **g++ main.cpp -o tayyor**

8. Joriy papkadagi **main.cpp** nomli kodni kompilatsitya qilingach **a.out** nomli fayl hosil bo'ldi. Shu a.out nomli faylni ishga tushirish komandasi qanday?

To'gri javob: **./a.out**

9. **$HOME** papkaga qanday boriladi?

To'gri javob: **cd~**

10.**C++** dasturlash tilida **using namespace std;** buyrug'ining vazifasi nima?  

To'gri javob: **Biror kodni qayta-qayta yozmaslik**

11.Joriy papkadagi **main.cpp** nomli kodni kompilatsiya qilish komandasini kiriting.

To'gri javob:**g++ main.cpp**

12. Hozirgi papkadan **bitta oldin** ga qaytish komandasini kiting:

To'gri javob: **cd ..**

13. Siz hozir **~/Dokuments** papkasida turibsiz. Shu papka ichidagi barcha fayl va papkalarni (yashirinlarini ham) chiqazadigan komandani kiriting.


 To'gri javob:**ls -a**

14. Joriy papkani **VsCode** dasturida **workspace (ishchi maydon)** sifatida ochadigan kommandani kiriting.

To'gri javob: **code.**

15. Siz turgan papkadagi barcha **papka** va **fayllar** ni chop etadigan komanda nima?

To'gri javob:**ls**
Docker Compose deploy MERN Stack
Published: 2022-03-15 12:30:23

Clone the MERN stack directory from github

```
https://github.com/sidpalas/devops-directive
```
You can make MERN stack using the blog link shown below.

```
https://medium.com/swlh/how-to-create-your-first-mern-mongodb-express-js-react-js-and-node-js-stack-7e8b20463e66
```
Edit the database file inside the MERN stack directory as shown below.

```
cd mern-docker-compose/
vim server/db/index.js


const mongoose = require('mongoose')

mongoose
    .connect('mongodb://mongo:27017/cinema', { useNewUrlParser: true, useUnifiedTopology: true })
    .catch(e => {
        console.error('Connection error', e.message)
    })

const db = mongoose.connection

module.exports = db

```
If you are deploying MERN stack in Virtual Machine, you need to change localhost to ipaddress of virtual machine (baseURL: 'http://localhost:3000/api' to baseURL:'http://ipaddress:3000/api').

```
cd mern-docker-compose/
vim client/src/api/index.js


import axios from 'axios'

const api = axios.create({
    baseURL: 'http://localhost:3000/api',
})

export const insertMovie = payload => api.post(`/movie`, payload)
export const getAllMovies = () => api.get(`/movies`)
export const updateMovieById = (id, payload) => api.put(`/movie/${id}`, payload)
export const deleteMovieById = id => api.delete(`/movie/${id}`)
export const getMovieById = id => api.get(`/movie/${id}`)

const apis = {
    insertMovie,
    getAllMovies,
    updateMovieById,
    deleteMovieById,
    getMovieById,
}

export default apis
```

Then build and run docker-compose file

```
make build
make run
```
Unit testing: Why do I write them?
Tags: javascript, testing, test
Published: 2022-03-15 12:21:22

Many companies today want developers with unit testing experience. Even though unit testing had existed for decades, some developers still don’t know how to write them. 

When I started coding as a self-taught developer, I didn’t come across unit testing, and later when I started to work with other developers, I heard few mentions. That’s when I started checking what it’s all about. 

Once I began writing unit tests I started to see the benefits.  One of the things that I like about it is that I can detect any bugs early on during the development. 
My tests start failing for the method or function if there is a bug. From the warning and error logs of the test, I can determine what went wrong and help me to fix it before I commit the code. Unit tests have increased the confidence in my code and this resulted in less number of defects getting shipped into production. 

Later I faced another problem. I was told to target a certain percentage of test coverage on all the lines of code. So I started focussing on fulfilling the requirement and found that the number of tests was increasing. I was writing tests just to cover the lines of code even for the lines that were too silly to test. I also found ways to manipulate test coverage results. Another issue was that the tests were getting complex as it was interdependent on other libraries or external files in the project. I saw that some of my tests were affecting the results of other tests. When a simple logic was updated the whole test suite failed. It became unmanageable. 

This could be the story of some developers and at this point, they would start hating unit tests and feel that it is a total waste of time writing and maintaining them. 

The problem lies in the way one writes unit tests. I realized it the hard way. 

So here is how I approach it now. 

1. Test one behavior at a time.
2. Use test doubles (mock) for external dependencies, so that the focus is on testing the function's behavior alone. 
3. Test in isolation, ie there should be no relation between tests, it should be able to run independently and give the same result as compared to running the whole test suite.
4. Focus on testing the output rather than on the implementation details. 
5. Test all conditions, i.e all if and else conditions, and with variants of inputs.
6. For discoverability write tests in the order in which it appears in the code and scope multiple tests of the same function in a block.
7. Write good test descriptions, as you have to read them later.

Keeping the above points in mind helped me write clean tests and avoid false positive results. 

There may be a different approach that you follow that helped you manage tests. If so share it in the comments.

 In the next part of the series, I would like to take you through some good and bad test code examples in Javascript unit testing.
How to Convert Figma to Code
Published: 2022-03-15 12:20:02

You can build UI faster than your competition with CopyCat, a figma plugin that turns figma to code instantly. Just copy production-ready code generated directly from Figma designs with the click of a button. It also reuses your existing components and works with mature codebases. 

## How to Setup CopyCat

(For a quick tutorial watch this video: https://www.youtube.com/watch?v=Z50x1GgJwUk)

### Step #1:
 Install CopyCat on your Figma account.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ymjpyhnrh8va1drmgbi4.png)

### Step #2:
 Open CopyCat plugin on your design. 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ie1j3clw8qgfashwzr1.png)

### Step #3
: Select the frame you want to export and code will be generated automatically. 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/toequfn072i8of9p8s1v.png)

### And That's It!
Use CopyCat to convert your Figma designs to code and build faster. It eliminates the redundant work so you can focus on the challenges. Try it here: https://www.copycat.dev/figma-code.
Career changer, my first post.
Published: 2022-03-15 12:09:33

#My first post.

I had to think about what to write for my first post and if it is even worth writing about, well we're here... so I decided to do it. 

##About me.

I am a career changer, coming from the British Army of 10 years. I specialised in telecommunications about 4 years into my career and I actually got quite savvy at it, completing all promotional qualifications and becoming the go-to instructor for teaching telecommunication courses. I enjoyed the career but as I got older I decided I wanted to do something more technical, as that is what drew me to telecommunications in the first place. 

##Lucky me. 

I consider myself to be in a very fortunate position as I was able to leave my previous profession and take on a full-time distance learning degree in cybersecurity. Wait, that's not computer science! No. I actually wanted to get into penetration testing, and coming from the army the idea of security and encryption really excited me- plus there is crossover between military telecommunications and cybersecurity, so it seemed logical. Then as I was moving through the fields of cybersecurity I decided to learn Python in an online boot camp by Colt Steele (great course!) to aide my knowledge in pen testing and eventually develop tools. Well, needless to say, I fell in love with programming. 

##Now.

Now I am studying for a Bachelors of Science in Computing and IT (Software) and I have enrolled in another online boot camp for web development. I also took on a full time job as a business analyst, which is perfect for me. It is remote, it is customer-facing, and, while it is not the most technical job, it falls under IT- so it's a start and it's my first job in IT!  

I know what you're thinking though... a full-time job, a full-time degree and an online boot camp, how? Well, determination. Sure it is going to be tough but I am prepared for it. I think if I didn't enjoy the content I was learning then I would be predisposed to quitting, but I just find it so interesting so it doesn't feel like work so much. I'm not naïve enough to think that this love will last forever (although I secretly hope it does!) and I am sure this puppy love phase will wear off but I have never been one to shy away from hard work and enjoy the challenge. 

If anyone has read this, I hope your path is going splendidly and would love to hear about it.
Create Your Open Source Ecommerce Store using Medusa and Next.js
Tags: javascript, webdev, opensource, node
Published: 2022-03-15 12:06:51

[Medusa](https://www.medusajs.com) is an open source headless commerce platform giving engineers the foundation for building unique and scalable digital commerce projects through our API-first engine.

As the Medusa server is headless, our starters serve as a good foundation for you to get coupled with a frontend in a matter of minutes.

In this tutorial, you’ll learn how to link your Medusa server to the [Next.js starter](https://github.com/medusajs/nextjs-starter-medusa). If you don’t have a Medusa server set up, please follow along the [Quickstart guide](https://docs.medusajs.com/quickstart/quick-start) to learn how you can do that.

## Create Next.js Starter

Open the terminal and use the following command to create an instance of your storefront:

```bash
npx create-next-app -e https://github.com/medusajs/nextjs-starter-medusa my-medusa-storefront
```

Now you have a storefront codebase that is ready to be used with your Medusa server.

## Link Storefront to Your Server

By default, the storefront is linked to the server at the URL `localhost:9000`. If you need to change that, create the file `.env` in the root of your Next.js starter and add a new variable:

```jsx
NEXT_PUBLIC_MEDUSA_URL=<BACKEND_URL>
```

Make sure to replace `<BACKEND_URL>` with the URL of your Medusa server.

## Update the STORE_CORS variable

By default, the storefront runs at `[localhost:8000](http://localhost:8000)` and the backend uses that URL to avoid CORS errors. If you need to change the URL or port, in `.env` file in the root of your Medusa Server add the following new variable:

```jsx
STORE_CORS=<STOREFRONT_URL>
```

Make sure you replace `<STOREFRONT_URL>` with the URL to your storefront.

## Start your Store

To start your store, first, you need to run the Medusa server. In the directory that holds your Medusa server run the following:

```bash
npm start
```

Then, in the directory that holds your Next.js storefront, run the following command:

```bash
npm run dev
```

Now, open the storefront at `[localhost:8000](http://localhost:8000)` (or the URL/port you specified) and you’ll see your store and the products!

![Storefront Home Page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mhn0wtm3vwji9djw9t5l.png)

![Storefront Product Page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h5jn8baymimpwlhki7ds.png)

## Conclusion

Hooking up your headless ecommerce server with the storefront is very easy using Medusa! You can now have your entire server up and running with the products, cart, and checkout functionalities.

If you want to discover the endless possibilities of Medusa’s ecosystem you can find a lot more useful resources on [our docs page](https://docs.medusajs.com) which can help you to build your awesome commerce project!

> Should you have any issues or questions related to Medusa, then feel free to reach out to the Medusa team via [Discord](https://discord.gg/F87eGuwkTp).
WSL2/WSLg使用snap store
Published: 2022-03-15 11:57:45

更多會員限定文章可以到[patreon觀看](https://www.patreon.com/wade3c)

-----

# WSLg + Snap

如果清除/snap後還是不能mount的話

可以參考以下流程

![image.png](https://res.craft.do/user/full/71bea674-0503-893e-0a7a-91e236797ff9/doc/98dbadba-871f-4000-bd1d-d1d0b5250251/dc8eb3df-31ef-4b4f-873b-9925ce531563)

Error原因, 要mount的lzo格式在snap 2.47前不支援

![image.png](https://res.craft.do/user/full/71bea674-0503-893e-0a7a-91e236797ff9/doc/98dbadba-871f-4000-bd1d-d1d0b5250251/32e3df16-2e0b-4174-abc9-be6efaa782b5)

所以要先來更新snap, `sudo apt upgrade snap`

![image.png](https://res.craft.do/user/full/71bea674-0503-893e-0a7a-91e236797ff9/doc/98dbadba-871f-4000-bd1d-d1d0b5250251/7e16f44a-37c0-4d0e-9cc6-dc40b81e5be1)

更新到2.51後再嘗試安裝

如果遇到hook失敗可以先清除/snap

![image.png](https://res.craft.do/user/full/71bea674-0503-893e-0a7a-91e236797ff9/doc/98dbadba-871f-4000-bd1d-d1d0b5250251/a620f75d-f3d8-4ed1-a8d5-7f84fa2e7d9c)

如果清除/snap無效, 重裝最快

```shell
sudo apt-get purge snapd snap 
sudo apt-get install snapd snap
```

之後就可以正常安裝了

![image.png](https://res.craft.do/user/full/71bea674-0503-893e-0a7a-91e236797ff9/doc/98dbadba-871f-4000-bd1d-d1d0b5250251/59b48f75-b66d-4112-8799-6627032c5a35)

正常的snap list應該長這樣, 不該混到1804的內容

![image.png](https://res.craft.do/user/full/71bea674-0503-893e-0a7a-91e236797ff9/doc/98dbadba-871f-4000-bd1d-d1d0b5250251/0bd72356-8869-418a-ac05-4579d74e6625)