teleren/devto huggingface dataset:
How much does it cost?
Published: 2023-02-05 08:43:31

---
title: How much does it cost?
published: true
date: 2023-02-04 00:00:00 UTC
tags: 
canonical_url: https://www.funkysi1701.com/posts/2023/how-much-does-it-cost/
---

How much does it Cost to run my side projects? This is going to be an interesting look at my spending, hopefully it can show you can do a lot without breaking the bank!

I have a personal Azure subscription that I pay for myself. I don’t use anything connected to my work, as jobs change and I don’t want to have to shift stuff if I change employers (which happened quite recently). I like Azure, and I like learning what I can do with it, so spending small amounts on a personal subscription is not a problem for me.

This is how much Azure is costing me daily, I like to keep an eye on this chart fairly often so I can see if I get any increases, especially if I have added a new service.

![](https://www.funkysi1701.com/images/daily-costs.png)

This is my monthly charges over the last few months. In Sept/Oct I switched from CosmosDB to Mongo DB Atlas as my database backend. Experience has told me that my biggest charge is data storage, websites are cheap but any database or storage is what tends to cost the most.

![](https://www.funkysi1701.com/images/monthly-costs.png)

This website you are reading this on (assuming you are not on DevTo or Hashnode) is running Hugo which runs on a Azure Static Web App, the free tier so almost free. I have two of these, a production one and a test one. Source code is on Github (another free service), and auto deploys via Github actions. I have a load of images which I have stuffed in blob storage from when I used to run a wordpress site, the cost for file storage is minimal.

I also have a service I built using Azure Functions and Static Web Apps which makes use of public APIs like (Twitter/Mastodon/GitHub etc), data for this is stored in the free tier of Mongo DB Atlas. I then use consumption tier Azure Functions and Free Static Web App to do stuff. The definition of what I have deployed is all setup in Pulumi, so I have identical environments for Dev/Test/Prod mostly because I can rather than it being business critical or getting a lot of traffic.

I currently have 240Mb of data in my free MongoDb database, I have 512 Mb max storage to play with. I have plenty of data to play with at this tier, but I may investigate other options that involve storing less or what costs might be. I previously made use of cosmosDB, which was costing me between £10-£20 per month, so not breaking the bank, but also cheaper to use MongoDB.

Interrogating the Azure Cost Analysis tool reveals that my biggest cost is file storage (67p Prod, 101p Test and 93p Dev), I may investigate this a bit and see what is using this, but its not breaking the bank so I am pretty happy.

So what else does it cost to run my things?

My domains live on CloudFlare, I recently got a bill for £8.04 for a couple of renewals for the next 12 months. But I am struggling to think what else costs me to run my digital things.
Rebase is confusing
Tags: git, programming
Published: 2023-02-03 23:10:38

It was engraved into my mind the importance of doing a rebase. Having all commits compiled together into a singular one sounds amazing, and clean when sending out a pr.

Rebasing didn't sound bad, the steps were actually quite simple

1. Push a commit everytime you completed a section of your overall task
2. Once all is done, do a rebase interactive to main from your working branch and squash all of them together
3. Checkout to your working branch and push it

#### The Problem

The problem occurs when someone reviews the code, and I wanted to pass my newly added code. The rebase interactive doesn't seem to contain anymore values. That's a problem, because if I'm going to be pushing my updated code, I will now have two commit as to one. It doesn't sound like that big of a deal, but if you have to push a code every time someone does a review, you'll end up with several to up to a dozen commits on your pull request like [this](https://github.com/Seneca-CDOT/starchart/pull/56) pr did.

#### How to solve the issue

The steps I told at the start was not all wrong, but if you noticed one thing, I actually never do a pull upstream. What do you think would happen if I pass a code that is behind the main branch? I would have conflicts. If I simply keep on doing what I did with rebase, I will consistently have conflicts. Now you're asking, what are the actual steps onto doing a proper rebase? the same steps apply

1. Push a commit every time you completed a section of your overall task
2. Once all is done, do a rebase interactive to main from your working branch and squash all of them together `git rebase main -i `

Now you add extra steps...

3. Do a checkout to the main branch `git checkout main`
4. Update your main branch to its latest instance through `git pull upstream main`
5. Checkout back to your working branch

Now instead of pushing it, you do another rebase but there's no need for interactive, because you only have a single commit

6. Remember to do a force push, because you are trying to alter a previous branch history `git push -f origin main`

Always make sure that before you do anything, that your main branch is always clean. If you are not sure simply do a `git checkout -B main upstream/main`, this should reset your main to the latest commit from the original repo.

> Remember that `upstream` is only for fork repo, you should be using `origin` from your own
5 Tips to optimize Laravel Eloquent
Tags: laravel
Published: 2023-02-03 22:28:18

---
title: 5 Tips to optimize Laravel Eloquent
published: true
description: Actionable optimization tips for Laravel Eloquent
tags: Laravel
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-02-03 22:24 +0000
---
I published this post on my [Value In Brief website](https://valueinbrief.com/posts/tips-optimize-laravel-eloquent/). You can read it there.

## 1. Use eager loading to reduce the number of database queries

Eager loading is a technique that allows you to load related models in a single query, reducing the number of queries needed to retrieve data.

Eager loading is a way to reduce the number of database queries in Laravel. It allows you to load related models in a single query, reducing the number of queries needed to retrieve data.

For example, if you have a Post model and a Comment model, and each post has many comments, you can use eager loading to retrieve all posts and their related comments in one query:

```php
$posts = Post::with('comments')->get();
```

## 2. Use chunking when dealing with large datasets

Chunking allows you to process large datasets in smaller chunks, which can help reduce memory usage and improve performance.

## 3. Use caching to store frequently used data

Caching can help reduce the number of database queries and improve performance by storing frequently used data in memory or on disk.

Caching in Laravel can be used to store data that is expensive to generate or retrieve. For example, you could use caching to store a list of users that have recently logged in, so that you don't have to query the database every time you need to display the list.

In Laravel, caching is typically done using the Cache facade. To cache a value, you can use the put method:

```php
Cache::put('users_logged_in', $users, 60);
```

This will store the `$users` array in the cache for 60 minutes. To retrieve it later, you can use the get method:

```php
$users = Cache::get('users_logged_in');
```

Caching can be used in Laravel Eloquent to improve performance. For example, you can use the `remember()` method to cache a query result for a specified amount of time:

```php
$users = User::remember(60)->get();
```

## 4. Use scopes to filter results

Scopes allow you to filter results based on certain criteria, which can help reduce the amount of data returned from the database and improve performance.

## 5. Use indexes for faster lookups

Indexes can help speed up lookups by allowing the database engine to quickly locate records without having to scan through all records in a table.

Indexing is a great way to optimize your Laravel migrations. Here is an example of how you can use indexing to optimize your migrations:

```php
// Create a new table with an index on the 'name' column
Schema::create('users', function (Blueprint $table) {
    $table->increments('id');
    $table->string('name');
    $table->timestamps();

    // Index the 'name' column for faster lookups and sorting
    $table->index('name');
});
```
Introduction to Graphs
Tags: algorithms, programming, tutorial, beginners
Published: 2023-02-03 22:13:46

Welcome to a new post on 'In My Own Words', where we take on programming concepts and make them simple for the every-day learner. With easy-to-follow examples and explanations in plain language, join me on my journey to understand the world of programming. Let's get started!

Today we will be talking about Graphs! A common data structure used to solve a ton of different problems.

## Now what is a graph?

A graph is a data structure (an organized way to store information) that has vertices and edges. Now, those are some complicated words. Instead, let's refer to "nodes" as "dots" and "edges" as "connections" or "lines". 

A simple way to grasp the concept of a graph is to think of the childhood game "Connect the Dots". Just as in the game, a graph consists of points or nodes connected by lines or edges, creating a network of relationships between the nodes. This network can then be used to solve a variety of real-world problems and serves as the foundation of many crucial algorithms.

![image of connect the dots](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/la1gpuzdm7rqt8wg2lki.jpeg)

A graph is a visual representation of information and the relationships between it. For instance, you and your followers on Instagram can be represented as points, and the fact that they follow you is represented as a connection between those dots. The connection represents the relationship or interaction, in this case, following on Instagram.

## What are graphs useful for?

Have you ever wondered how Google Maps shows us the location of everything and provides us with routes that follow actual roads instead of a straight line path? They use graphs! Landmarks and intersections are represented as dots, and roads, streets, and highways are represented as connections. What we see as the map is just a satellite image of the Earth. The actual mapping happens beneath the image. 

When you ask the Google Maps app for directions from your current location to a destination, it first finds the two locations in the graph data structure where they are stored. Then, it runs an algorithm to find the shortest path between the two dots. In simple terms, Google Maps uses graphs to understand how different places are connected and then creates a path by connecting those dots in the most efficient way.

Graphs are a powerful data structure that has many practical applications in the real world. In the coming days, we will delve into some of the numerous algorithms related to graphs. I hope you found this informative and now have a clearer understanding of graph data structures. Thank you for reading!
Day 688 : Upgrade
Tags: hiphop, code, coding, lifelongdev
Published: 2023-02-03 22:09:58

_liner notes_:
- Professional : Pretty quiet day at work. I wrote up a draft of a talk abstract that I want to get some feedback from folks and submit next week. I also did an initial set of updates to a repo. I tested it after the changes and things still work. Going to double-check and get a review on Monday so that I can get a PR and get it merged. Not a bad day at all.

- Personal : Last night, I put together the tracks for the radio show and then typed them up. That's pretty much all I got done because I got a late start due to finishing up some stuff for work.

![The Huacachina, Peru white sand desert landscape with a lot of sand dunes](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x4umx70rcrd6w9ymzdzh.jpg)

Going to finish up the prep work for the radio show like finding artists' social media usernames. Looks like I have a dead battery on the Chromebook that I'm writing this blog post on. As long as it's plugged in, it's fine. As soon as I unplug the charger, it shuts off. I've had it for less than a year. Going to see what I need to get a new battery put in this weekend. I wonder if they'll give me an upgrade? I'll also probably go to the station to do the radio show even though there is a game because there's an event happening downtown and I know I'm going to want to drive from where I am to go.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube zvusxdso1lI %}
Writing Effective Higher-Order Components in React.js
Tags: webdev, programming, react, javascript
Published: 2023-02-03 21:44:10

---
title: Writing Effective Higher-Order Components in React.js
published: true
tags: [webdev, programming, react, javascript]
cover_image: https://www.bbss.dev/images/effective-hocs/cover.png
---

Many developers who experienced HOCs in the pre-hook era have been traumatized by the experience of data-provider HOCs and have stopped using them entirely as soon as they could.

I think that they were sworn off prematurely, and that there is room for them as long as you avoid using them in the wrong places.

I wrote a list of conventions to follow, and things to avoid in order to write HOCs effectively.

**Read it here: https://www.bbss.dev/posts/effective-hocs/**

Let me know what you think!
stop wasting time on meaningless news!
Published: 2023-02-03 21:36:24

- Do you often find yourself distracted from productive work, by attention sucking and meaningless news or propaganda?
- Stop it!
- You can stay inform about open source projects and important news enough.
- By reading only Github Trends and HackerNews.
- But, wouldn't it be perfect if everything you needed was in one place?
- Yes, it would.
- Check [this](https://github.com/norflin321/os-pulse) out!
Become a CSS Pro: The Ultimate Guide to Learning CSS
Tags: css, webdev, tutorial, beginners
Published: 2023-02-03 21:05:35

> To start with, I am beyond grateful and humbled to have reached **100 followers** on this platform! Your support and encouragement mean the world to me. I never could have imagined this level of engagement in a short period of time and I am so grateful for each and every one of you.
> **_Here's to many more followers and continued growth together!_**

## Moving to CSS
The title might be a bit of 'clickbait' because there is not only one way to learn CSS and master it, but I am here today to share with you my insights after almost 2 years of writing CSS.

What I recommend is to understand the basics like how to write CSS code meaning the syntax
`nav {
 display : flex;
}`
After learning basic selectors, box model, some text properties you just have to make your hands dirty and jump into your preferred code editor and start building some projects, start by cloning websites like Google, Wikipedia etc... ( just the front-end, we are not worrying about functionalities now ) 

Learning CSS can be a complex and challenging journey, but it can also be extremely rewarding. While starting with the fundamentals is important, the right order to learn CSS is not set in stone. After mastering the basics, the real key to learning CSS is to start creating. This will allow you to run into obstacles and limitations that you need to overcome, and will help you identify what you need to learn next in order to achieve your goals. The process may not be linear, but by tackling challenges and building upon your knowledge over time, you will gradually strengthen your understanding of CSS.

It's normal to feel frustrated at times, but it's important to remember that the journey to mastering CSS is not about following a specific roadmap, but about continually expanding your knowledge and skills. So, don't be discouraged by setbacks or detours along the way, and keep pushing yourself to learn more. And remember, the real reward is the ability to create beautiful, functional websites and web applications. So, embrace the challenge and keep pushing forward – the results will be well worth it!

Here is a Github repository with plenty of resources to learn CSS : 
[CSS For Beginners](https://github.com/lotfijb/html-css-for-beginners)

Follow me here :
[Visit my Portfolio](https://lotfijb.netlify.app)
[Github](https://github.com/lotfijb)
[LinkedIn](https://www.linkedin.com/in/lotfijbeli)
[Twitter](https://twitter.com/lotfijbe)

More reads :
[How did I build my portfolio](https://dev.to/lotfijb/portfolio-website-inspired-by-vs-code-103k)
[How did I build my first browser extension](https://dev.to/lotfijb/how-did-i-build-my-first-browser-extension--4jk8)
The go-like Return Style is Nice and Fast
Tags: go, typescript, benchmark, performance
Published: 2023-02-03 20:26:20

> **Disclaimer!**
>
> I am not a professional benchmarker. If there is any error in my logic, please let me know via [mail](mailto:didonato.fr@gmail.com) or [twitter](https://twitter.com/did0f).

[Source code](https://github.com/didof/benchmarks/tree/main/typescript/go-syntax)

![type Go<T> = [T, null] | [null, Error]; const [v, err] = do()](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/93g57ehbdkwbc1wf3ymt.png)

During a relaxed Friday evening consisting of lo-fi, chill, and code I found myself wanting to bring the syntax of go into typescript.

I refer to this:

```go
v, err := do()
if err != nil {
    os.Exit(1)
}
```

Trying to achieve:

```ts
const [v, err] = do()
if(err !== null) {
    process.exit(1)
}
```

## Implementation

```ts
type Go<T> = [T, null] | [null, Error]
```

With this very simple type, it is possible to infer this kind of syntax to the return type of a function:

```ts
function do(n: number): Go<number> {
    if (isEven(n)) {
        return [n ** n, null]
    }
    return [null, new Error("number is odd")]
}
```

So that when it is used you feel the nostalgia of goland:

```ts
const [v, err] = do()
```

## Benchmark

On my machine, the *go-syntax* seems to be much more fast than the *try-catch & throw* one.

Try it out yourself, here's the [Source Code](https://github.com/didof/benchmarks/tree/main/typescript/go-syntax):

```bash
yarn typescript @types/node
yarn start
``` 

## Inspiration

The first time I saw this syntax was in [await-to-js](https://www.npmjs.com/package/await-to-js). This simple little library (I recommend it) achieves the same result for *promises* (if used in conjuction with `await`).
As for the synchronous world, I think this solution of mine comes closest. Although it requires explicitly writing code in a certain way -- a way, in my opinion, better than throwing stuff around :)
🤯: Python `___` can be used in numbers ??
Tags: python, string, underscore, number
Published: 2023-02-03 20:24:26

> 💬: Comment Your Thoughts or Anything

---

# 👨‍💻: Code

```py
a = 1_00_00000.000_000
# b = 10000000.000000
# here b is same as a

print(f'{a:,}')
print('{:_}'.format(a))
```

# 🖥️: Output

![output of code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/llcygg2vu5182z83pkcd.png)

# 🤔: How to use it
- its numbers / double delimiter
- you can use underscore as a `,`
- which doesn't affect the value / meaning of the number
- Can't use it
  1. at start & end of number
  2. before & after the decimal point `.`
  3. or multiple underscores in a row

# 🔢: Maths
- its like the maths `,`
- which we use in daily life

# 🧵: fString
- while printing in console
- can use `fstring` to print it like that
- NOTE:
  - but it will come after every 3 digit in output
  - as American Standard
  - not how you added in Number

# 🏃‍♂️: to Run
- https://www.sololearn.com/compiler-playground/cVOb0s0mgJZS
- orignally was created on sololearn by me


# 👀: See also

- References / More Details / Might Help
- PEP 515 – Underscores in Numeric Literals
  - https://peps.python.org/pep-0515/
- What’s New In Python 3.6
  - https://docs.python.org/3/whatsnew/3.6.html

---

> ❤️: A Like would be appreciated if it was helpful
Tackling Kubernetes pre-deployment tasks and achieving quality deployments
Tags: news, devops, discuss, kubernetes
Published: 2023-02-03 19:45:38

In an ongoing efforts to provide K8s engineers with a consistent toolchain to achieve [pre-deployment quality](https://monokle.io/), we have extracted the core validation logic from our popular [Monokle Desktop tool](https://monokle.io/) - beefed it up with powerful configuration and extension mechanisms - and packaged it in a CLI and GitHub action to provide you with a one-stop solution to validate your Kubernetes YAMLs, consistently across teams and workflows, before you commit or deploy them to your cluster(s).

How do you currently handle your [pre deployment tasks](https://monokle.io/)?
Paracetamol.ts💊| #02: Explica este código TypeScript
Tags: typescript, webdev, spanish, programming
Published: 2023-02-03 19:43:52

## **<center>Explica este código TypeScript</center>**
#### <center>**Dificultad:** <mark>Básico</mark> </center>

```ts
enum Semana {
  Lunes,
  Martes,
  Miercoles,
  Jueves,
  Viernes,
  Sabado,
  Domingo,
}

let diaDivertido: Semana = Semana.Viernes;
console.log(diaDivertido); //???
```

- A. `Viernes`
- B. `4`
- C. `5`
- D. `Ninguna de las anteriores`

Respuesta en el primer comentario.

---
Day 5: TGIF
Tags: beginners
Published: 2023-02-03 19:40:07

End of the week! Feels good! We're wrapping up our first week by finishing up our assignments. Just absorbing what it feels like to be on an accelerated schedule. HTML and CSS in a few days. Next week moving on the Ruby programming, wireframing, and getting our domain names and servers set up.

I'm looking forward to the weekend and relaxing with my family.
ChatGPT will replace you in job?
Published: 2023-02-03 19:35:44

<p>ChatGPT is a chatbot that has been trained on a large dataset of human conversation, allowing it to generate human-like text. While ChatGPT is capable of generating coherent and useful responses to a wide range of prompts, it is important to understand its limitations and the role it can play in the job market.</p><p>One of the main limitations of ChatGPT is that it is only able to generate responses based on the information it has been trained on. While it can generate text that is coherent and human-like, it is not able to think or reason in the way that a human can. This means that it is not able to perform tasks that require complex problem-solving or decision-making.</p><p>In addition, ChatGPT is not able to perform physical tasks or interact with the real world in the same way that a human can. It is purely a text-based chatbot and does not have the ability to perform actions or manipulate objects.</p><p>Given these limitations, it is unlikely that ChatGPT or any other chatbot will be able to fully replace jobs that require complex problem-solving, decision-making, or physical tasks. While ChatGPT and other chatbots may be able to perform certain tasks more efficiently than humans, there are many jobs that will always require the unique capabilities of human workers.</p><p>However, it is important to note that ChatGPT and other chatbots may be able to automate certain tasks, potentially leading to some job displacement. It is important for workers to stay up-to-date with developments in technology and to be proactive in learning new skills in order to stay competitive in the job market.</p><p>In conclusion, while ChatGPT and other chatbots have the potential to automate certain tasks, they are unlikely to fully replace jobs that require complex problem-solving, decision-making, or physical tasks. However, it is important for workers to stay aware of developments in technology and to continue learning new skills in order to stay competitive in the job market.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7563ba47d0d5" width="1" height="1" alt=""></br><p style="color:#757CF9;">This article is published w/ <a target="_blank" href="https://scattr.io?ref=dev">Scattr  ↗️</a></p>