teleren/devto huggingface dataset:
Cost optimization
Tags: cost, cloud, aws, pricing
Published: 2023-02-10 18:38:39

## Design principles

- Implement cloud financial management
- Adopt a consumption model
- Measure overall efficiency
- Stop spending money on undifferentiated heavy lifting
- Analyze and attribute expenditure

## Tagging


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

## Cost and usage visualization


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

## Usage trends


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

## Anomaly detection


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


## EC2 rightsizing


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


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

## Cost and usage reports (CURs)

The 5 Ws:

1. What does it cost = line_item_unblended_cost
2. Who used it = line_item_usage_account_id
3. When was it used = line_item_usage_start_date
4. Where was it used = product_region
5. Why the cost occurred = line_item_resource_id

## Cloud Intelligence Dashboards


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

## Workload efficiency


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

## Trusted advisor



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


## AWS Budgets


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

## Visualizing cost


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

## Cost and usage analysis



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

## CUDOS Dashboard


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

## TAO Dashboard


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

## CID Dashboard

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3snph4p9wcdvs0wqtbrm.png)
Microsoft will OpenAI-Entwicklung namens ChatGPT in Bing integrieren
Published: 2023-02-10 18:33:28

Microsoft will OpenAI-Entwicklung namens ChatGPT in Bing integrieren


ganz neu:  Microsoft will die OpenAI-Entwicklung namens ChatGPT die in letzter Zeit große Erfolge hatte und eine der am schnellsten wachsenden Anwendungen ist - nicht nur in die eigenen Produkte wie Azure, Microsoft 365 und auch die Teams Premium Version integrieren: Nein - MS will noch weiter gehen und Chat GPT sogar auch in die Suchmaschine Bing integrieren. MS verspricht sich durch die KI-Integration eine Aufwertung. Erste Versionen sind als Preview erhältlich
I coded a wallpaper engine in 10 minutes
Tags: tutorial, csharp, javascript
Published: 2023-02-10 18:26:26

I recently created a project to set a web browser as my desktop background. The same way ActiveDesktop used to do.

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

I even created a blog post for those who prefer it

