teleren/devto huggingface dataset:
i need someone to talk to
Published: 2022-02-27 13:17:45

Online Dating gets a lot of flak from detractors because they consider it less safe than meeting other people in real life. The primary reasoning for their distrust is that unlike real world dating, where your date is probably introduced by someone you know and trust, dates you met through the Internet are totally anonymous, and rarely has anyone vouch for them. Fortunately, this safety issue is only a misleading case of people's expectations. You cannot be physically hurt or harmed by someone online, and you are very safe sitting in front of your computer as you get to know other people. Following these rules of online dating makes it significantly safer than meeting a person in a local bar or restaurant.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2pp13qb1q5jaax3bgm8w.jpg)

1.) Don't immediately give out sensitive information. In order to keep online dating safe, you need to know if your date can be trusted before [i need someone to talk to](https://talkwithstranger.com/free-chat-rooms/talk-to-someone) letting him get close to you. You need to know what question to ask when dating online, or try to find out info about him first. There are various ways you can know each other without meeting them face to face first or inviting them to your apartment.

2.) Don't accept invitations to blind dates. This is very dangerous, and without any trusted person vouching for your date's credibility, there is no way you can be sure that he isn't a criminal or malicious individual. A good person wouldn't mind being asked a sensitive question when dating online. If he refuses to answer, drop him immediately.

3.) Be careful when exchanging photos. Don't send out pictures first. Always ask for a trade. And when sending your photo, don't send out pictures that are too old, since that may give them unnecessary expectations, but don't send out pictures that are too recent, which may be used in stalking. Don't send out pictures of yourself that may give away the location of your house or your place of work.

4.) Try not to have too high of an expectation. This is where the picture of your date comes in handy. If you have no face to associate with your date, chances are you may over embellish his features and construct a physical appearance that will be impossible to live up to. Don't set yourself up for a disappointment.
Intro to OpenPyXL (Automate Excel with Python)
Tags: python, automation, programming, tutorial
Published: 2022-02-27 13:05:11

You all must have worked with Excel at some time in your life and must have felt the need for automating some repetitive or tedious task. Don’t worry in this course we are going to learn about how to work with Excel using Python, or automating Excel using Python. We will be covering this with the help of the Openpyxl module.

Openpyxl is a Python library that provides various methods to interact with Excel Files using Python. It allows operations like reading, writing, arithmetic operations, plotting graphs, and many other Excel operations.

This module does not come in-built with Python. 
So whenever you will create a project, an I recommend creating a virtual environment always, you will install using 
pipenv install openpyxl
but if you want to install the module globally, you then can 
pip install openpyxl 
or pip3 install openpyxl if you're on mac or linux.

This video will explain in 30 min the basics and what's possible to do with OpenPyXL module to automate your Excel work with Python.

{% youtube hFDrWvDOYFA %}

Happy coding, lads
Understand n dimension array with real life examples
Tags: beginners, tutorial, computerscience
Published: 2022-02-27 12:51:38

# Scenario 
You are/were struggling with one of these terms: nested array, high dimension, n dimension array, ... Probably you have tried to visualize an n dimension array and got stuck at 3 dimension or even 2.

# The simple way to **understand**
You don't need to visualize it. You just need to know that an n dimension array is a group of groups ... (many "of groups"). 

Let start with 1D array. 1D array is a group of values `[1, 2, 3]`. 2D array is a group of 1D groups `[[1, 2, 3], [1, 2, 3]]`. 3D array is a group of 2D groups `[[[1, 2, 3], [1, 2, 3]], [[1, 2, 3], [1, 2, 3]]]`. 

An n dimension array is also just a 1D array whose values are organized into groups. This is 1D array `[1, 2, 3, 4, 5, 6]`. Now we will group 123, and 456. By doing that, it becomes 2D array `[[1, 2, 3], [4, 5, 6]]`. Now we put each value into a group. As a result, 3D array is made `[[[1], [2], [3]], [[4], [5], [6]]]`.

Every array has a very important attribute called `shape`. A shape is a set of the number of groups/values in each dimension (ordered from the highest dimension to the lowest one). Let visit the previous example. 1D array has 6 values or shape `(6)`. 2D array has 2 groups, each group has 3 values. In other word, its shape is (2, 3). That 3D array has shape `(2, 3, 1)`.

