teleren/devto huggingface dataset:
Catatan Belajar Redis - Data Types
Tags: redis
Published: 2021-08-02 07:00:51

## Data types
Redis mempunyai 7 tipe data, yaitu 
String, Lists, Sets, Sorted Sets, Hashes & Bitmaps, and Hyperlogs.

## Basic Commands

### String
note: `user` adalah namespace lalu `1` adalah unique keynya
```
set user:1:name Cigar
get user:1:name
// Cigar
```

### Lists
* Lists of strings.
* Items can either append to start or end(from left or right).


```
lpush blog:1:tags laravel php redis
lrange blog:1:tags 0 -1
// laravel php redis

rpush blog:1:tags nodejs
lrange blog:1:tags 0 -1
// laravel php redis nodejs
lpush blog:1:tags python
// python laravel php redis nodejs
```

### Sets
* Unordered collection of strings
* It is possible to add, remove, and test.
* They do not allow repeated items and when retrieving items they are not returned in the same order they are entered
```
sadd user:1:anime naruto onepiece jujutsu kimi_no_nawa
smembers user:1:anime
```

### Hashes
* Berisi list key dan value
```
HMSET myhash field1 "Hello" field2 "World"
HGET myhash field1
HGET myhash field2
```

### Sorted Sets
* Adds all the specified members with the specified scores to the sorted set stored at key.

```
redis>  ZADD myzset 1 "one"

(integer) 1

redis>  ZADD myzset 1 "uno"

(integer) 1

redis>  ZADD myzset 2 "two" 3 "three"

(integer) 2

redis>  ZRANGE myzset 0 -1 WITHSCORES

1) "one"
2) "1"
3) "uno"
4) "1"
5) "two"
6) "2"
7) "three"
8) "3"

redis>
```
What is D3.js ?
Tags: datascience, javascript, todayilearned, database
Published: 2021-08-02 06:41:26

As a developers I really love data, and that too in a arranged manner.

Sometimes Data can be such a mess, that it becomes more of a headache that a resource, with data we can solve so many problem in our day to day life.