{% embed https://letsmakecode.com/?p=140 %}
Hello world in C
Tags: beginners
Published: 2023-02-10 18:15:52

## Introduction
The C language is a really easy language, am gonna show you how to 
write hello world aujourd'hui

names | ages
-----|------
juma | 23
danny | 19


## heading 2
afsd _jklfh_ ajkhs **djkfh** ajkdsjk;af

1. list item 1
2. list item 2

- sajfds
- afdhfjs
-  akldjfkl

### En francais
Le C lang est tre facile lang, je vais montrez-vous comme ecrire _hello world_ aujourd'hui

```
#include <stdio.h>

int main() {
 printf("Hello world");
}

Et voila ...


```
si vous peux voir mon website vous visitez [label](google.com)
Blazor WASM Linking
Tags: blazor, todayilearned
Published: 2023-02-10 18:09:35

**Problem**:
Your WASM application works fine in debug, but when you deploy you start seeing issues where methods and other such things are missing.

**Possible Solution**: Blazor WASM is similar to Xamarin development in that you want to ensure your app is as small as possible. To that goal, by default the build will strip out any perceived unneeded code from your project. This can have some unforeseen consequences unfortunately. To avoid this consider adding the following properties to your project file:

**Disable ALL linking**

```
<PropertyGroup> 
<BlazorWebAssemblyEnableLinking>false</BlazorWebAssemblyEnableLinking>
</PropertyGroup>
```

**Disable linking in a more nuanced fasion**

```
<ItemGroup>
  <BlazorLinkerDescriptor Include="LinkerConfig.xml" />
</ItemGroup>
```

If you go with the LinkerConfig.xml please review the reference for guides on how to populate the LinkerConfig.xml

**Reference:** https://learn.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/configure-linker?view=aspnetcore-3.1
How to make a Solana Token in just 3 minutes!
Tags: blockchain, tutorial, beginners
Published: 2023-02-10 18:09:33

Before I begin with this post, I am asking people to donate some Solana. I just recently used this method to make myself a token and I am trying to get it on the market. Im poor so any donation to help me get it published will help a ton. ALSO anyone that donates will get 1k [GDVC](https://explorer.solana.com/address/ASnY1xvjDnyJLdTbWoGmsnsCiqncYazcWWnuQ4sgrA6u) for free. I will send the token to the address that sends me some solana. THIS IS NOT A SCAM!! Send solana here: Fmxpd5adjh7iXnNvhByAWKjvLthRCA4DBNFFbsupesGd
 

FIRST TO COMMENT GETS 10K GDVC!

 

## Getting Started

In order to create a token on the solana blockchain you will want around 0.005 SOL so that all fees are covered. If you cant directly purchase some solana I recommend using FaucetPay to get some cryptocurrency fast and easy. I would also recommend signing up for Freecash to send some crypto your faucet pay account. Completing 1 survey will normally get you $0.50 which is more than enough solana. If you dont want to do a survey than just go to several faucets on faucetpay and claim. That takes much much longer though. Once you have obtained enough solana you need a web3 crypto wallet to interact with the dapp. I recommend using the Exodus Wallet extension as it offers compatibility with phantom connections, exodus connections, etc.

Now before you create your currency you need to do some research to make sure that the name of the currency you want to make doesn't already exist! I would also highly recommend creating a logo for your token as it makes it look a lot better.

## Creating Your Token

Timer starts now! Head over to https://app.strataprotocol.com/launchpad and select create new token and then self managed. Connect your wallet and approve all the requests. Then fill out the details for your currency. If the token you want to make already exists it will fail to be created and you will be charged fees still! Once the form is filled out just click create token and approve all transaction requests. It will send several of these and you have to approve all of them. Those are fees for creating the token, creating an account for the token, and publishing metadata. Once it finishes you can go to your wallet, add the token contract and BOOM. You have just created your own currency.

## Next Steps
Everything below is optional. 

Disable minting on your token.

Get a OpenBook Market ID: https://www.serumexplorer.xyz/market/create

Add your token to exchanges such as Raydium.io
Entendendo os componentes no React: A base da arquitetura.
Tags: react, beginners
Published: 2023-02-10 18:08:47

Um componente é uma parte do seu código que acaba se repetindo diversas vezes ao longo do código,com pequenas alteranções. Eles permitem a separação do código em pequenas partes reutilizáveis que se comportam de forma independente e podem ser combinadas para compor a aplicação completa.

Conceitualmente, componentes são como funções JavaScript. Eles aceitam entradas arbitrárias (chamadas “props”) e retornam elementos React descrevendo o que deve aparecer na tela. Por exemplo,veja como funciona um _Componente de Função_:

```
function Welcome(props) {
  return <h1>Hello, {props.name}</h1>;
}
```

Compreendendo mais o funcionamento de um Componente, nós podemos passar um elemento dentro de um Componente. Para isso, usamos o JSX para passar os parâmetros corretamente.


```
function Teste(props) {
  return <h1>Olá, {props.name}</h1>;
}

const root = ReactDOM.createRoot(document.getElementById('root'));

const elementp = <Teste name="Junior" />;
root.render(elemento);
```

- Chamamos root.render()com o <Teste name="Junior" />elemento.

- O React chama o `Teste` componente com {name: 'Junior'} props.

- Nosso `Teste` componente retorna um <h1>Olá , Junior </h1>elemento como resultado final.

- O React DOM atualiza com eficiência o DOM para corresponder <h1>Olá, Junior</h1>.


Nesse processo, também existe o _Componente de Classe_ que teria uma forma um pouco diferente de escrever.

Os _componentes de classe_, são definidos como uma classe JavaScript que extende a classe `React.Component`. Eles permitem o uso de estado interno, ciclo de vida e outras funcionalidades avançadas, como o uso de métodos para lidar com eventos.

```
class Welcome extends React.Component {
  render() {
    return <h1>Hello, {this.props.name}</h1>;
  }
}
```

É possível também fazer a extração de componentes, os divindo em pequenas outras partes.


Em resumo, os componentes em React são uma parte importante da biblioteca de biblioteca de interface de usuário e ajudam a tornar o desenvolvimento de aplicativos web mais fácil e eficiente. Eles permitem que os desenvolvedores dividam a interface em partes menores e mais gerenciáveis, além de serem altamente customizáveis e fáceis de testar. Se você estiver construindo uma aplicação web, definitivamente deve considerar o uso de componentes em React.
JavaScript Tutorial Series: Operators.
Published: 2023-02-10 18:06:55

Operators are distinct symbols used to perform operations on operands such as values and variables.

We've seen an operator in the previous post, which is the assignment operator.

Before we start this lessons about operators let's talk about comments.

## Comments
Comments are a small description that you can add to your code to make it readable. Comments are also used to stop the execution of a line of code since the compiler parses and then discards comments.

There are two types of comments: 

- single-line comment 

```JavaScript
// this is a comment
```
- multi-line comment 

``` JavaScript
/* this comment can 
span across 
multiple lines*/
```

## Assignment operator
You assign a value to a variable using the assignment operator.

``` JavaScript
let age = 25;
```
In the example above we've assigned `25` to the variable `age`.

## Arithmetic operators

| operator | description|
|----------|:----------:|
| + | addition operator|
| - | subtraction operator|
| * | multiplication operator|
| / | division operator| 
| % | remainder operator|
| ** | Exponentiation operator|
| ++ | increment operator| 
| -- | decrement operator|

Here are some examples:

```JavaScript
let x = 3;
x = x + 7  //10 

let y = 10;
y = y / 2; //5
```
A shorthand can be used to do these operation:
 _This works the same with subtraction multiplication and division_

Using the example above
```JavaScript
let x = 3;
x = x + 7  //10 

//instead of writing x = x + 7;
x += 7; //10 
```
 
## Increment and Decrement
### Increment
The increment operator increases the value of a variable by 1.

``` JavaScript
let x = 1; 
x++;
console.log(x); //2
```

### Decrement
The decrement operator decreases the value of a variable by 1.

``` JavaScript
let y = 1; 
y--;
console.log(y); //0
```
### Prefix and postfix increment and decrement
#### Prefix 
Prefix increment/decrement first increases or decreases the value then executes the statement.

#### Postfix 
Postfix increment/decrement executes the statement then increases or decreases the value.

## Exponentiation 
Using this operator raises the first operand to the second operand's power. 

```JavaScript
let x = 5;
let y = 3;

let result = x ** y;
console.log(result); //125
```
## Remainder operator 
The remainder operator returns the remaining part of a division/ 

``` JavaScript
let x = 7 
let y = 3 
let result = x % y;
console.log(result); //1
```
⚠️ Warning: Don't cache lazy IEnumerable<T> in .NET
Tags: programming, csharp, dotnet, caching
Published: 2023-02-10 17:58:37

---
title: ⚠️ Warning: Don't cache lazy IEnumerable<T> in .NET
published: true
date: 2023-02-10 17:54:43 UTC
tags: programming, csharp, dotnet, caching
canonical_url: https://zagosk.in/warning-dont-cache-lazy-ienumerablet-in-net
---

(The same is true for `IAsyncEnumerable<T>`)

A few days ago I came across a code where a developer used .NET [MemoryCache](https://learn.microsoft.com/en-us/dotnet/api/system.runtime.caching.memorycache) to cache data retrieved from the database. Sounds boring, but... every time the cache needed to return a result, a call to the database was made.

Let's take a look at a simplified example:

```csharp
var serviceProvider = new ServiceCollection().AddMemoryCache().BuildServiceProvider();
var randomizer = Random.Shared;
var memoryCache = serviceProvider.GetRequiredService<IMemoryCache>();

// NOTE: we cache the result of GetData()
var data1 = memoryCache.GetOrCreate("key", _ => GetDataFromDb()).ToList();
var data2 = memoryCache.GetOrCreate("key", _ => GetDataFromDb()).ToList();

IEnumerable<int> GetDataFromDb()
{
    // This method will be called twice!
    yield return randomizer.Next();
}

```

The problem here is that we cache not an array or collection as it may look at first glance, but a **lazy** `IEnumerable`, which is calculated not when we call the `GetDateFromDb()` method, but when we enumerate this lazy thing by calling `ToList()`.

As a result, the method `GetDataFromDb()` gets called twice (this is what we wanted to avoid with the help of the cache), and also `data1` and `data` will represent different lists with different values.

### Solution

Cache the actual result enumerated result instead of lazy `IEnumerable<T>`:

```csharp
var serviceProvider = new ServiceCollection().AddMemoryCache().BuildServiceProvider();
var randomizer = Random.Shared;
var memoryCache = serviceProvider.GetRequiredService<IMemoryCache>();

// NOTE: we cache GetData().ToList()
var data1 = memoryCache.GetOrCreate("key", _ => GetDataFromDb().ToList());
var data2 = memoryCache.GetOrCreate("key", _ => GetDataFromDb().ToList());

IEnumerable<int> GetDataFromDb()
{
    yield return randomizer.Next();
}

```

Now, the behavior will be as expected: the `GetDataFromDb()` method gets called only once and `data1` equals `data2`.

Thank you for reading and be careful with the cache.

Cheers!
Find the sum - Minibytes - Beginner Javascript Practice Questions #1
Tags: codepen, beginners, javascript, programming
Published: 2023-02-10 17:51:40

Hey, guys!

So currently, I'm giving a few coding lessons to some people in my life, and in doing so, I've been coming up with simple problems for them to solve. 

The low difficulty allows you to start doing some real-world work, without the stress of building out an entire project on your own. It also has some guiding questions to help you get in the right mindset of thinking.

Do you want this to become a series? Leave a comment below! 
Let me see your solutions as well! 

Happy coding,
Jules

https://codepen.io/julesglad/pen/rNrEKXW

{% codepen https://codepen.io/julesglad/pen/rNrEKXW %}
Incomplete production sourcemaps for the HelloWorld app.
Tags: vite, vue
Published: 2023-02-10 17:51:12

I am trying to generate sourcemaps for a production build for the HelloWorld App for Vite+Vue. Unfortunately it does not show all the components (only shows the WelcomeItem component). See snaphot from chrome devtools below:

[![enter image description here][1]][1]

When you inspect the sourcemap files, you see that it does not add App.vue, Helloworld.vue and TheWelcome.vue to sources:

```JS
{
    "version": 3,
    "file": "index-ecfc4d4f.js",
    "sources": [
        "../../node_modules/@vue/shared/dist/shared.esm-bundler.js",
        "../../node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js",
        "../../node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js",
        "../../node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js",
        "../../src/assets/logo.svg",
        "../../src/components/WelcomeItem.vue",
        "../../src/components/icons/IconDocumentation.vue",
        "../../src/components/icons/IconTooling.vue",
        "../../src/components/icons/IconEcosystem.vue",
        "../../src/components/icons/IconCommunity.vue",
        "../../src/components/icons/IconSupport.vue",
        "../../src/main.js"
    ],
    "sourcesContent": [ ...
    ], ...
}


```

The dev mode is working OK, I can see my source code.

Here is my config. All I did was add build.sourcemap=true.

```JS
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  },
  build: {
    sourcemap: true
  }
})

```


  [1]: https://i.stack.imgur.com/EJq9m.png
Auto Load in PHP (Shortly Understanding)
Tags: php
Published: 2023-02-10 17:50:14


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sv6odcoiivvswvrh2qwe.png)
This article is written for learning purpose. So please if I made any mistake, please let me know and any feedback will be highly appreciated.

When we learn about autoloading, Firstly, we need to understand PSR.

**PSR:** PHP Standard Recommendation — is a set of standards that ensure working with PHP is easier. Example: PSR1- Coding standard, PSR7- HTTP request standard, PSR4- Autoloading standard.

**PSR4:** Provides the ability to include classes based on their file path. Like, you define BMW, and Mercedes classes in a different file and their namespace is Car. To load those files we need to include 2 files twice. Using PSR4 we can include files with autoloading. So, we don’t need include files of classes again again.

**auto load** — Sometimes we need multiple files of classes in a file, here we can use autoload.

**Steps of using auto load-**

> Step 1: If you have installed composer. Run ‘composer init’ to the top directory of your project folder.
> Step 2: Add the “autoload” property in the “composer.json” file, and add the “psr-4” property — its property is namespaces of classes and the value is file directory (where the auto load will find the namespaces).
`> Example:
> “autoload”: {
> “psr-4”: {
> “Car\\”: “oop/autoload/car/”
> }
> }`
> Step 3: Run “composer dump-autoload”
> Step 4: Include the “vendor/autoload.php” file where you need those classes.

**Note:** When you include “vendor/autoload.php”, be careful about your current directory. For — “vendor/autoload.php” is in 3 steps upper directory from your current directory, here you use- (include_once “../../../vendor/autoload.php”).

**Git repo:**[ https://github.com/Arif-Hosen/learn_php/tree/main/oop/autoload/car](url)
How to do api search based on multiple input fields in react?
Tags: webdev, react, help, questions
Published: 2023-02-10 17:28:15

I have around 4 input fields and am storing their inputted value as an array of object using onChange

//
const info = [{
              template:"",
              date:"",
              status:"",
              owner:"",
}]

const [data, setData] = useState(info)

const handleImputChange = () => {
      setData(...data, //storing input data for any given field )
      }

}



My question is how to pass any no of keys, value(from state Variable) into the api in order to get the desired  filtered output

For Ex:
const response  = axios.get("xyz.search?templateName = random")
for the given api will be using any axios or fetch to get the value, over here I've hard coded input field and the value for it, so it will search the DB with the provided key value pair.

Let's say how to pass mutiple key value pairs through the api?
¿Cual es el mejor lenguaje de Programación? What is the best programming language?
Tags: webdev, beginners
Published: 2023-02-10 17:16:31

# - Spanish Section -
Cuando recién empezamos a explorar el mundo de la programación, nos damos cuenta que existen muchísimos lenguajes, y probablemente si eres nuevo, tendras un dilema muy grande : ¿Cuál es el mejor lenguajes de programación?, ¿Con cual debo comenzar?.

## ***No existe un mejor lenguaje de programación***,
Si bien es cierto que hay lenguajes de programación mas queridos por la comunidad, no existe un lenguaje de programación que sea el mejor, pero podría decir que hay lenguajes de programación que tienen enfoques especializados en ciertas ramas del desarrollo y dentro de esa rama son los mas ***eficientes***, así que dependiendo del enfoque que tu quisieras aprender, ya sea Backend, Frontend, Data Science, etc... Estos lenguajes variarían.

## ***Elige cualquier lenguaje*** 
Es verdad que en los inicios nos preocupamos mucho por cual lenguaje de programación empezar y si bien no es una decision fácil y causa un gran dilema, esto realmente no tendría porque preocuparte, ***Elige cualquier lenguaje***, ya sea Python, C#, Java, etc... ya que esta decision a demás de que te ayudara a tener bases de la programación, no determinara el futuro de tu desarrollo, Empezar, siempre es la parte mas complicada, pero a medida que vas explorando iremos descubriendo nuevas herramientas de trabajo con las que nos sintamos mas cómodos y también nos daremos cuenta, que todos los lenguajes tienen una syntaxis muy similar.

---
# - English Section -
When we first start exploring the world of programming, we realize that there are so many languages, and probably if you are new, you will have a big dilemma: What is the best programming language, which one should I start with?

## There is no best programming language***,
While it is true that there are programming languages more loved by the community, there is no programming language that is the best, but I could say that there are programming languages that have specialized approaches in certain branches of development and within that branch are the most ***efficient***, so depending on the approach that you would like to learn, whether Backend, Frontend, Data Science, etc ... These languages would vary.

## ***Choose any language***. 
It is true that in the beginning we worry a lot about which programming language to start with and while it is not an easy decision and causes a big dilemma, this really should not worry you, ***Choose any language***, either Python, C#, Java, etc .... This decision will not determine the future of your development, but it is always the most complicated part, but as you explore, you will discover new working tools with which you feel more comfortable and you will also realize that all languages have a very similar syntax.