teleren/devto huggingface dataset:
A better way of using flutter packages
Tags: flutter, dart, mobile
Published: 2024-03-30 13:36:01

### Context
I have been using package_a (ex: fluttertoast package) in my flutter project and it worked well. However, for some reasons, I have decided to change to a similar but better package.



### Problem:
As soon as I change this package in my pubspec.yaml file, my IDE throws missing imports errors all over my codebase


1. Wrong way


![Wrong method of implementation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pjj8c1ofy5peo5l4sspf.png)


2. Better Approach
Create a separate class with a static method to display your toast


![Better approach](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vqjt563nbhgx8645zsy9.png)



### Call the static Method
In your app’s UI, invoke the static method to display your toast

![Calling static methods](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lf3kl5n2akfh2zm2q6ir.png)



### What did we fix?
The alert_service has the class for showing the alert. Rather than changing the implementation in all of our app’s UI as in the former, in the later, we just need to change the package in the alert_service where it is used



### Final Thoughts

Depending on other flutter packages is very important in flutter projects, however, it is important that even though we depend on these packages, we write modular and reusable code that is not too tightly coupled to dependencies.



### Let's connect

[Follow on X]("https://twitter.com/Yunweneric")
[Follow on LinkedIn]("https://www.linkedin.com/in/yunwen-eric-40517a147/")
The Frontend Challenge
Tags: frontendchallenge, devchallenge, css, javascript
Published: 2024-03-30 13:29:45

_This is a submission for DEV Challenge v24.03.20, Glam Up My Markup: Camp Activities_

## What I Built

I designed the given HTML layout with appropriate design colors, backgrounds, and SVG backgrounds. This form facilitates camp activity inquiries. Upon submission, it triggers a modal popup displaying the selected activity, any food allergies, and additional information provided by the user.
I always care about the user experience.

