teleren/devto huggingface dataset:
SQL Select Query
Tags: sql, database, beginners, programming
Published: 2022-03-28 10:30:58

> [Sign up to my newsletter!](https://baransel.dev/newsletter/).

## SELECT Query

```sql
SELECT * FROM students
```

This command is used to query all the data in the Students table, by typing all the columns in that table instead of `*`, we get them all.

```sql
SELECT
id
,name
,surname
,quiz
,midterm
,final
,class_no
FROM students
```

We need to specify the column names with commas after the SELECT statement.

`FROM` indicates where, `*` indicates all data, `SELECT` indicates what to do with the obtained data. `SELECT` is used to select data from that table. If we write the column names specified in the table instead of `*`, it returns only the information in that column.

<img alt="Students table" src="https://baransel.dev/post/sql-select-query/students-table.png" style="height:75%;width:75%;"/>

In our example, there are `id`, `name`, `surname`, `quiz`, `midterm`, `final`, `class_no` columns in the Students table. A total of 7 data has been entered in this table. The first line shows the record with `id` 1 and name surname Baransel Arslan.

If we want to bring all the information in the `name` column in the Students table;

Continue this post on my blog! [SQL Select Query](https://baransel.dev/post/sql-select-query/).
i'm building a platform for developers to find work. suggestions?
Tags: remotejobs, work, jobs, remotework
Published: 2022-03-28 10:47:18

Hello 👋 fellow devs! 

i was frustrated with the existing ways of finding work as a developer (freelance/remote-full-time), so i started to build my own. it will be ready for its first users at the end of this week (hopefully) but there is still time to change things. i'm interested in the opinions/suggestions of the dev community (you) to make it the best it can be. 

i may share a sneak peak later, so keep an eye on my profile.

in the meantime, help me out?
How to Add a Blazor In-Place Editor to a Blazor WebAssembly App
Tags: blazor, webdev, csharp, dotnet
Published: 2022-03-28 10:27:59

A quick overview on how to create and configure the Syncfusion [Blazor In-Place Editor](How to Add a Blazor In-Place Editor to a Blazor WebAssembly App) in a Blazor WebAssembly app using Visual Studio. The Blazor In-Place Editor component is used to edit values in place and update them in the server. In this video, you will learn how to add a simple In-Place Editor component to a Blazor WebAssembly app and integrate other components like the DatePicker, TextBox, and Dropdown List. Finally, I’ll show you how to change the mode. 

Product Overview: https://www.syncfusion.com/blazor-components/blazor-in-place-editor

Explore our tutorial videos: https://www.syncfusion.com/tutorial-videos

Download this example from GitHub. https://github.com/SyncfusionExamples

{% youtube yv5TvEjdjBM %}
React, Vue and Svelte: Comparing State Management tools
Tags: javascript, react, vue, svelte
Published: 2022-03-28 10:14:27

## State management for...
### React

[Redux](https://redux-toolkit.js.org/)
[Recoil](https://recoiljs.org/fr/)

### Vue

[Pinia](https://pinia.vuejs.org/)
[VueX](https://vuex.vuejs.org/) (maintenance mode)

### Svelte
Svelte has his own store, you should rely on it
[Svelte](https://svelte.dev/tutorial/writable-stores)

## Context API in...
### React
[useContext](https://beta.reactjs.org/apis/usecontext)

### Svelte
[Context API](https://svelte.dev/tutorial/context-api)
React, Vue and Svelte: Comparing Data Rendering
Tags: javascript, react, vue, svelte
Published: 2022-03-28 10:12:08


## Data rendering in...
As you can see, every framework has his own method to loop through data.
React will use `map` method, Vue has the `v-for` method and Svelte goes full mustache syntax with `{#each}{/each}` approach.

Check it out 🚀

### React
[Link](https://stackblitz.com/edit/vitejs-vite-95tgay?file=src/App.tsx)

```jsx
import { useState } from "react";
const [jobs, setJobs] = useState([
  {id: 1, title: "Frontend Developer"},
  {id: 2, title: "Backend Developer"},
  {id: 3, title: "Fullstack Developer"}
]);

<ul>
  {
    jobs.map((job) => (
      <li>{job.title}</li>
    ))
  }
</ul>
```

### Vue
[Link](https://stackblitz.com/edit/vitejs-vite-qj1dut?file=src/App.vue)

```jsx
import { ref } from "vue";
// `reactive` could be used instead of `ref`
const jobs = ref([
  {id: 1, title: "Frontend Developer"},
  {id: 2, title: "Backend Developer"},
  {id: 3, title: "Fullstack Developer"}
]);

<template>
<ul>
  <li v-for="job in jobs" :key="job.id">
    {{ job.title }}
  </li>
</ul>
</template>
```

### Svelte
[Link](https://stackblitz.com/edit/vitejs-vite-874r4x?file=src/App.svelte)

```jsx
const jobs = [
  {id: 1, title: "Frontend Developer"},
  {id: 2, title: "Backend Developer"},
  {id: 3, title: "Fullstack Developer"}
];

<ul>
{#each jobs as {id, title}, i}
  <li id={id}>
    {title}
  </li>
{/each}
</ul>
```
Weekly 005
Tags: weeklyretro
Published: 2022-03-28 10:10:46

### Monday

Not a good day.

It should be the birthday of my mom. She passed away at the end of December and today I struggled to be focused on my stuff.

By the way, I went to the center of the town because I met my colleagues for our monthly breakfast together.

It helped to me to don’t think too much time to my mom.

### Tuesday

A morning started very well with a demo to a customer: Red Origin was the topic.
We received good feedback about the product but they are not interested.
Not because they don’t like it, but the main reason is: “it doesn’t cover our requirements”.

Good to know and we took notes about new use cases.

In the afternoon I post on my blog about the reason why I use the same theme in all of my IDE: [https://dev.to/kasuken/increasing-the-productivity-with-the-same-theme-for-visual-studio-2022-visual-studio-code-and-rider-2mg2](https://dev.to/kasuken/increasing-the-productivity-with-the-same-theme-for-visual-studio-2022-visual-studio-code-and-rider-2mg2)

### Wednesday

Nothing special.
Just worked on Red Origin.

### Thursday

On Thursday morning I delivered one of the most important session at an event of my life.
I opened the second day of the Codemotion Italian Spring Edition 2022.
I was a blast!
More than 400+ people are connected to listen me!
It was not a really deep technical session because I spoke about “What I did wrong in my last 4 years of developing product”.

After the session I got more than 120 LinkedIn connections and a lot of feedbacks in private messages.

This is the timelapse of my session.

{% embed 
https://twitter.com/kasuken/status/1507004743008223234?s=20&t=uU_y3Z8Rk3kaIEGEcxTj2Q %}

### Friday

In the morning I announced my award as Codemotion Ambassador!
You can find more details on my blog post: [https://dev.to/kasuken/i-am-officially-a-codemotion-ambassador-4ojd](https://dev.to/kasuken/i-am-officially-a-codemotion-ambassador-4ojd)
I am really honored to be a part of the first six ambassadors for this new program!

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j5xt18tesr7vf6jw1q2h.png)
 
During the day I struggled about connecting Postman to the Microsoft Graph API as an Application and tried to retrieve information about Microsoft Defender Security through the Graph.

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

<sup>Thanks for reading my blog! If you have any questions or need a second opinion with anything **Microsoft Azure**, **Blazor** or **GitHub** related, don't hesitate to contact me. I'm happy to provide my professional services through my company, SoftwareONE.</sup>
React, Vue and Svelte: Comparing destructuring Props
Tags: javascript, react, vue, svelte
Published: 2022-03-28 10:06:16


## Destructuring `props` in...
When it comes to ES6+, Object and JavaScript, you can use the destructuring method and it works the same because it is just ... well, JavaScript!

Check it out 🚀

### React
[Link](https://stackblitz.com/edit/vitejs-vite-5aebvw?file=src/app/App.tsx)

```jsx
// Parent Component
<ChildComponent {...user} />
// or
<ChildComponent user={user} />

const Component = ({id, name, lastname}) => {
  return <div id={id}>{name}{lastname}</div>
}
```

### Vue
[Link](https://stackblitz.com/edit/vitejs-vite-tty3de?file=src/App.vue)

```jsx
const props = defineProps({
  user: Object
})
let { id, name, lastname } = props.user;
<template>
<div>{{ id }} {{ name }}</div>
</template>
```

### Svelte
[Link](https://stackblitz.com/edit/vitejs-vite-uzmte2?file=src/App.svelte)

```jsx
// Parent Component
<ChildComponent {...user} />

// Child Component
export let name;
export let lastname;
export let id;

<div>{name} {lastname} {id}</div>
```
React, Vue and Svelte: Comparing how to get Props
Tags: javascript, react, vue, svelte
Published: 2022-03-28 10:05:25


## Getting `props` in...
Svelte syntax for getting prop can be kinda confusive. Svelte uses the `export` term but we are importing some prop... 
Vue has his own object method `defineProps` and React read them through the `props` object.

Check it out 🚀

### React
[Link](https://stackblitz.com/edit/vitejs-vite-5aebvw?file=src/app/App.tsx)

```jsx
const Component = (props) => {
  return props.msg
}
```

### Vue
[Link](https://stackblitz.com/edit/vitejs-vite-tty3de?file=src/App.vue)

```jsx
const props = defineProps({
  msg: String
})
<template>{{ msg }}</template>
```

### Svelte
[Link](https://stackblitz.com/edit/vitejs-vite-uzmte2?file=src/App.svelte)

```jsx
<script>
  export let msg = '';
<script>

{msg}
```
React, Vue and Svelte: Comparing how to update State
Tags: javascript, react, vue, svelte
Published: 2022-03-28 10:03:16


## Updating state in...
As explained above, React has the `setState` method. You can use it directly or wrap it in another function to update an attribute.
Svelte updates it directly as you would do with a JavaScript variable because Svelte is just a compiler!
Vue has almost the same syntax, except you access the new value with `message.value = 'new value'`

Check it out 🚀

### React
[Link](https://stackblitz.com/edit/vitejs-vite-6mfqcc?file=src/app/App.tsx)

```jsx
import { useState } from 'React';

const Component = () => {
  // state
  const [message, setMessage] = useState<string>('Hello');
  const updateMessage = () => setMessage('Hello World');
  
  return (
    <div>
      { message }
      <button onClick={updateMessage}>Update message<button>
    </div>
  )

}
```

### Vue
[Link](https://stackblitz.com/edit/vitejs-vite-zn4jq3?file=src/App.vue)

```jsx
<script setup lang="ts">
  import { ref } from 'vue'; 
  // state
  const message:string = ref('hello');
  
  const updateMessage = () => {
    message.value = 'Hello World';
  }
</script>

<template>
 {{ message }}
 <button @click="updateMessage">Update message</button>
</template>
```

### Svelte
[Link](https://stackblitz.com/edit/vitejs-vite-t5m1wc?file=src/App.svelte)

```jsx
<script lang="ts">
// state
let message:string = 'hello';

const updateMessage = () => {
  message = 'Hello World';
}
<script>

<div>{ message }</div>
<button on:click="updateMessage">Update message</button>
```
React, Vue and Svelte: Comparing TypeScript syntax
Tags: javascript, react, vue, svelte
Published: 2022-03-28 09:59:38

## If TypeScript is installed for...
### React

```jsx
// extension file:
Component.tsx
```

### Vue

```jsx
// lang="ts" to <script> tag
<script setup lang="ts"></script>
```

### Svelte

```jsx
// lang="ts" to <script> tag
<script lang="ts"></script>
```
React, Vue and Svelte: Comparing Structure Components
Tags: javascript, react, vue, svelte
Published: 2022-03-28 09:57:33

## Structure component in...
### React

[Link](https://stackblitz.com/edit/vitejs-vite-rbc4li?file=src/app/App.tsx)

```jsx
// imports
export const Component = () => {
  // logic
  // jsx
}
```

### Vue
[Link](https://stackblitz.com/edit/vitejs-vite-wcfs91?file=src/App.vue)

```jsx
<script setup lang="ts">
// imports
// logic
</script>

<template>HTML goes here</template>

<style></style>
```


### Svelte
[Link](https://stackblitz.com/edit/vitejs-vite-f7pqlu?file=src/App.svelte)

```jsx
<script lang="ts">
  // imports
  // logic
</script>

<!--HTML goes here-->

<style></style>
```

## File extension of a component in...
### React

`.jsx`
`.tsx with TypeScript`

### Vue

`.Vue`

### Svelte

`.Svelte`
Share Docker Images - without Container Registry
Tags: docker, devops, containers, development
Published: 2022-03-28 09:43:16

Generally for running a docker container we first pull the required docker image/s from a container registry(CR), for ex- Github container registry, Docker Hub registry etc. This could be a publicly available image or a private one. Similarly we can push a newly built image to these registries.

But what if we want to share an image that is currently stored in one machine to another machine or server without using a container registry.

For this solution to work we need a shared storage or access to a cloud location or a file transfer capability between two machines(ex: SCP).

---

Steps to share a Docker image:

A. On first machine, build a new docker image or pull one from a container registry.

B. Once the image is ready on first machine, save it in a .tar file in the local storage:

```
docker save -o <location-1>/image-name.tar image-name
```
C. Check if the new .tar file is saved in your local storage(location-1):

```
ls <location-1>
```
D. Share this newly created .tar file to a location which is accessible by second machine. This could be a Cloud storage location on Azure, AWS etc, or a shared directory or simply 'scp' the file if its in a same network.

E. Now save the new .tar file in <location-2> of second machine.
Once the file is available on second machine we will load the image from that .tar file using below command:

```
docker load -i <location-2>/image-name.tar
```
F. We can now check if the image is now available in the second machine:

```
docker images
```
G. Now the image has been transferred successfully in your second machine without even using any container registry.

This method works for both Linux and Windows based machines.

---


Check official Docker documentation for more information.

_Ref:
https://docs.docker.com/engine/reference/commandline/save/
https://docs.docker.com/engine/reference/commandline/load/
https://docs.docker.com/engine/reference/commandline/export/
https://docs.docker.com/engine/reference/commandline/import/_
318. 最大单词长度乘积
Published: 2022-03-28 09:42:17

题目链接🔗:[318. 最大单词长度乘积](https://leetcode-cn.com/problems/maximum-product-of-word-lengths/)

这道题可以学习的地方在于如何快速比较出两个字符串是否拥有相同的字符。举个例子，比如"aaa" 和 "bab" 这两个字符串拥有相同的字符 'a' 的，暴力的解法就是对逐个字符进行比较，如果是这样的话，这就缺失了写这篇博文的意义。

---

这里我们使用比较巧妙的方法：位运算
1. 先设定对于26个字符a ~ z，我们设定使用 0 ~ 25 代表它们，即num = x - 'a'
2. 那么对应的每个字符串，都可以由一个整数（看成二进制表示），比如 'acd' 可以用二进制1101表示
3. 如果两个字符串不包含相同的字符，那么与操作的结果一定是0，比如
'acd'用二进制表示为1101，'efg' 用二进制表示结果为1110000，比如1110000 & 0001101 = 0

4. 这样双重for循环遍历就可以找到结果，时间复杂度为O(N^2)

---

**优化**

> 为什么会有优化呢？

对于本题的第三个实例可以看出，对于如果由相同字符组成的不同长度的字符串，这样遍历很显然无用而且超时的
我们可以想到，对于由相同字符组成的字符串，他们的二进制表示一定是一样的，比如'aa' 和 'aaa'，他们表示的结果都是0000 0001
那么根据题目的要求，求 没有相同的字符 的两个字符串的最大长度乘积，只需要记录**相同字符组成的字符串长度的最大值就可以了**，这里就使用map去实现

---

代码参考如下：

```c++
class Solution {
public:
    int maxProduct(vector<string> &words) {
        int len = words.size();
        vector<int> mask(len, 0);
        map<int, string> ma;
        for (int i = 0; i < len; ++i) {
            string cur = words[i];
            int l = cur.length();
            int total = 0;
            for (int j = 0; j < l; ++j) {
                total |= (1 << (cur[j] - 'a'));
            }
            if (ma.find(total) != ma.end()) {
                if (ma[total].length() < l) {
                    ma[total] = cur;
                }
            } else {
                ma[total] = cur;
            }
        }
        int res = 0;
        for (auto it = ma.begin(); it != ma.end(); ++it) {
            for (auto next = it; next != ma.end(); ++next) {
                if (it == next) {
                    continue;
                }
                if (!((it->first) & (next->first))) {
                    res = max(res, int((it->second.length()) * (next->second.length())));
                }
            }
        }

        return res;
    }
};
```
C++ foundation | O'zgaruvchilar
Tags: cpp, beginners, uzbek, foundation
Published: 2022-03-28 09:34:15


**Variables**_(o'zgaruvchilar)_
O'zgaruvchini yaratish _xotirada joylashuvini_ yoki _qiymatlarini saqlash_ uchun xotirada bo'sh joyni saqlab beruvchi konteyner hisoblanadi!
C++ da har xil turdagi o'zgaruvchilar mavjud!
O'zgaruvchilarning turlari

> 
C++ da o‘zgaruvchilar ishlatilish doirasiga ko'ra yoki chegarasiga ko'ra uch xil bo'ladi!
>
1. **Mahalliy o'zgaruvchilar**_(Local Variables)_
2. **Namuna o'zgaruvchilari**_(Instance Variables)_
3. **Statik o'zgaruvchilar**_(Static Variables)_


- `int` - typi butun sonni ifodalaydi. Misol uchun: _123_,   _-123_

- `float` yoki `double` bu typlarda  _19,99_ yoki _-19,99_ kabi o'nlik _(suzuvchi nuqtali)_ sonlarni saqlaydi

- `char` - typi **'a'** , **'B'**, **' = '** kabi belgilarni o'zida saqlaydi 

- `string` - "Salom dunyo" kabi tekstlarni saqlaydi va qo'shtirnoq ichida yoziladi (" ")
- `bool` - qiymatlarni ikkita holatda saqlaydi: **true** _yoki_ **false** 2-holat **1** _yoki_ **0**




---

Har doim yodda tutingki, Kompilyator barcha o'zgaruvchilar ulardan foydalanishdan oldin ularning **nomini** va **ma'lumotlar turi** _(data type)_ ni aniqlash kerak bo'ladi

---
####Keyingi postimizdan boshlab har bir o'zgaruvchi turlariga batafsilroq tushintirish berib ketamiz! Manfaatli bo'lgan bo'sa hursandmiz. Alhamdulillah!
Pagination with express and mongoose
Tags: javascript, beginners, node, mongodb
Published: 2022-03-28 09:18:37

When I started making my own MERN e-Commerce App from scratch, I never took the time to think about the implementation of the back-end. For example, for searching products, I thought I could just request all products from the database and apply filters on the frontend with some JS. Well, if I had just a dozen products in my database, this would be an "okay" solution. But I quickly realized how stupid I was.

Imagine if I had hundreds of products in my database. How much time does it take to get all the data with a single request? How much bandwidth would you use? What if the user has a 4G connection? How much memory is the browser going to use to execute the front-end code for filters?

From here, I started to do some research (Googling) on how it is usually done and what the best practices are (I'm using MongoDB with Mongoose), and I found about the skip and limit methods we can combine and use when we request the data using Mongoose.

## the `limit()` method

This method receives a number as a parameter and lets us set the maximum number of documents we can get on one request.

## the `skip()` method

This method receives a number as a parameter and allows the user to specify the number of documents to skip. When we make a request, this method ignores the `n` documents we specified and returns the rest.

## Show me the code

```js

const getProducts= async (req, res, next) => {
    try {
        // We destructure the req.query object to get the page and limit variables from url 
        const { page = 1, limit = 10 } = req.query;

        const products = await Product.find({ ...req.query })
            // We multiply the "limit" variables by one just to make sure we pass a number and not a string
            .limit(limit * 1)
            // I don't think i need to explain the math here
            .skip((page - 1) * limit)
            // We sort the data by the date of their creation in descending order (user 1 instead of -1 to get ascending order)
            .sort({ createdAt: -1 })

        // Getting the numbers of products stored in database
        const count = await Product.countDocuments();

        return res.status(200).json({
            products,
            totalPages: Math.ceil(count / limit),
            currentPage: page,
        });
    } catch (err) {
        next(err);
    }
};

} 
```

## Conclusion

Actually, the MERN application I'm developing is the first project I'm building without following any tutorial or course, and I'm trying to use as little libraries and third-party code as possible, so I'm learning along the way, and the least I can say is that I've already encountered a lot of obstacles that made me grow as a developer. I'll be sharing the problems I encounter and the solutions I come up with to solve them on dev.to as much as I can.

I'm still new to blogging and web development, so please, if you have any feedback, I'd love to read it.
Machine Learning in Real Time
Tags: machinelearning
Published: 2022-03-28 09:12:03

These days, machine learning can be used in an array of apps. Perhaps one regarding the most popular types of machine understanding for is the particular recommendation engine that will powers Facebook's reports feed.

Facebook makes use of machine learning how to modify how each member's feed is supplied. If a new member frequently stops you just read a particular group's posts, the advice engine will commence to display far even more of that group's activity earlier throughout the feed.

Guiding the scenes, typically the engine is wanting to reinforce regarded patterns inside the member's online behavior. Will need to the member adjust patterns and forget to read posts like a result class in the approaching weeks, the media feed will adapt accordingly.

**In supplement to recommendation applications, other uses to get machine learning include things like the following:**

- Customer Relationship Management(CRM): CUSTOMER RELATIONSHIP MANAGEMENT software can apply machine learning products to investigate email together with prompt sales workforce members as a solution to be able to the main messages initially. More advanced devices can even advise potentially effective answers.

- Business Intelligence (BI): BI and stats vendors use equipment learning in his or her software to distinguish potentially important files points, patterns involving data points together with anomalies. https://www.igmguru.com/machine-learning-ai/machine-learning-certification-training/

- Human Resource Information Systems: HRIS systems can apply machine learning products to filter by applications and distinguish the best prospects for an start position.

- Self-driving autos: Machine learning methods can make that possible for some sort of semi-autonomous car to acknowledge a partially obvious object and alarm the driver.

- Virtual Assistants: Smart co-workers typically incorporate closely watched and unsupervised equipment learning models to be able to interpret natural dialog and provide circumstance.
IPL 2022 Live Updates with Match Schedule and Score
Tags: ipl, ipl2022, ipllivescore, iplschedule
Published: 2022-03-28 09:11:25

Get ready for the TATA IPL 2022! The first match will be between CSK and KKR on 26 March 2022. These matches will be broadcast live on many channels, so you won’t miss a moment of the action. Our team member has made a handy **IPL 2022 Live Score & Schedule** application, so you can always know when the next match is. 

**The teams will participate this year:**

- Mumbai Indians
- Chennai Super Kings
- Kolkata Knight Riders
- Sunrisers Hyderabad
- Rajasthan Royals
- Royal Challengers Bangalore
- Delhi Capitals
- Punjab Kings
- Lucknow Super Giants
- Gujarat Titans

This application is very much liked by our team which you will also like. Because the team is always looking for information about who won the match yesterday. We have many such readers who are related to IPL only with IPL results. For that, we have created this app.

**Download app from source URL:** [IPL 2022 Live Score & Schedule](https://play.google.com/store/apps/details?id=com.ipl2022.livescore.ipldetails)