teleren/devto huggingface dataset:
My first post
Tags: beginners
Published: 2022-04-16 12:23:24


# HAYOT KITOBIMNI BEHOS VARAQLAB...

## **Zulfiya** 
### *she'r*
Hayot kitobimni behos varaqlab,
Men o'tgan umrga achinmay qo'ydim.
Tabassum o'rnida kuldim charaqlab,
Suyish kerak bo'lsa telbacha suydim.

```cpp 
cout << "bu nima uchun kerakligini tushunmadim">>
```

`Reklama huquqi asosida`

[mening linkim] (https://t.me/hilolaodiljonova/)

{% embed https://youtu.be/gHopaPRA_Lw %}
My first post
Tags: beginners, firstyearincode, uzbek, wecoded
Published: 2022-04-16 12:17:36

# HELLO WORLD
### My name is Mohira and i'm 21 years old
#### Currently i'm a student at UzSWLU and my major is Spanish language
####Learning new languages is my hobby and I can speak in:
- uzbek
- russian
- english 
- spanish 

You can also join to my instagram [join](https://www.instagram.com/_mohira20/)
Book Club: "Test Driven Development: By Example" #4
Tags: books, tdd, discuss
Published: 2022-04-16 09:54:48

---
title: Book Club: "Test Driven Development: By Example" #4
published: true
description: A chapter by chapter discussion of "Test Driven Development By Example" by Kent Beck
tags: books, tdd, discussion
series: Book club TDD By Example
---

## Chapter 4: Privacy

A benefit of TDD is having tests which document code behavior; this chapter starts by adapting an existing test to make it "speaking". We change our assertion to be based on an object _of a particular value_ rather than a value separated from it's context and, at the same time inline some noisy declarations.

I like to use the IDE to help me refactor, so inlining the 'actual result' declaration for my `AssertEquals` comparison using the shortcut [`⌥ ⌘ N`](https://www.jetbrains.com/help/idea/inline.html) (mac) / `Ctrl+Alt+N`(windows) is a joyful thing to do!

> An assertion of truth, not a sequence of operations

You will only have tests which document the code if you write them in such a way they are clearly understood. As you build functionality your test suite can be improved upon, but there is inherent risk in changing tests. Relying on the TDD process should give some confidence in moving forward whilst keeping the tests green. 

And with regards to privacy...? The code change in this chapter allows us to make a `public` instance variable `private`.

🔎 View my code-along repo at https://github.com/ruthmoog/test-driven-development-by-example 

-----

![Book cover](https://learning.oreilly.com/library/cover/0321146530/250w/ ) Kent Beck's "[Test Driven Development: By Example](https://www.oreilly.com/library/view/test-driven-development/0321146530/)" was released in 2002. The book aims to explain how to use TDD to write quality code that works.
How to validate multiple schemas for the same field with Yup?
Published: 2022-04-16 12:10:58

For someone used to working with Joi, this syntax is something I'm very familiar with:

```ts
  title: Joi.alternatives().try(
    Joi.string(),
    Joi.object(SchemaObject)
  )
```

But unfortunately it is not supported in Yup out of the box.
So, I figured out a way to make this work.

First, we need to add a new method to Yup:

```ts
yup.addMethod(yup.MixedSchema, "oneOfSchemas", function (schemas: Yup.AnySchema[]) {
  return this.test(
    "one-of-schemas",
    "Not all items in ${path} match one of the allowed schemas",
    (item) =>
      schemas.some((schema) => schema.isValidSync(item, { strict: true }))
  );
});
```

Then, we can use it as follows:

```ts
title: yup
  .mixed()
  .oneOfSchemas([
    yup.string(),
    yup.object().noUnknown().shape(SchemaObject2),
  ]);
```

That's all!
Announcing the Community Showcase
Tags: unrealengine, pixelstreaming, metaverse, gamedev
Published: 2022-04-16 11:53:33

---
title: Announcing the Community Showcase
published: true
description: Featuring great projects across the community.
tags: unrealengine, pixelstreaming, metaverse, gamedev
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pyhokuumn12rgeiqinl5.jpg
canonical_url: https://make.live/blog/announcing-the-community-showcase
---

We've just added our new [Community](https://make.live/community) page where we'll be showcasing some amazing experiences from artists and creators across the community. Anyone on any device can try out each one to see the power of Unreal Engine Pixel Streaming for themselves. Each session is limited to five minutes so that everyone can enjoy them.

Have a stroll around [Dekogon Studios' Art Gallery](https://launch.make.live/make-live/art-gallery) or walk around [MonkeyRED's Restaurant](https://launch.make.live/make-live/restaurant). One day, hopefully we can go for a swim in the tempting swimming pool out back! Whatever you do, make sure you don't miss the incredible [Pirate Island by Darchall Studio](https://launch.make.live/make-live/pirate-island). If you're on desktop, press "P" on your keyboard and sit back for a full flyover of the island! 🏝

We're hoping to add lots more entries in the coming weeks and if you have a project you'd like to get featured then feel free to [submit the project to us](https://docs.google.com/forms/d/e/1FAIpQLSfK66NCjZVzp8jzUa4k-i5-PNTJoSBnflhReXqRFiDMjmh8QA/viewform?usp=sf_link).
Introducing Make Live
Tags: unrealengine, pixelstreaming, metaverse, gamedev
Published: 2022-04-16 11:47:18

---
title: Introducing Make Live
published: true
description: Worlds where everyone can play.
tags: unrealengine, pixelstreaming, metaverse, gamedev
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ew96clj1ckafqzjoh8rd.jpeg
canonical_url: https://make.live/blog/introducing-make-live
---

At Make Live we believe that Pixel Streaming should be available to all.

The ability to quickly and easily to show a complex scene using the power of Unreal Engine in the browser is a game-changer. From an indie game developer getting feedback on their game by a friend to a real estate developer showing prospective buyers around a new home, the possibilities are endless.

Setting up Pixel Streaming requires some specialist knowledge and can come at considerable cost. At Make Live we've done all the hard work so that all you need to do is upload your built project from Unreal Engine and you can be using it in the browser from any device in no time!

At the moment you can run your projects on one of three excellent graphics cards with Make Live. We only use consumer graphics cards you'd expect to find in any normal gaming PC:

- NVIDIA GeForce™ GTX 1080 Ti
- NVIDIA GeForce™ RTX 3080
- NVIDIA GeForce™ RTX 3090

To see how easy it is to package and deploy your project check out our YouTube video:

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

Make Live is currently in closed beta and you can get access by dropping us a message on Twitter, Live chat or using this [form](https://forms.gle/sEohjD263whaipSA7). It's currently free to use whilst we are in this stage but our intended pricing is on the [site](/#pricing). You can make your project public or private as well as controlling how many users can access your project at any time. We have some great features in the near future and beyond such as:

- **Project versioning** - keep your old builds and go back and launch any version at any time.
- **Guest invite links for private projects** - invite other people into your project for a limited time.
- **User controls in a multi-user session** - show everyone else your favourite part of the project!
- **Pixel Streaming commands/events** - send Pixel Streaming commands and events back into the Unreal project and vice versa to enable unlimited customisation and metaverse applications.

At Make Live we think this is just the beginning of what is possible with this technology and we're excited to see where it goes. We've got big plans for what we want to do and how we want to build on this technology and we'd love for you to join us!
How to communicate between an iframe and the parent page
Tags: html, javascript, iframe
Published: 2022-04-16 11:27:14

## From parent page -> iframe

In the parent page:

```js
const iframe = document.getElementById('iframe');
iframe.contentWindow.postMessage('some message', '*');
```

In the iframe:

```js
window.onmessage = function(e) {
  if (e.data === 'some message') {
    alert('It works!');
  }
};
```

## From iframe -> parent page

In the parent page:

```js
window.onmessage = function(e) {
  if (e.data === 'from iframe') {
    alert('It works!');
  }
};
```

In the iframe:

```js
window.top.postMessage('from iframe', '*')
```

[Source](https://stackoverflow.com/questions/9153445/how-to-communicate-between-iframe-and-the-parent-site)
Heroku's GitHub integration has been stopped due to attack. Are you affected?
Tags: devops, webdev, github
Published: 2022-04-16 11:25:24

This morning heroku blocked *all* github integrations 'until further notice' (see the note [here](https://status.heroku.com/)).

This means that users can't deploy new features to heroku via automatic deployments. I only found this out after an email was sent at 4am this morning informing me of this. 

I am now fully understanding the impact. 

When I push features to Github, there is an automatic deployment to Heroku. This returned an error of `unauthorised`. I went to the Heroku dashboard and saw I needed to reconnect my Github. Odd I thought.So I disconnected and tried to reconnect but then I get an internal error. Brilliant.

So now 'until further notice', I am unable to deploy any new features to my heroku app. There is a suggestion to deploy directly via git but that is a big work around to set up the heroku remote and use heroku instead of Github. 

Surely I'm not the only one affected. Anyone else having these issues?

[Update] Upon further research, Heroku has blocked current github tokens and any created ones to protect against future attacks at the moment. It was noticed an attacker had stolen some Github access tokens to get private repos on github. To protect all users this integration between github and heroku has been stopped until this has been fixed. Please read more at: 
https://github.blog/2022-04-15-security-alert-stolen-oauth-user-tokens/
BPO Services | BPO Process Outsourcing Company
Tags: bposervices, callcenterservices
Published: 2022-04-16 11:20:12

Being excellent with the [BPO services](https://www.ascentbpo.com/bpo-services) our company is goal-oriented that takes care of everything a customer requires. We have designed our BPO process outsourcing services in an efficient way that removes all the barriers related to language, culture, and time zones. Our executives from anytime and anywhere can opt for our services that complete that demand in a professional way.   
 
To run the business smoothly it becomes important to take outside help which is reliable, constant with work, and well experienced. To execute the main duties in the business BPO outsourcing has become an essential part.
 
What is BPO process outsourcing?
 
It is the services provided by the third party organization that includes standard business functions. The function of the BPO outsourcing services includes accounting, customer service, payroll, and human resource management. The third-party works for a particular task such as payroll management that transfers the cost savings to their customers.
 
How BPO and call center are different things?
 
The BPO services come with more task than a call center. Call center services are specific to customer care service when the manufacturer contacts them but BPO services provide customer services, accounting, administrative tasks, and outsourcing payroll. BPO task is bigger than the call center and therefore makes them two different areas of outsourcing.

Read More: [https://www.ascentbpo.com/bpo-services](https://www.ascentbpo.com/bpo-services)
How to impersonate a user through Django management shell
Tags: django, session, cookie, user
Published: 2022-04-16 11:17:09

---
title: How to impersonate a user through Django management shell    
published: true
description: 
tags: django, session, cookie, user
---

In a hypothetical scenario where you have access to the underlying system, there has to be a way to impersonate any given user that signed up on for your Django application.

It is however not as trivial to achieve this. There are packages like `django-hijack` etc., which provide this functionality, but we'd like to achieve it without installing new packages or modifying existing code. Here's a simple, non-intrusive way to go about it on a live environment.

## Approach

First, you need to login into your Django application with any other account that you have access to. Visit the cookies tab in your development tools and copy the `sessionid` cookie value. It should look something like this: `wxc0ldhcis45md5hbr3l7r4pyhewo0mr`.


Then, on the system where Django server is running, access the Django management shell:

```
python manage.py dbshell
```

Then do the following:

```python
# Import the required interfaces
from django.contrib.sessions.models import Session
from boltobserver.users.models import User # This will be different for you, depending on where your User model is
from django.contrib.sessions.backends.db import SessionStore

# Find the user you wish to impersonate
u = User.objects.filter(email="someone@something.com").first()

# Find the session you are currently using in your browser
s = Session.objects.filter(session_key = "wxc0ldhcis45md5hbr3l7r4pyhewo0mr").first()

# And finally, modify the session by binding it to your target user
# _auth_user_backend might be different for you, check settings.AUTHENTICATION_BACKENDS for the right value
s2.session_data = SessionStore().encode({"_auth_user_id": str(u.id), "_auth_user_backend": "allauth.account.auth_backends.AuthenticationBackend", "_auth_user_hash": u.get_session_auth_hash()})
s2.save()

```

After refreshing the page, you should be logged in as your desired user.

Thanks for reading!
Great Free CSS Grid Course by Mozilla & Wes Bos 😻🔥
Tags: webdev, css, html, javascript
Published: 2022-04-16 11:13:01

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

In my latest **[Youtube Video](https://youtu.be/H3mSdFY_BXg)**, I'm sharing information regarding this great **Free CSS Grid Course By Mozilla & Wes Bos** for you to learn and master **CSS Grid** 🤯

Make sure to watch the **[Youtube Video](https://youtu.be/H3mSdFY_BXg)** and also make sure to **Like** the **[Youtube Video](https://youtu.be/H3mSdFY_BXg)** & **Subscribe** to my **[Youtube Channel](https://www.youtube.com/channel/UCIb8_J9lqtiWGMIOdQ5DVsg)** for more **Amazing** content related to **Web Development** and **Self Taught Developer** Journey 🙌

---

Please do me a favour by **Reacting** to this post with 
❤️ + 🦄 and also bookmark 🔖 it for your future reference ✅

---

**Connect/Follow** me on Social platforms like Twitter, Linkedin where I regularly post Tips💡+ Guides📜 + Resources 🌟 related to Web Development and Programming 👨‍💻


![RammCodes Social Follow Request Banner](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8a5vzbe9atsgmoll0oih.png)

### 🐦 **[My Twitter](https://twitter.com/rammcodes)**
### 👨‍💼 **[My Linkedin](https://www.linkedin.com/in/rammcodes/)**
### 🌐 **[My Website](https://rammaheshwari.com)**

---

Press the **Follow** button to stay updated with my content 🚀

Thanks for your **Support** ❤️
Using GitHub Actions to push changes
Tags: github, git, bash, todayilearned
Published: 2022-04-16 11:10:55

We can use [GitHub Actions](https://docs.github.com/en/actions) to push a new commit each time there is a new change detected. 

I've recently had to do this to automate updating `README.md` with a listing of the repository files each time a new push has been detected. The GitHub workflow is found [here](https://github.com/petermekhaeil/til/blob/master/.github/workflows/update.yml).

Here are the learnings that may come useful to others:

## Using bash to clear file content

```bash
cat /dev/null > README.md
```
`/dev/null` is a pseudo file in Linux that has no output so we can override a file with this empty content.

## Using bash to echo a string with new line

```bash
echo -e '# Today I Learned\n' > README.md
```

`-e` is required to escape backslashes. This allows us to print new line (`\n`) when outputting to a file.

## Using bash to read the first line of a file

```bash
head -n 1 $filename
```

## Using bash to remove characters from a string

```bash
echo '# Title' | sed 's/# //'
```

`sed` is short for `Stream EDitor` and one of its common uses is pattern replacement. The above will remove `# ` from the string (by replacing it with an empty string).

## Using bash to append string to file

```bash
echo 'My string' >> README.md
```

The `>>` operator is used to append to a file (or create the file if it does not exist).

## Using GitHub Actions to push changes to a repository

[actions/checkout](https://github.com/actions/checkout) is an offical GitHub Action that can checkout a repository. We can also use this to [push changes back](https://github.com/actions/checkout#Push-a-commit-using-the-built-in-token).

```yml
on: push
jobs:
  update:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - run: |
          # Clear README.md
          cat /dev/null > README.md

          # Add Title
          echo -e '# Today I Learned\n' > README.md

          # Loop through all TILs and add to README.md
          dir=./learnings
          for filename in "$dir"/*
          do
            title=$(head -n 1 $filename | sed 's/# //')
            echo "- [$title](https://github.com/petermekhaeil/til/blob/master/$filename)" >> README.md
          done

          # Push changes
          git config user.name github-actions
          git config user.email github-actions@github.com
          git add README.md
          git commit -m "Update README.md"
          git push
```


**Today I Learned**
I share what I learn on [Today I Learned](https://petermekhaeil.com/today-i-learned/).
To commit editor files or not?
Tags: webdev, git
Published: 2022-04-16 10:58:47

`.idea`, `.vscode`, `vimdc`, lots of editors produce editor files, but… should you commit them? Or is it clutter and everyone should roll their own setup?

We could sit here and weigh the pros and cons, and debate with specific files bring more value than others, but I think it's actually not necessary:

**Yes definitely commit them** (given a few sensible constraints). Why? Because if they help someone then don't stand in their way. It's much more fun and inclusive to welcome those files! Sure you may not use them, maybe you think they just clutter up the root directory and litter in commits, but if you prioritize your team member's happiness they become easier to ignore.

What constraints though?

* Keep the clutter small, e.g. if your editor produces several files can you find a way to put them all in a single subfolder?
* Avoid editor files that are constantly updating, no-one wants a commit-history dominated by editor file commits.
* If multiple people use the same editor they should explicitly agree on what files to commit. Don't commit a file if there is disagreement.

I'm purposefully sidestepping an analysis of the specific pros and cons because quite frankly I think it's more important we prioritize making the codebase a welcoming, easy place to work in. But, if you're hungry for a concrete example, I happen to use the IntelliJ editor and by committing a few project files it becomes painless to switch branches and have the project's modules stay properly configured. But really this post exists to suggest that if someone feels something helps them, then let's try to welcome that.

_Photo by <a href="https://unsplash.com/@6heinz3r?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Gabriel Heinzer</a> on <a href="https://unsplash.com/s/photos/git-files?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>_
Use Http interceptor In Angular for Every Http Request
Tags: angular, react, javascript, webdev
Published: 2022-04-16 10:55:13

sometimes we are using **HttpClient** in angular for api request to add some additional information through headers to send request to server.
first we add **HttpModule** in app.module.ts imports array.

## http.interceptors.ts

```
import { Injectable } from "@angular/core";
import { HttpInterceptor, HttpRequest, HttpResponse, HttpHandler, HttpEvent, HttpErrorResponse, HttpHeaders } from "@angular/common/http";
import { Observable, throwError } from 'rxjs';
import { map, catchError } from 'rxjs/operators';

@Injectable()

export class HttpTokenInterceptor implements HttpInterceptor {
    intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {

        const headersConfig = {
            'Accept': 'application/json'
        };
        const idToken = localStorage.getItem("token");

        if (idToken) {
            headersConfig['Authorization'] = idToken;
            let request = req.clone({
                setHeaders: headersConfig
            });
            return next.handle(request);
        }
        else {
            return next.handle(req)
        }
        // // authorization with jwt token
        // let currentUser = JSON.parse(localStorage.getItem('currentUser'));
        // if (currentUser && currentUser.token) {
        //     let request = req.clone({
        //         setHeaders: {
        //             Authorization: `Bearer ${currentUser.token}`
        //         }
        //     });
        // }

        // return next.handle(req);
    }
}
```

## api.service.ts

```
import { Injectable } from '@angular/core';
import { Observable } from "rxjs";
import { environment } from "../../../environments/environment";
import { HttpHeaders, HttpClient, HttpParams } from "@angular/common/http";
import { throwError } from "rxjs";
import { catchError, retry } from "rxjs/operators";

@Injectable({
  providedIn: 'root'
})
export class ApiService {
  httpOptions = {
    headers: new HttpHeaders({
      "Content-Type": "application/json",
      "Access-Control-Allow-Origin": "*"
    })
  };
  constructor(private http: HttpClient) { }

  private formatErrors(error: any) {
    return throwError(error.error);
  }

  get(path: string, params: HttpParams = new HttpParams()): Observable<any> {
    return this.http.get(path, { params }).pipe(catchError(this.formatErrors));
  }

  put(path: string, body: Object = {}): Observable<any> {
    return this.http
      .put(path, JSON.stringify(body), this.httpOptions)
      .pipe(catchError(this.formatErrors));
  }

  post(path: string, body: Object = {}): Observable<any> {
    return this.http
      .post(path, JSON.stringify(body), this.httpOptions)
      .pipe(catchError(this.formatErrors));
  }

  delete(path): Observable<any> {
    return this.http.delete(path).pipe(catchError(this.formatErrors));
  }
}


```
thats it developers.
V1.0.1 of dislexic released
Tags: vscode
Published: 2022-04-16 10:52:24

A new version of my Visual Code theme dislexic is available on the Visual Studio Marketplace:

[Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=SpeedyLom.dislexic-vscode)

Or directly from the GitHub repository:

[SpeedyLom/dislexic-vscode](https://github.com/SpeedyLom/dislexic-vscode/releases/tag/v1.0.1)

## Release notes

This is a bug fix release, fixing the following issues:

Changed
- Replace the active selection in the command pallet with orange
- Replace the terminal cursor with orange

Removed
- Italic formatting for comments

## Support Me

If you have used my theme and/or want to see its development continue please consider making a donation here on Ko-fi.

[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/R6R877040)