## Demo
{% codepen https://codepen.io/Rohitash-Singh/pen/poBWQPL %}


## Journey
Throughout this process, I figured out the importance of user experience, which can greatly enhance the overall design. Creating a form that not only looks appealing but also functions effectively has been a rewarding experience, leaving me feeling accomplished.

### MIT License

Copyright (c) 2024 Rohitash Singh

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so.

Happy coding 🚀
HTML FORM GLAM UP
Tags: frontendchallenge, devchallenge, css, javascript
Published: 2024-03-30 13:23:04

_This is a submission for DEV Challenge v24.03.20, Glam Up My Markup: Camp Activities_

## What I Built

I built an interactive HTML web form that gives feedback based on the user's input. If the input is invalid, a CSS animation will be applied to the element to notify the user of what they need to improve.

## Demo
[Demo Link](https://glam-up-my-markup.netlify.app/)

## Journey
I first added CSS styles to improve the look and feel of the form. I learned you can submit a form without sending data to a server using the JavaScript preventDefault method.
A Summary of the Battery Status API
Tags: frontendchallenge, devchallenge, javascript, webdev
Published: 2024-03-30 13:18:12

---
title: A Summary of the Battery Status API 
published: true
description: The Battery Status API helps track the status of a system's battery level
tags: frontendchallenge, devchallenge, javascript, webdev
cover_image: https://res.cloudinary.com/dz4tt9omp/image/upload/v1711375345/Creative_Pastel_Battery_Illustration_with_Motivational_Saying_Mouse_Pad_4.png
---

_This is a submission for DEV Challenge v24.03.20, One Byte Explainer: Browser API or Feature._

##Explainer
The **Battery Status API** helps track the status of a system's battery. It performs 4 basic tasks:
- Get current battery level.
- Charging status
- Battery discharge time
- Time until fully charged.

This API can optimize web app performance for battery efficiency

## Additional Context

Check out the video tutorial I created below on how to interact with the Battery Status API, on my YouTube channel:

{% embed https://youtu.be/kB7Bx4HfvWc %}
JavaScript Notifications API
Tags: frontendchallenge, devchallenge, javascript, webdev
Published: 2024-03-30 13:14:20

_This is a submission for DEV Challenge v24.03.20, One Byte Explainer: Browser API or Feature._

This API allows web pages to display notifications to users outside the page's normal context. It requests permission, then displays notifications using the Notification constructor. Useful for alerting users about updates without disrupting their browsing experience.
Explain API with 256 characters or less.
Tags: frontendchallenge, devchallenge, javascript, webdev
Published: 2024-03-30 13:13:36

_This is a submission for DEV Challenge v24.03.20, One Byte Explainer: Browser API or Feature._

## Explainer
<!-- Explain a browser API or feature in 256 characters or less. -->

## Additional Context
<!-- Please share any additional context you think the judges should take into consideration as it relates to your One Byte Explainer. -->

<!-- Team Submissions: Please pick one member to publish the submission and credit teammates by listing their DEV usernames directly in the body of the post. -->

<!-- Don't forget to add a cover image to your post (if you want). -->


<!-- Thanks for participating! -->


Cabeçalhos compatíveis.

Header - Descrição - Método - Exemplo

Authorization. - Seu token - Todas -
                 de portador

x-api-key - Sua chave - Todas -

            de API              5102885b24cbd003d33c0.

x-jw-ims-org-id. - Sua ID da - Todas. -
                 organization.  234bc00234caf0faa6f99.

Content-Type. - Formato  -   PUT,  - application/json.
                do conteúdo  POST.
                enviado ou
                recebido.

Accept-   -   Idioma.  -   Opcional.  -   en-US
Language.     usado para
              mensagem
              de erro.

Parâmetros de POI.

Parâmetro. - Descrição. - Tipo. - Limite.

street. - Endereço do - string. - 256.
          POI.                    caracteres.

country. - País de - string. - 32.
           POI.                caracteres.
OhMyPunk - Remember Last Tab Open in HTMX
Tags: webdev, php, htmx, devjournal
Published: 2024-03-30 13:10:07

**_When I working with HTMX, I should remember using `htmx` Events instead using native JavaScript Events to listen some event when DOM is swapped!_**

---

## The ~~Cash~~ Case Is

When I need to my Tabs Markup is remembering the last tab open. In my primitive experience is using javascript [`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/API/Document/DOMContentLoaded_event) is enough.

```javascript
document.addEventListener("DOMContentLoaded", function() {
  var lastTab = localStorage.getItem("lastTab");
  if (lastTab) {
    var tab = document.querySelector('input[name="view_tabs"][aria-label="' + lastTab + '"]');
    if (tab) {
      tab.checked = true;
      tab.dispatchEvent(new Event('change'));
    }
  }

  var tabs = document.querySelectorAll('input[name="view_tabs"]');
  tabs.forEach(function(tab) {
    tab.addEventListener('change', function() {
      localStorage.setItem("lastTab", this.getAttribute('aria-label'));
    });
  });
});
```

But it's wrong! Stupid! Yes I am.

### Why?

_The `DOMContentLoaded` event fires when the HTML document has been completely parsed, and all deferred scripts (`<script defer src="…">` and `<script type="module">`) have downloaded and executed. It doesn't wait for other things like images, subframes, and async scripts to finish loading._

_`DOMContentLoaded` does not wait for stylesheets to load, however deferred scripts do wait for stylesheets, and the DOMContentLoaded event is queued after deferred scripts. Also, scripts which aren't deferred or async (e.g. `<script>`) will wait for already-parsed stylesheets to load._

_A different event, load, should be used only to detect a fully-loaded page. It is a common mistake to use load where `DOMContentLoaded` would be more appropriate._

_This event is not cancelable._

Source: [MDN Web Docs - DOMContentLoaded](https://developer.mozilla.org/en-US/docs/Web/API/Document/DOMContentLoaded_event)

### But, in HTMX Event - `htmx:load`

_This event is triggered when a new node is loaded into the DOM by htmx._ Source: [htmx:load](https://htmx.org/events/#htmx:load)

## So, The Solving ~~Cash~~ Case

Just change the `DOMContentLoaded` to `htmx:load`

```javascript
document.addEventListener("htmx:load", function() {
  var lastTab = localStorage.getItem("lastTab");
  if (lastTab) {
    var tab = document.querySelector('input[name="view_tabs"][aria-label="' + lastTab + '"]');
    if (tab) {
      tab.checked = true;
      tab.dispatchEvent(new Event('change'));
    }
  }

  var tabs = document.querySelectorAll('input[name="view_tabs"]');
  tabs.forEach(function(tab) {
    tab.addEventListener('change', function() {
      localStorage.setItem("lastTab", this.getAttribute('aria-label'));
    });
  });
});
```

🛑 Case closed!
Building Linux Commands From Scratch 🐧 clear Command
Tags: linux, programming, c, cli
Published: 2024-03-30 13:03:25

Here i am building **_clear_** command from scratch in C/C++. The **_clear_** command is used to clear the terminal screen.

---

This command can be implemented in many ways. Here are some of the methods.

```c
#include <stdio.h>
#include <sys/ioctl.h>
#include <unistd.h>

int main()
{
  // Get Terminal Size

  struct winsize w;
  ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);

  // printf("%d %d\n", w.ws_row, w.ws_col);

  for (int i = 0; i < w.ws_row + 40; i++)
    printf("\n");

  printf("\033[0;0H");

  return 0;
}
```

```c
struct winsize w;
```

Here **winsize** is a structure that has **ws_row**, **ws_col** as members. This can be populated using **ioctl()**.

```c
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
```

```c
int ioctl(int __fd, unsigned long __request, …);
```

This is the function prototype of the ioctl().


![Clear Command](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/071oc7tjm5dqo9taxkqa.png)

Here we will print **“\n”** for **Terminal Rows + 40** times. This will although works but the prompt will be moved to the bottom. However _ASCII sequence_ **“<esp>[m;hH”** can be used to move the cursor to the top left of the terminal.


![Clear Command](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bagj2wde8cd9oxqjgs71.png)

```c
printf("\033[0;0H");
```

This will move the cursor back to the top left of the terminal.

This is will work exactly like clear command, but there is another _ASCII sequence_ that will directly clear the terminal screen.


![Clear Command](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qfreovd4gwt3adeb0rnn.png)

```c
printf("\033c");
```

This is another method for writing the clear command and an easy one (just one line to clear the screen).

```c
#include <stdio.h>

int main()
{
  printf("\033c");

  return 0;
}
```


![Clear Command](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/maio9wjj27zuja8m5w86.png)

Also instead of loop and ASCII sequence, the ASCII sequence also works just fine.

```c
#include <stdio.h>

int main()
{
  printf("\033[0;0H");

  return 0;
}
```


![Clear Command](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vm55riga7i1n2iw0n2y2.png)

The code can be found at [GitHub](https://github.com/surajkareppagol/Linux-Commands).

{% embed https://www.youtube.com/watch?v=PYXfm5FCeBE %}
What was your first coding project?: CodeNewbie Podcast
Tags: codenewbie, career, podcast
Published: 2024-03-30 13:00:00

Hello hello and welcome back to CodeNewbie Podcast, our little corner of DEV in which we share weekly interviews with tech professionals to give you supportive advice to further your development career.

This week we released our second episode of this season with [Pau Labarta Bajo](https://twitter.com/paulabartabajo_?lang=en), Machine Learning Engineer and Educator at Real-World Machine Learning. We talk about what career paths lead to Machine Learning, why data is everything, and early career skill development.

-----

_If you would like to listen you can:_

- [Listen on Apple Podcasts](https://podcasts.apple.com/us/podcast/codenewbie/id919219256?i=1000650593602)

- [Listen on Spotify](https://open.spotify.com/episode/5wiv58hooMfl0Vhdwx0wZt?si=a19c235b7bc648f1)

- Listen right here on DEV:

{% podcast https://dev.to/codenewbie/s27e3-helping-you-build-machine-learning-products-pau-labarta-bajo %}

Or, listen wherever you normally get your podcasts.

-----

At the end of each episode we have four main questions we ask our guests, then I bring my favorite question of the week over here, where we can chat all about it. 

**This week's question is: "What was your first coding project?"**

Pau had a great response, which you'll have to tune in to hear fully, about his first project building a natural language-processing model to automate customer support tickets. In his words, "It was a disaster". As it goes, our best projects are sometimes complete failures, which turn into great stories and learning experiences.

---

**So without further ado, please tell me your first coding project! Was it a disaster or complete win? How long did it take you? Do you still stand by it?**

See ya next week with our new episode.
Unlocking Procurement Excellence with SAP Ariba Cloud Integration Gateway (CIG) in Chennai
Tags: training, services, sap
Published: 2024-03-30 12:46:30

Discovеr thе powеr of SAP Ariba Cloud Intеgration Gatеway (CIG) in Chеnnai, whеrе businеssеs arе transforming thеir procurеmеnt procеssеs into sеamlеss, еfficiеnt opеrations. SAP Ariba CIG sеrvеs as a vital componеnt in thе procurеmеnt landscapе, providing a unifiеd platform for connеcting buyеrs and suppliеrs. In Chеnnai, organizations arе lеvеraging SAP Ariba CIG to strеamlinе thеir supply chain, еnhancе collaboration, and drivе significant cost savings.

Chеnnai, bеing a thriving hub for businеssеs, is witnеssing a rapid adoption of SAP Ariba CIG to intеgratе divеrsе procurеmеnt systеms and еnablе rеal-timе data еxchangе. With SAP Ariba CIG, companiеs in Chеnnai can achiеvе еnd-to-еnd visibility into thеir procurеmеnt procеssеs, еnsuring transparеncy and compliancе. This cutting-еdgе solution not only simplifiеs intеgration but also еnhancеs thе ovеrall еfficiеncy of procurеmеnt activitiеs, contributing to thе growth of businеssеs in thе dynamic Chеnnai markеt.

As Chеnnai еmеrgеs as a kеy playеr in thе global businеss landscapе, SAP Ariba CIG stands as a catalyst for digital transformation. Companiеs in thе rеgion arе rеcognizing thе importancе of staying ahеad in thе compеtitivе markеt, and SAP Ariba CIG sеrvеs as a stratеgic еnablеr for achiеving that goal. Elеvatе your procurеmеnt capabilitiеs and stay at thе forеfront of innovation with [SAP Ariba CIG in Chеnnai](
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1b024yabhk6h5t7dhbhe.png)

) – thе gatеway to a morе connеctеd and еfficiеnt procurеmеnt еcosystеm.
Worried about jobs after Devin AI? Let's start small to improve ourselves and delve deeper into computer science.
Published: 2024-03-30 12:44:15

---
title: Worried about jobs after Devin AI? Let's start small to improve ourselves and delve deeper into computer science.
published: true
description: 
tags: 
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2024-03-14 12:16 +0000
---
I'm a Frontend Software Engineer, but nowadays worried about future as LLM and AI takeover, or maybe just reduce jobs flow.
but lets start with something, I'm starting with this article 

 ["Navigating the future of frontend"](https://conffab.com/elsewhere/navigating-the-future-of-frontend/)

{% embed https://conffab.com/elsewhere/navigating-the-future-of-frontend %}
Web Notifications API — One Byte Explainer
Tags: frontendchallenge, devchallenge, javascript, webdev
Published: 2024-03-30 12:36:28

_This is a submission for DEV Challenge v24.03.20, One Byte Explainer: Browser API or Feature._

## Explainer ⚡
Imagine you ordered food from a restaurant but you don't get a reminder once it's ready.

That's the pain Notifications API deems to solve.

It sends notifications displayed at a system level, so even when you're absent you are alerted when your food is ready.


![Structure of how a notification works](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m26k3b7ikn7mowwb0wmt.png)

## Additional Context ✍️
Websites becoming more advanced as applications these days have made them more interactive in our everyday lives, hence the in-built Notifications API is highly useful for web apps, PWAs, or even websites.

Although it's quite difficult to get straight into coding once you understand the concept, the good news is that MDN has a great [example](https://github.com/mdn/dom-examples/tree/main/to-do-notifications) that can get you started on it and learning [documentation](https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API/Using_the_Notifications_API) that you can refer if you get stuck.

## Bonus Reading 💖
- [Notifications API](https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API)
- [Smallest example on the internet](https://www.javascripttutorial.net/web-apis/javascript-notification/)
- If you're a video person, Web Dev Simplified has a great video. — [How To Send Push Notifications With JavaScript]
(https://www.youtube.com/watch?v=Bm0JjR4kP8w)

_Let me know if you liked it at [@thebuildguy](https://twitter.com/thebuildguy)_


<!-- Team Submissions: Please pick one member to publish the submission and credit teammates by listing their DEV usernames directly in the body of the post. -->

<!-- Don't forget to add a cover image to your post (if you want). -->


<!-- Thanks for participating! -->
Vim Navigation
Published: 2024-03-30 12:35:11

Navigation:
h: Move cursor left.
j: Move cursor down.
k: Move cursor up.
l: Move cursor right.
gg: Move to the first line of the file.
G: Move to the last line of the file.
Ctrl + b: Move one page up.
Ctrl + f: Move one page down.
0: Move to the beginning of the line.
$: Move to the end of the line.
w: Move forward one word.
b: Move backward one word.
Editing:
i: Enter insert mode before the cursor.
I: Enter insert mode at the beginning of the line.
a: Enter insert mode after the cursor.
A: Enter insert mode at the end of the line.
o: Open a new line below the current line.
O: Open a new line above the current line.
x: Delete the character under the cursor.
dd: Delete the current line.
yy: Yank (copy) the current line.
p: Paste the yanked or deleted text after the cursor.
u: Undo the last change.
Ctrl + r: Redo the last undone change.
.: Repeat the last change.
Saving and Exiting:
:w: Write (save) the file.
:q: Quit Vim.
:q!: Quit Vim without saving changes.
:wq: Write the file and quit Vim.
:wq!: Write the file and quit Vim, overriding read-only mode if necessary.
Searching and Replacing:
/pattern: Search for a pattern.
n: Move to the next occurrence of the search pattern.
N: Move to the previous occurrence of the search pattern.
:%s/old/new/g: Replace all occurrences of "old" with "new" in the entire file.
Miscellaneous:
:help: Open the help documentation.
:set number: Display line numbers.
:set nonumber: Hide line numbers.
:syntax on: Enable syntax highlighting.
:syntax off: Disable syntax highlighting.
Optifit - Pengurangan berat badan yang berhasil?
Tags: optifit
Published: 2024-03-30 10:49:57

Melenyapkan Musuh, peningkatan pola makan, dapat diambil terlepas dari makanan. Orang-orang yang memiliki perut halus perlu membawanya dengan makanan untuk menjauh dari kesal. Petunjuknya adalah mengambil satu porsi, yaitu tiga kasus, setelah bangun di bagian pertama hari itu.

Anda dapat memiliki porsi lain, kapan pun diperlukan, namun harus diperlukan enam hingga delapan jam setelah fakta. Hal ini dicatat untuk tidak mengambil peningkatan dalam tidak kurang dari empat jam tertidur. Hasil yang ideal dapat dicapai dengan mengambil peningkatan bersama rutinitas makan yang solid dan tetap terhidrasi sepenuhnya.


Estimasi [Optifit](https://www.ulasan-id.com/optifit/
)
Anda dapat menemukan Annihilate the Adversary, Fat Destroyer langsung di situs fasilitas Run Everything Research. Satu kendi berisi sembilan puluh kotak, yang bisa lebih dari tiga puluh porsi, kecuali jika Anda memilih untuk mengambil lebih dari satu porsi sehari. Berikut adalah biaya per botol:

Optifit: $39.99
Siapa yang Membuat Optifit?
Seperti yang baru-baru ini dirujuk, Annihilate the Foe, Fat Destroyer dibuat oleh fasilitas Run Everything Research. Jalankan Semua itu Fasilitas penelitian telah menjadikannya tujuan utama mereka untuk membuka pintu bagi mereka yang kurang beruntung dan untuk membangkitkan individu untuk mengumpulkan kehidupan yang lebih baik dan signifikan.



They need to have an effect in individuals' lives and, thus, have those individuals have an effect in others' lives. A level of each and every deal, Run All that Research centers makes, is given to good cause or a non-benefit association. The organization loves not exclusively to make great items for individuals, however to offer back through these items and help other people out of luck.

In the event that you are intrigued, Run All that Research facilities conveys various different items. From supplements for muscle building and fat misfortune, to wellbeing and health, and that's only the tip of the iceberg. They even have their own line of clothing.



[https://www.ulasan-id.com/optifit/
](https://www.ulasan-id.com/optifit/
)
[https://www.ulasan-id.com/foliq/
](https://www.ulasan-id.com/foliq/
)
[https://www.ulasan-id.com/glucofix/
](https://www.ulasan-id.com/glucofix/
)
[https://www.ulasan-id.com/nutrivitex/
](https://www.ulasan-id.com/nutrivitex/
)
[https://www.ulasan-id.com/optikon/](https://www.ulasan-id.com/optikon/)