# Real life example 1: A book
A book is a 5D array of letters whose shape is `(c, p, s, w, l)`. A book has C chapters. Each chapter has P paragraphs. Each paragraph has S sentences. Each sentence has W words. Each word has L letters.

# Real life example 2: A library
A library is a 7D array of letters. A library has G genres. Each genre has B books. And so on.
IIFE in JavaScript
Tags: javascript, webdev, tutorial, beginners
Published: 2022-02-27 11:15:21

You might be familiar with functions in JavaScript. An IIFE (Immediately Invoked Function Expression) is a special type of function which is invoked implicitly.


Even if you don't invoke it in your code, it will run on it's own. You can relate it with a callback function which is automatically called when a particular event is fired.

```js
(function () {
    console.log('IIFE')
})()
```

You can also define an [arrow function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions) as an IIFE.

```js
(() => {
    console.log('IIFE')
})()
```

You might be wondering, well what's the use of this type of function? This same thing can be done like this:

```js
function func(){
    console.log('IIFE')
}

func()
```

Well, here's the catch. When we define a global variable in JavaScript, it can be accessed from anywhere in our code. For example,

```js
var b = 10

function print(){
    b = 8
    console.log(b) // output: 8
}

print()

console.log(b) // output: 8
```

In the above code, the value of the variable `b` is modified from `10` to `8`. But what if we don't want to modify the value of the global variable `b`. What can we do?

One thing we can do is to initialize a new variable `b` inside the scope of the function `print()` just like this:

```js
var b = 10

function print(){
    let b = 8
    console.log(b) // output: 8
}

print()

console.log(b) // output: 10
```

We were able to create a new variable inside the scope of the function without actually modifying the actual global variable.


But, there's another way! Let's say you don't want to reuse the function `print()` and also you don't want to create a mess with global variables unintentionally. In that case, you can use an IIFE. Here's how you can do that :

```js
var a = 8;

((a) => {
    a = 9; // modifying the copy of 'a'
    console.log(a); // output: 9
})(a) // passing a copy of variable as an argument

console.log(a) // output: 8
```

In the above example, we are passing the value of variable `a` to the IIFE. Remember that we are only passing a copy of the variable, so we are not actually modifying the global variable. This is most useful when you are dealing with multiple files which are being imported and exported in your project and you don't know the name of every global variable defined.


An IIFE is a function which does it's own thing without affecting things on a global level.


You can also make an IIFE asynchronous.

```js
(async () => {
    const get = await fetch(url)
    // do something
})()
```

That was a brief look at IIFE. I hope you got some idea of what's IIFE and how we can use it. If you want to dig deeper, [check this out](https://web.archive.org/web/20171201033208/http://benalman.com/news/2010/11/immediately-invoked-function-expression/#iife).


Signing off.