![graphs](https://media.giphy.com/media/l0HlJIp1dIZzimEBq/giphy.gif)

#**D3.js can help us here**

_D3.js is a JavaScript library for manipulating documents based on data. D3 helps you bring data to life using HTML, SVG, and CSS. D3’s emphasis on web standards gives you the full capabilities of modern browsers without tying yourself to a proprietary framework, combining powerful visualization components and a data-driven approach to DOM manipulation._

##D3 stands for Data-Driven Documents
The full form explains itself, its is a library, which helps us in making graphs, charts, projections form just a set of data.

##Installation
```javascript
 <script src="https://d3js.org/d3.v7.min.js"></script>
```

##_Now lets get into some coding examples:_

![meme](https://media.giphy.com/media/LmNwrBhejkK9EFP504/giphy.gif)

``` javascript
d3.selectAll(); //this is used to select all the elements given inside the parenthesis

d3.select(); // this is used to select just a particular element
//inside the parenthesis 

d3.select('h1')
  .style('color', 'red') // this takes the h1 tag from the html and converts it into red color;
  .text('hi there'); // this changes the text in the html to the given string

d3.select('body').append('p').text('YOLO'); // this appends the text to the p tag in the body
d3.select('body').append('p').text('YOLO');
d3.select('body').append('p').text('YOLO');
d3.select('body').append('p').text('YOLO');

d3.selectAll('p').style('color', 'blue'); // this snippet is used to select all the p tags and change their color to blue
```

These are the basics way we can manipulate the Data inside the JS using the D3.js library

To get more depth knowledge on this topic go and check this video form FreeCodeCamp.org on their YouTube channel

{% youtube 2LhoCfjm8R4 %}

-----------------------------------------------------------------------------------------------------------------------------------

#Meme Section:
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ivmanu9vkflbomg8oqnx.png)

#Happy Coding 🚀👨‍💻
HTML tags | caption
Tags: html, tags, caption
Published: 2021-08-02 06:34:25

It is used to **insert a title in a table**. It must be inserted just after `<table>`, like its first child.

You can **control the rendering position visually** with the `caption-side` CSS property (_top_/_bottom_).

If the table is the only descendant of a `<figure>`, use `<figcaption>` instead of `<caption>`.

- Type: *block*
- Self-closing: *No*
- Semantic value: *No*

[Definition and example](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/caption) | [Support](https://caniuse.com/mdn-html_elements_caption)
Creating a Hamburger Menu
Tags: beginners, tutorial, webdev, codenewbie
Published: 2021-08-02 06:29:20

The hamburger icon is simply a symbol that has come to mean "menu". It's used to toggle a menu or navigation bar between being collapsed behind the button or displayed on the screen. 
![gif](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gt5xtiacq4sjqmxuz2d7.gif)

Here is how to create it-
##_1. HTML File_
We start by creating our HTML file and initializing two classes to target our elements.
```
<body>
  <div class="menu-btn">
    <div class="menu-btn__burger"></div>
  </div>
</body>
```
##_2. CSS File_
Here we start creating and designing our hamburger icon. We start with basic properties such as defining the width, height and the transition. This creates the basic outline of the box.
```
.menu-btn {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 80px;
  height: 80px;
  cursor: pointer;
  transition: all .5s ease-in-out;
  border: 3px solid #fff; 
}
```
![pic](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/478lqn12p023bbjcr846.png)
To get the middle line (out of the three) of our icon we define width, height and border radius as follows- 
```
.menu-btn__burger {
  width: 50px;
  height: 6px;
  background: #fff;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(255,101,47,.2);
  transition: all .5s ease-in-out;
}
```
![pic](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gz2wro8c3f0qqwaqoduv.png
)


To get the other two top and bottom lines-
```
.menu-btn__burger::before,
.menu-btn__burger::after {
  content: '';
  position: absolute;
  width: 50px;
  height: 6px;
  background: #fff;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(255,101,47,.2);
  transition: all .5s ease-in-out;
}
.menu-btn__burger::before {
  transform: translateY(-16px);
}
.menu-btn__burger::after {
  transform: translateY(16px);
}
```
![pic](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/doaakccr3ti3rva5ww6m.png
)

##3. _JS File_
Here we work with the animation of the hamburger icon. We target the "menu-btn" class and initialize a variable "menuopen" to be false. We add an eventListener "click" which either adds or removes the class "open". 
```
const menuBtn = document.querySelector('.menu-btn');
let menuOpen = false;
menuBtn.addEventListener('click', () => {
  if(!menuOpen) {
    menuBtn.classList.add('open');
    menuOpen = true;
  } else {
    menuBtn.classList.remove('open');
    menuOpen = false;
  }
});
```

##4. _Final Touch_
At last, we need to retouch our CSS for the final animation. Here our middle line moves to the left and other two rotate to 45 deg on click.
```
.menu-btn.open .menu-btn__burger {
  transform: translateX(-50px);
  background: transparent;
  box-shadow: none;
}
.menu-btn.open .menu-btn__burger::before {
  transform: rotate(45deg) translate(35px, -35px);
}
.menu-btn.open .menu-btn__burger::after {
  transform: rotate(-45deg) translate(35px, 35px);
}
```

Here is the final preview- 
{% codepen https://codepen.io/Anjali404/pen/NWjzBjw %}

Hope it helps!!!
How to inject services in AdonisJs V5 - Constructor, Method 
Published: 2021-08-02 06:24:58

---
title: How to inject services in AdonisJs V5 - Constructor, Method 
published: true
description: 
tags: 
//cover_image: https://direct_url_to_image.jpg
---

In this post i will give you 2 examples for injection of services to adonisjs v5 constructors, and methods

## create new provider: MyServiceProvider.ts

```ts
import { ApplicationContract } from '@ioc:Adonis/Core/Application'
import {MyServiceImp} from "Providers/MyServiceImp";

export default class MyServiceProvider {

  public static needsApplication = true

  constructor (protected application: ApplicationContract) {
     console.log('i was called');
  }

  public register () {
     this.application.container.bind('@ioc:MyNameSpace/MyService', () => {
        console.log('@ioc:MyNameSpace/MyService');
        return new MyServiceImp('http');
     });

     this.application.container.bind('MyNameSpace/MyService', () => {
        console.log('MyNameSpace/MyService');
        return new MyServiceImp('https');
     });
  }

  public async boot () {
    // All bindings are ready, feel free to use them
     console.log('ready');

  }

  public async ready () {
    // App is ready
  }

  public async shutdown () {
    // Cleanup, since app is going down
  }
}


```

## create new interface: MyServiceContract.ts

```ts
declare module '@ioc:MyNameSpace/MyService' {

   export interface MyServiceContract {
      protocol?: string;
   }
}

```

## create new interface implementation: MyServiceImp.ts

```ts
import {MyServiceContract} from "@ioc:MyNameSpace/MyService";

export class MyServiceImp implements MyServiceContract {
   protocol: string;

   constructor(protocol: string) {
      this.protocol = protocol;
   }
}


```

## add to file adonisrc.json in providers array:
``` ts
"./providers/MyServiceProvider"
```

### usage:
iam giving here 2 namespacing examples, you can choose how ever you prefer

## add to controller/service - what ever you need

```ts

import {inject} from "@adonisjs/fold";
import {MyServiceContract} from "@ioc:MyNameSpace/MyService";



// constructor injection, pay attention to array indexes
// this will log from service provider register method
// console.log('@ioc:MyNameSpace/MyService'); - for example


@inject(['@ioc:MyNameSpace/MyService', 'MyNameSpace/MyService'])
export default class MyController {
    constructor(protected service1: MyServiceContract, protected service2: MyServiceContract) {
      console.log(service1, service2);
   }


// option 2 - method injection
// same here, 2 example of getting service from ioc by namespace

@inject([null, '@ioc:MyNameSpace/MyService', 'MyNameSpace/MyService'])
   public async index({inertia, request}: HttpContextContract, myService: MyServiceContract, myService2: MyServiceContract) {
      console.log(myService, myService2);

   }

}
```
MATLAB MONDAYS💥- Crash Course part-6
Tags: matlab, matlabmondays, beginners, tutorial
Published: 2021-08-02 06:24:19

Welcome all! ❤️‍🔥 This Monday let us learn about Accessing vector elements in MATLAB.🤟
---
_____
Many times, we need to access the elements in middle of a vector or matrix. MATLAB provides easy methods to extract out the elements.


**Accessing vector elements**-

We can access and the vector elements as shown in the example
```MATLAB
>> x=[1,2,3,4,0,6];
>> x(5)

ans =

     0

>> x(5)=5;
>> x

x =

     1     2     3     4     5     6
```

MATLAB also allows us to access many elements at once. The result is a 'n' element vector
```MATLAB
>> x=[2,4,6,8];
>> y=x([2,3])

y =

     4     6
>> y=x([1,3,4])

y =

     2     6     8
```
An alternative may be 
```MATLAB
>> x=[2,4,6,8];
>> data=1:3;
>> y=x(data)

y =

     2     4     6
```

We can access the last element of thee vector using the "end" keyword.

```MATLAB
>> x=[2,4,6,8];
>> x(end)

ans =

     8

>> x(end-1)

ans =

     6
```

**Accessing matrix values**-
Matrix values require both the row and the column number to be accessed
```MATLAB
>> x=rand(5,6)

x =

    0.9058    0.2785    0.9706    0.4218    0.0357    0.7431
    0.1270    0.5469    0.9572    0.9157    0.8491    0.3922
    0.9134    0.9575    0.4854    0.7922    0.9340    0.6555
    0.6324    0.9649    0.8003    0.9595    0.6787    0.1712
    0.0975    0.1576    0.1419    0.6557    0.7577    0.7060

>> x(2,3)

ans =

    0.9572
```

We can also extract a whole matrix using the syntax
x(rows,columns), where rows is an array of rows while columns is array of columns. Here are two examples that will make things very clear.
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m8g4lgx1u1uhkgzekiok.png)

Note that 2:4 means [2,3,4] while comma separated 2,4 means [2,4]
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/566x0w1q2fhks3yjeljr.png)
 
 In order to take an entire column or row, we can just place a semicolon ':' for it. Here is an example-
```MATLAB
>> x=rand(5,5)

x =

    0.8314    0.4168    0.0155    0.1981    0.0527
    0.8034    0.6569    0.9841    0.4897    0.7379
    0.0605    0.6280    0.1672    0.3395    0.2691
    0.3993    0.2920    0.1062    0.9516    0.4228
    0.5269    0.4317    0.3724    0.9203    0.5479

>> x(:,3)

ans =

    0.0155
    0.9841
    0.1672
    0.1062
    0.3724

>> x(3,:)

ans =

    0.0605    0.6280    0.1672    0.3395    0.2691
```

_____
That's all for this week. 🏆 Your comments really motivate me, so for any suggestions or doubts, please comment below 👇, and I will be happy to help 🙂 🎗️ Follow me for updates...
Also, you can gmail me for any suggestion or help 🙌
[![LinkedIn][1.2]][1]
[![Gmail][2.2]][2]


[1.2]: https://img.shields.io/badge/linkedin-%230077B5.svg?&style=for-the-badge&logo=linkedin&logoColor=white 
[2.2]: https://img.shields.io/badge/Gmail-D14836?style=for-the-badge&logo=gmail&logoColor=white

[1]: https://www.linkedin.com/in/aatmajmhatre/
[2]: https://aatmaj.mhatre@gmail.com

Bye for now 🖐
Meet you all soon👍

➕➖✖️➗
Setting up multiple environment in your angular project
Tags: angular, typescript, webpack
Published: 2021-08-02 06:20:18

By default angular only creates two environment for you, which are test and production. Sometimes we might need to add more environments to our project, due to company or project structure .It might be a development environment, staging or even a QA environment. In the post I would show you how easy it is to setup up multiple environment file in your angular project .


###Step 1
  Create a new file in your environments folder. You can name it `environment.staging.ts`.

###Step 2
In your `angular.json` file add the code below to your configuration key. This allows you register the new environment.

```
"staging": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.staging.ts"
                }
              ]
            },

```
###Step 3
Finally to build this newly created environment type the command below in your terminal.
```
ng build --configuration staging
```

Thanks for reading you can follow me on twitter at [![Twitter URL](https://img.shields.io/twitter/url/https/twitter.com/es404020.svg?style=social&label=Follow%20%40es404020)](https://twitter.com/es404020)
Employment and Employers.
Published: 2021-08-02 06:04:22

I don't know if I am doing the right thing or not, these words were in my dream last night. I know I dream strange things, but let me know your thoughts!

Recently, I have been rejecting the majority of Job offers that I am getting because of my previous experience with employment. I choose to continue educating myself and working on personal projects than working with individuals I cannot trust. People are like dirt. They can either nourish you and help you grow as a person or they can stunt your growth and make you wilt and die.

I am of the opinion that you have to choose your teachers wisely. A good leader demonstrates empathy and humility and finds a balance between vision and execution. How you interview me to measure my skill competency, should carry a clear picture of what type of leader you are.

I don't agree with an individual who thinks that careers are all about money. I believe that anyone who is among the living has the hope to create their own legacy. The truth is that 99% of software solutions fail to meet the proposed requirement and timelines.

Why chase you when I'm the catch?

My stand is that chance is a game to the wealthy but a source of hope to the poor. However, consequences are more important than a decision. I believe that excellence comes about as a result of habit. We become just by doing just acts, temperate by doing temperate acts, brave by doing brave acts.

The only true wisdom is in knowing you know nothing.

Today morning I called my friend to get an insight from him about my strange dream, and he was telling me about the backwards law. The pursuit of a positive experience is itself a negative experience while the acceptance of a negative experience is itself a positive experience. This is what I always understand from Elon Musk when I listen to some of his talks and podcast.

If we were to measure what is good by how much pleasure it brings, nothing would be better than self-control. If we were to measure what is to be avoided by its pain, nothing would be more painful than lack of self-control.

I choose to be happy and very little is needed to make a happy life, it is all within myself in my ways of thinking.
New Luos feature: Template Creation for State, Voltage, Motor and Servo
Tags: embedded, release, opensource, luos
Published: 2021-08-02 05:58:37

🆕 New Luos feature in the 1.3.0 **release**: "Template Creation for State, Voltage, Motor and Servo" ➞ To make the **embedded** development easier, we have to make everything work the same way.

For example, there are many different motor technologies and control, but all motors have the same purpose: making something move. And because all of them have the same purpose, we also should have the same **profile** or **API** for them! That's why we created the **Templates**.

Profiles are advanced APIs dedicated to common **Drivers** such as motors, and we call template the container hosting a profile. Templates are **containers** that will manage for you the profile (API) of your driver.

By developing this kind of container, you don't need to take care of message management anymore. You only need to deal with simple variables adapted to your container's needs! And of course, you can create your own profiles, compose a new one with the already existing ones and share it with your team or the **community**.

More details are in the Luos profile section of our documentation ➞ https://docs.luos.io/pages/embedded/containers/use-profiles.html
Generar componentes dinámicos
Tags: react
Published: 2021-08-02 05:30:12

Hola amigos, un gusto en saludarlos

Hace unos días inicie un proyecto sobre una agenda de contactos, me surgió una duda al momento de crear los números de teléfonos, La cual es ¿Cómo puedo crear varios teléfonos a partir de un componente que se llama teléfono?

*Ejemplo*

Tengo un componente llamado `Contact_list` y atreves de un evento `click`que agregue el componente `Phone` a `Contact_list`

`Contact_list` => Event Click  ==> Add => `Phone`
How to avoid headaches while coding?
Tags: coding, headaches, programming
Published: 2021-08-02 05:21:18

Sitting in front of the laptop for prolonged hours coding or doing office work has been very common since the start of the pandemic.

**"How to avoid headaches while coding? 😶"**

This is the question that I have been asking myself for a long time. 
These are the few tricks I used to reduce my headache :

## 1️⃣ 20-20-20 rule

There's a reason why this tip is on the top of the list.
This is the most effective way of reducing your headache frequency and intensity.

You just have to look at something 20 feet away for 20 seconds every 20 minutes. This not only reduces your headaches but also helps in keeping your eyes healthy as sitting in front of a screen for long hours eventually makes us near sighted because we do not look at fat sighted objects. So, focusing on something which is at least 20 feet away from you will prevent this from happening. 

It's a "strict" rule, but really just looking away often enough is THE tip for me to avoid a headache.

## 2️⃣ Good lighting

Lighting is a key point in preventing headaches. A lot of programmers like to code in the dark, even though it looks cool, it's harming you in the long run. All the light from your screen will put strain on your eyes if the surroundings are not brighter than the screen. See what works for you, it might be using a light behind your screen or dark mode on your screen. You can even get a monitor light.
If you need it, zoom in on web pages!

## 3️⃣ Always have water next to you and drink as often as you can

Dehydration has a direct impact on the brain as brain cells require water to function, just like other cells in the body. Water is also needed to prevent tissues from drying out.

Being hydrated plays a huge factor in reducing the frequency and intensity of your headaches.

## 4️⃣ Blue light filter glasses

This might sound a bit cliché but blue light filter glasses helped me a lot! They not only reduce headaches but are effective in fatigue, insomnia, lack of focus and blurred vision. If you haven't used them yet then I strongly suggest you to try out a pair of blue light filter glasses.


Everyone is different, these are my tips! I hope they work for you too!!
Beware of how you create a Task
Tags: csharp
Published: 2021-08-02 04:52:55

I have made this mistake a few times now so I thought I would try to cement it in to my memory by writing a post about it!

I had a case where I wanted to separate the task creation from the task run in one of my previous posts and I used code that looked like this ...

```csharp
static async Task FireAndForget()
{
  // Warning: Do not do this ...
  Task task = new Task(async () =>
  {
    Console.WriteLine("Going to sleep ...");
    await Task.Delay(1000);
    Console.WriteLine("... Woke up");
  });

  task.Start();

  await task;
}

static async Task Main(string[] args)
{
  await FireAndForget();

  Console.WriteLine("Run complete");

  Console.ReadKey();
}
```

```
Going to sleep ...
Run complete
... Woke up
```

Initially I expected the "... Woke up" message to be output before the "Run complete" message. But then I remembered that the signature for the Task constructor is ...

```csharp
public Task (Action action);
```

This means I am awaiting a task that is executing an action. Action returns an async void so when the action is executed, it will not actually await the completion of the Task.Delay. 

What I actually needed to use was Func that returns a Task ...
```csharp
static async Task FireAndAwaitAsync()
{
  var funcTask = new Func<Task>(async () =>
  {
    Console.WriteLine("Going to sleep ...");
    await Task.Delay(1000);
    Console.WriteLine("... Woke up");
  });

  Task task = funcTask.Invoke();

  await task;
}

static async Task Main(string[] args)
{
  await FireAndAwaitAsync();

  Console.WriteLine($"{DateTime.Now} Run complete");

  Console.ReadKey();
}
```

Which outputs ...
```
Going to sleep ...
... Woke up
Run complete
```

Generally you don't need to separate out task creation from running the task so this is not usually an issue. Now to go back over my previous posts and make sure I fix this error.
AB Initio Training in Bangalore
Published: 2021-08-02 05:19:12

https://intellimindz.com/ab-initio-training-in-bangalore/
https://intellimindz.com/guidewire-training-in-bangalore/
https://intellimindz.com/informatica-mdm-training-in-bangalore/
https://intellimindz.com/informatica-training-in-bangalore/