> This post was originally published in [Syntackle](https://syntackle.live/blog/iife-in-javascript-XC6A0qHlZMh8Gts_MaDg/)
Crop a picture automatically with a fixed ratio - Python example
Tags: python
Published: 2022-02-27 11:21:55

There is a large number of occasions where you have to crop a picture selected by the user of a website.

I have already made an article on [how to manually crop a picture with JavaScript](https://dev.to/flynestor/crop-a-picture-and-upload-it-to-the-server-with-vuejs-1p8l).

In this article I will show how to automatically crop a picture with Python in the back-end. This code allows automatic video creation from a text and a picture on my website **[rollideo.com](https://rollideo.com/)**.

In this example the cropped picture will have a fixed ratio of 16:9. The user can choose a picture of any ratio as an input. The output will always be 16:9.

I have decided to offer a centered crop as a first option because usually the most interesting part of a picture is in the center. A more sophisticated code can detect faces or other parts in a picture. You can also add the option to crop on one specific corner or other crop possibilities.

```
#This code will automatically crop the picture to a ratio of 16:9.
from PIL import Image

with Image.open(path_file_temp) as image:
    width, height = image.size
    if width/height == 16/9:
        if width != 1280:
            image_crop = image.resize((1280, 720))
        else:
            image_crop = image
    elif width/height > 16/9:
        offset  = int(abs(width-16/9*height)/2)
        image_crop1 = image.crop([offset,0,width-offset,height])
        image_crop = image_crop1.resize((1280, 720))
    else:
        offset  = int(abs(9/16*width-height)/2)
        image_crop1 = image.crop([0,offset,width,height-offset])
        image_crop = image_crop1.resize((1280, 720))

    file_source = random_id + '.png'
    path_file_crop = os.path.join(UPLOAD_FOLDER, file_source)              
    image_crop.save(path_file_crop, format="png")


```
**A warning about Pillow**
Pillow is using External Libraries to process the different format of images (.jpg .png .webp etc).

To test the image processing code, you have to make a test with all the format of image that you want to allow. If **Image.open** failed it's probably because there is some missing external libraries.

For more details, see [the Pillow installation guide](https://pillow.readthedocs.io/en/stable/installation.html).

Once the tests are done with the different formats allowed, you should list the allowed image format in the user guide, and also add warning messages "The image format X is not supported".
27/2 - Packages, Packages, Packages (& snake)
Tags: umbraco
Published: 2022-02-27 11:15:16

I had a package update frenzy this week, release 6(six) package updates. [uSync(v9.2.0)](https://github.com/KevinJump/uSync/releases/tag/v9.2.0), [uSync.Complete(v9.2.0)](https://github.com/Jumoo/uSync.Complete.Issues/releases/tag/v9.20), [uSyncTriggers](https://github.com/KevinJump/uSyncTriggers/releases/tag/v9.0.0), [Translations Manager v9.0.5](https://github.com/Jumoo/Jumoo.TranslationManager.Issues/releases/tag/v9.0.5), [BackOffice Themes](https://our.umbraco.com/packages/backoffice-extensions/backoffice-themes/) and [Maintenance Manager](https://github.com/KevinJump/Our.Umbraco.MaintenanceMode/releases/tag/v3.0.0). So that took up quite a bit of my time, but now everything is shiny :star: again.

--- 

Maintenance mode is fun because it [uses middleware to intercept the requests](https://github.com/KevinJump/Our.Umbraco.MaintenanceMode/blob/v9/dev/Our.Umbraco.MaintenanceMode/Middleware/MaintenanceRedirectMiddleware.cs) and [delivers its templates to Umbraco via a Razor class library](https://github.com/KevinJump/Our.Umbraco.MaintenanceMode/pull/22). 

The middleware stuff is really interesting and I am wondering what cool uses we can put that too elsewhere (uSync.Complete for example uses middleware to increase the `MaxRequestSize` on certain api calls). 

[Razor class libraries](https://docs.microsoft.com/en-us/aspnet/core/razor-pages/ui-class?view=aspnetcore-6.0&tabs=visual-studio) are probably the future of Umbraco package deployments - we just have to work out how (there is [a uSync branch that would deliver the files via a RCL](https://github.com/KevinJump/uSync/tree/v9/RazorClassLib/uSync.Assets), once I've tested it a bit more. it might become the release).

---

I've also started poking around with Umbraco 10 (very early dev stages) mainly to get [a heads up on any breaking changes](https://our.umbraco.com/download/releases/1000) that may effect packages, so far not many, but I haven't looked at [the impact of the moving of IScopeProvider](https://github.com/umbraco/Umbraco-CMS/pull/11859) yet. 

---

Teaching code to the boy having gone through the [Unity Learn](https://unity.com/learn), and [Learn dotnet](https://dotnet.microsoft.com/en-us/learn) sites in the last few years we've circled back on to the [Coding Train youtube channel](https://www.youtube.com/channel/UCvjgXvBlbQiydffZU7m1_aw). [This week we did a snake game is Javascript](https://www.youtube.com/watch?v=AaGK-fj-BAM). Game development is always fun.
The Best Browser For Developers - Blisk Browser Review 🚀
Tags: html, css, javascript, webdev
Published: 2022-02-27 11:05:02

{% embed https://youtu.be/HEA1on59F-o %}

>
Note: If you find this video to be helpful then please show me some love by dropping a **Like** on this video and by **subscribing** to my **[Youtube Channel](https://www.youtube.com/channel/UCIb8_J9lqtiWGMIOdQ5DVsg)** 😇

---

To all my **Developer** Friends, In this short video, I'm sharing with you a special browser which is built specially for **Web Developers**, **Designers**, **Testers**, etc. called **[Blisk](https://blisk.io/)** 🤯

**[Blisk](https://blisk.io/)** is a Web Browser and it allows users to test any website on multiple modern and latest devices like Smartphones, Tablets, Laptops, etc. at the same time 🔥

**[Blisk](https://blisk.io/)** is built on top of Chromium so it supports all the features of **Google Chrome** so we can call it as **Google Chrome for Developers** 🦄

---


## [Blisk](https://blisk.io/) Browser's Multi-Device Testing 😻

![Blisk Browser's Feature Demo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p1cqwui073p9oyn615zw.gif)

That's a **GIF** showcasing **Blisk Browser's** Multi-Device Test Feature. Amazing, right? 🤯

Make sure to watch the whole video posted above where I'm explaining **Blisk** Browser with a Demo which is only 3 mins long and also make sure to drop a **Like** on that video by visiting my **[Youtube Channel](https://www.youtube.com/channel/UCIb8_J9lqtiWGMIOdQ5DVsg)** 💯 

**Subscribe** to my **[Youtube Channel](https://www.youtube.com/channel/UCIb8_J9lqtiWGMIOdQ5DVsg)** to stay updated with my content ✅

---

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 Reading ❤️
Learn T-SQL Querying: A guide to developing efficient and elegant T-SQL code, by Pedro Lopes, Pam Lahoud
Tags: programming, books, database, mssql
Published: 2022-02-27 16:07:41

---
title: Learn T-SQL Querying: A guide to developing efficient and elegant T-SQL code, by Pedro Lopes, Pam Lahoud
published: true
date: 2022-02-27 11:04:13 UTC
tags: programming,books,database,mssql
canonical_url: https://siderite.dev/blog/learn-t-sql-querying-guide-to-developing-efficient/
---

Original post: https://siderite.dev/blog/learn-t-sql-querying-guide-to-developing-efficient

![Book cover](https://siderite.dev/Posts/files/SqlQuerying_637815566534693641.jpg) [T-SQL Querying](https://www.goodreads.com/book/show/45499329-learn-t-sql-querying "Troubleshoot query performance issues, identify anti-patterns in code, and write efficient T-SQL queries") is a very good overview of SQL Server queries, indexing, best practices, optimization and troubleshooting. I can't imagine someone can just read it and be done with it, as it is full of useful references, so it's good to keep it on the table. Also, it's relatively short, so one can peruse it in a day and then keep using it while doing SQL work.

What I didn't like so much was the inconsistent level of knowledge needed for the various chapters. It starts with a tedious explanations of types of queries and what JOINs are and what ORDER BY is and so on, then moves on to the actual interesting stuff. Also, what the hell is that title and cover? :) You'd think it's a gardening book.

Another great thing about it is that it is available [free online](https://www.packtpub.com/free-ebook/learn-t-sql-querying/9781789348811 "Transact-SQL (T-SQL) is Microsoft's proprietary extension to the SQL language that is used with Microsoft SQL Server and Azure SQL Database. This book will be a useful guide to learning the art of writing efficient T-SQL code in modern SQL Server versions as well as the Azure SQL Database."), from its publishers: Packt.
Factorials everywhere!
Tags: python, theweeklychallenge
Published: 2022-02-27 11:04:11

## Weekly challenge 153

[Challenge](https://theweeklychallenge.org/blog/perl-weekly-challenge-153/), [My solutions](https://github.com/manwar/perlweeklychallenge-club/tree/master/challenge-153/sgreen)

Two relatively straight forward tasks this week. Solutions are in Python only as a result.

## TASK #1 › Left Factorials

### Task

Write a script to compute Left Factorials of 1 to 10. Please refer [OEIS A003422](http://oeis.org/A003422) for more information.

### My solution

So after reading the linked OEIS page, I was really confused. However we can look at the solution to find a straight forward pattern, the difference between the digits is the factorials, that is `S(n) = S(n-1) + (n-1)!`. The OEIS list starts the list at 0, but the expected output starts at 1.

### Example

```
$ ./ch-1.py 
1, 2, 4, 10, 34, 154, 874, 5914, 46234, 409114
```

## TASK #2 › Factorions

### Task

You are given an integer `$n`.

Write a script to figure out if the given integer is factorion. A factorion is a natural number that equals the sum of the factorials of its digits.

## My solution

For this task, we start with `n` as a string. I then use `num` as the integer representation, checking that the value is not a negative. Then it is a matter of using `sum(math.factorial(int(x)) for x in n)` to compute the sum of all factorials of the digits/ Finally compare that figure with `num` and print `1` if they are the same or `0` otherwise.

### Examples

```
$ ./ch-2.py 145
1

$ ./ch-2.py 123
0
```
Day 34/100 Java
Tags: 100daysofcode
Published: 2022-02-27 10:58:25

Another Section Down

Day 34/100

**Language:**
JAVA

**Time Period Spent:**
1 hrs

**Course Taken:**
Udemy: Java Programming Masterclass - Tim Buchalka

**Today's Learning:**
- Packages

- Code Challenges:
	- Interface
	- Inner Class

**Additional Notes:**
Today I experience packaging up classes. Now I understand the usability of packing classes and converting them into packages. This allows use to be able to implements the D.R.Y methods. Dont repeat yourself. Packages allows use to reuse code, this lessens the error amount and allows use to continue with creating solutions without the need to rewrite methods to do a particular task constantly.
Data not getting fetched into service. Unable to subscribe in other components. I am stuck and this is urgent :(
Tags: typescript
Published: 2022-02-27 10:48:22

UserService.ts

```private APIUrl: string = environment.APIUrl;
  constructor(private inService: API,
    private httpClient: HttpClient) { }

  private _userDataDashboard$ = new ReplaySubject<UserDetailsDashboard>(1);


  getUserDetailsSubject(): Observable<UserDetailsDashboard> {
    return this._userDataDashboard$.asObservable(); 
    
  }


  refreshUserData(): Observable<void> {
    
      const headers = new HttpHeaders()
        .set('Authorization', 'Bearer ' + localStorage.getItem(AppConstants.TOKEN));
    return this.httpClient.get<any>(this.APIUrl, {headers: headers}).pipe(
      tap((response: any) => {
        // notify all subscribers of new data
        this._userDataDashboard$.next(response.data );
        
      })
    );
  }```

I have called this function in a section where the user submit details: Profile.ts

```submitBasicDetails(basicDetails: {}) {
    this.isLoading = true;
    this.inService.submitBasicDetails(basicDetails).subscribe(
      (response: any) => {
        this.userService.refreshUserData();
       
 )}```

When I am calling a parameter of fullName in Dashboard.html, it does not reflect

```<h1>Hi {{data.firstName}}</h1>```

  
Please help me identify the error.
Creating Different Default Value Sets for an F# Record Type
Tags: beginners, fsharp, dotnet, programming
Published: 2022-02-27 10:23:26

The purpose of this post is to provide you with a simple working example of creating different default value sets assigned to a particular `record type` in `F#`. It then demonstrates how to update selected fields when binding that default to a new variable using the `with` [keyword](https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/copy-and-update-record-expressions).

The benefit of this approach is that the `record type` remains `immutable`. Record types do not support the `DefaultValueAttribute` so it would mean not needing to go out of your way to create a `class` with `mutable` [explicit fields](https://docs.microsoft.com/en-gb/dotnet/fsharp/language-reference/members/explicit-fields-the-val-keyword).

Below is an example of a Meal `record type` with two different value bindings, one named `defaultBreakfastMeal` and the other `defaultDinnerMeal`. There is nothing syntactically different between a regular binding of a `record type` and one we choose to use as a default.  

**Record Type & Default Sets**
```c#
type Meal = { 
      Food: string
      Drink: string }
          
let defaultBreakfastMeal: Meal = {
      Food = "Pastry"
      Drink = "Coffee" }
      
let defaultDinnerMeal: Meal = {
      Food = "Shepherd's Pie"
      Drink = "Water" }
```

We can later set a new binding but update the returning default values with selected overrides. In this case, the `Food` value.

```c#
let HangoverMeal = {
    defaultBreakfastMeal
    with
        Food = "Irish Breakfast"
}
```
**Output**
```console
HangoverMeal.Food = "Irish Breakfast"
HangoverMeal.Drink = "Coffee"
```