teleren/devto huggingface dataset:
A crash course in using Bunjs instead of Node.js on Linux
Tags: linux, bunjs, node, tutorial
Published: 2024-06-09 15:23:54

# Transitioning from Node.js to Bun on Linux: A Complete Guide

## Introduction

In the evolving world of JavaScript, Bun is quickly making a name for itself as a high-performance runtime environment that's compatible with Node.js but significantly faster. This guide will walk you through the basics of getting started with Bun on a Linux system, and how it compares to the traditional Node.js setup.

## Installation

### Step 1: Install Bun

To install Bun on your Linux system, open your terminal and run the following command:

```bash
curl -fsSL https://bun.sh/install | bash
```

This command downloads and installs Bun, automatically adding it to your path for immediate use.

## Basic Commands

Here are some basic Bun commands to get you started:

- **Run a script**: `bun run app.js`
- **Install a package**: `bun add express`

## Creating a Web Server with Express

Let's create a simple web server using Express. First, install Express using Bun:

```bash
bun add express
```

Then, create a file named `app.js` and add the following code:

```javascript
import express from 'express';

const app = express();
const port = 3000;

app.get('/', (req, res) => {
  res.send('Hello World with Bun!');
});

app.listen(port, () => {
  console.log(`Server listening at http://localhost:${port}`);
});
```

Run your server with:

```bash
bun run app.js
```

## Differences from Node.js

Bun is designed to be faster and more efficient than Node.js:

- **Performance**: Uses a high-speed JavaScript engine.
- **Built-in package manager**: Simplifies your workflow by integrating package management.

## Conclusion

Transitioning to Bun can significantly enhance your development workflow and application performance. Give it a try and see the difference for yourself!

---
Say "Oui" to Global Users: Localize Your Flutter App with Gemini
Tags: flutter, gemini
Published: 2024-06-09 15:09:41

Why localize your app?  Think about it, ignoring international users is like making a fire meme and forgetting to post it online - what's the point?  But don't worry, we hear you screaming Fear not, for Gemini is here to  be your Yoda in the localization swamp.  We'll tackle all your app translation woes, so buckle up and get ready for a smooth ride and dive deep with us in this post!

**What is localization and How it's done?**
To conquer the globe, you need some serious localization skills.

Think of locales as your app's Rosetta Stone – they unlock the ability to understand different languages, date formats (no more confusing July 4th with 4th of July!), currencies, and all those cultural nuances. So, French users see euros and "dd/mm/yyyy," while Spanish speakers get their pesos and the familiar "dd/mm/aaaa."

Now, managing these locales can feel like herding cats. But fear not, there's a better way than wrestling with JSON files (because, let's be honest, that's a recipe for disaster).
Enter the dynamic duo of flutter_localizations and intl – these packages are your knight in shining armor, recommended by the official Flutter people themselves.

Here's the battle plan:

- Recruit your allies: Integrate flutter_localizations and intl into your app.
- Set up your command center: Create a l10n.yaml config file.
```yaml
arb-dir: lib/l10n
template-arb-file: app_en.arb
output-localization-file: app_localizations.dart
```
- Deploy your troops: Create .arb files under the lib/l10n folder (or a location of your choosing, just update the config file accordingly). These .arb files will house all your app's localized strings.

With this battle plan in place, you'll be a localization champion in no time, ready to take your app to a global phenomenon!

**With Gemini**
Feeling overwhelmed by app localization? Manually translating endless lines for every language can be a daunting task. But fear not, developer! Google Gemini has your back with the arb_translate package.

Think of arb_translate as your personal localization assistant. You simply write the default translations, and then unleash the power of Gemini! With a single arb_translate command, Gemini translates all the other languages you need, taking context (e-commerce, cars, coding?) into account for natural-sounding translations.

Ditch the manual translation grind and let Gemini be your localization hero. It's a much more efficient way to conquer the world with your app! Now that you've got a taste of Gemini's localization magic.

why not jump in and try it for yourself you can finally overcome the language barrier and reach new heights, just like Lara Croft raiding tombs and uncovering hidden treasures across the globe!

- [https://docs.flutter.dev/ui/accessibility-and-internationalization/internationalization](https://docs.flutter.dev/ui/accessibility-and-internationalization/internationalization) 

- [https://pub.dev/packages/arb_translate](https://pub.dev/packages/arb_translate)
JavaScript Client-Side Development: Tips and Tools for Mastery 🚀
Tags: javascript, webdev, tutorial, python
Published: 2024-06-09 15:00:10

Welcome to our forum dedicated to mastering JavaScript for client-side development! Whether you're a beginner looking to learn the basics or a seasoned developer aiming to sharpen your skills, this is the place for you. Join us to explore essential tools, frameworks, and libraries that enhance your JavaScript development experience. Learn techniques to optimize your code for faster, more efficient applications and share best practices to write clean, maintainable, and scalable JavaScript code.

Discuss real-world scenarios and solutions, from simple scripts to complex single-page applications, and get help and offer advice on troubleshooting and debugging common JavaScript issues. Stay updated with the latest trends, updates, and innovations in the JavaScript ecosystem.

Engage with a community of passionate developers, ask questions, share insights, and grow your expertise in JavaScript client-side development. Let's code together and take our JavaScript skills to the next level! 🚀
JavaScript Coding Interview Questions
Published: 2024-06-09 14:27:46

Q1. Reverse this string

```JS
let str = "Hello, World!";
let s = str.split("").reverse().join("");
console.log(s);
```


Q2. Remove duplicates
```JS
let arr = [1,2,3,4,5,6,6];

//let s = new Set();
let s = new Set(arr);
s.add(...arr);

for(let i =0;i<arr.length;i++){
  s.add(arr[i]);
}

console.log(s);
```

Q3. Can you write a function in JavaScript to convert a string containing hyphens and underscores to camel case? transformation of the string “secret_key_one” into camel case results in “secretKeyOne.”

```JS
let str = "secret_key_one";
let s = str.split("_");
console.log(s);
let ans = "";

for(let i = 0;i<s.length;i++){
  if(i!=0){
    ans+=s[i].substring(0, 1).toUpperCase();
    ans+=s[i].substring(1);
  }
  else{
    ans+=s[i];
  }
}

console.log(ans);
```

Q4. Swap two numbers

```JS
let a =1, b=2;

Ans 1
a = a ^b;
b = a^b;
a = a^b;

console.log(a, b);

Ans 2
[a b] = [b.a];
```




Q5. Flatten this array

```JS
const arr = [1, 2, [3, 4]];
let ans = [];

const flatternArray = (arr) => {
  for(let i =0;i<arr.length;i++){
    if(Array.isArray(arr[i])){
      flatternArray(arr[i]);
    }else{
      ans.push(arr[i]);
    }
  }
    // console.log(ans);
};

flatternArray(arr);
console.log(ans);
```



Q6. const nestedObject = { a: { b: { c: 42 } } };
const propertyPath = 'a.b.c';
const result = deepAccess(nestedObject, propertyPath);
// result: 42

```JS
const nestedObject = { a: { b: { c: 42 }, z:{a:19} } };
const propertyPath = 'a.z.a';

// result: 42
let obj;
let arr = propertyPath.split('.');
// console.log(str);

const deepAccess = (nestedObject, arr) => {
  if(arr.length==1){
    // console.log("Reached end",nestedObject[arr[0]]);
    return nestedObject[arr[0]];
  }
  let i = arr[0];
  // console.log(i);
  nestedObject = nestedObject[i];
  arr.shift();
  // console.log(arr);
  return deepAccess(nestedObject, arr);
};

const result = deepAccess(nestedObject, arr);
console.log(result);
```

OR

```JS
let ans = arr.reduce((obj, ele) =>{
  return obj[ele];
}, nestedObject);

console.log(ans);
```
Using Phoenix.PubSub as a message-bus for Elixir cluster
Tags: elixir, cluster, messagebus, pubsub
Published: 2024-06-09 14:44:45

In my sharing session about using Phoenix.PubSub as message-bus for Elixir cluster, it quite simple and effective way for small & medium system. Now I recap it.


![bus-message between two processes of two nodes](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cq14bm1rimlgxlmr2je1.png)
(Simple case for using Phoenix PubSub to create a bus-message for two or more processes in different nodes)

For standalone Elixir app (without Phoenix framework), we need add depend libraries to mix file:
```Elixir
  defp deps do
    [
      {:phoenix_pubsub, "~> 2.1"},
      {:libcluster, "~> 3.3"}
    ]
  end
```
`:phoenix_pubsub` is a library from Phoenix framework, it can run without framework.
`:libcluster` is a new way to run Elixir app in cluster by declare config in `config.exs`
```Elixir
config :libcluster,
  topologies: [
    local_epmd: [
      # The selected clustering strategy. Required.
      strategy: Cluster.Strategy.LocalEpmd,
      # Configuration for the provided strategy. Optional.
      config: [hosts: [:"frontend_1@127.0.0.1", :"front_end_2@127.0.0.1", :"trading@127.0.0.1"]],
      # The function to use for connecting nodes. The node
      # name will be appended to the argument list. Optional
      connect: {:net_kernel, :connect_node, []},
      # The function to use for disconnecting nodes. The node
      # name will be appended to the argument list. Optional
      disconnect: {:erlang, :disconnect_node, []},
      # The function to use for listing nodes.
      # This function must return a list of node names. Optional
      list_nodes: {:erlang, :nodes, [:connected]},
    ]]
```
This is simple config for running cluster by `:libcluster`

In Phoenix app just add `:libcluster` & its config are enough.

In `Application` module in app need to add `PubSub` as a child process to application supervisor (or your supervisor)
```Elixir
    children = [
      {Phoenix.PubSub, name: Trading.PubSub},
      ...
    ]
```
In process need to receive message from message-bus we need to run `subscribe` to subscribe a topic on a PubSub like:
```Elixir
PubSub.subscribe(pubsub_name, topic_name)
```
`pubsub_name` is name of PubSub we create in supervisor.
`topic_name` is name of topic in PubSub we want
 to receive messages.

When have a message we will receive it as a message in our process or `handle_info`if we used GenServer.

After done with PubSub we need to `unsubscribe` to remove process out of PubSub (in case we don't remove, messages will be dropped if our process exited).

If want to send message to bus we need to use `broadcast` function to send messages:
```Elixir
PubSub.broadcast(pubsub_name, topic, {:join,  my_id, "Hello"})
```
`{:join,  my_id, "Hello"}` is our message.

Now, we can send message around cluster with a little effort.

**Conclusion**
`:libcluster` help us join apps to cluster just by add config.
`:phoenix_pubsub` help us send message cross cluster.

Source available at our [Github repo](https://github.com/ohhi-vn/live_pub_demo)
easiest way to print sqls in entity framework
Published: 2024-06-09 14:42:52

Let say you have DbContext like below
```C#
public class Database(DbContextOptions<Database> options) : DbContext(options)
{
    public DbSet<Todo> Todos => Set<Todo>();
}
```
Just want to print generated SQLs use below class
```C#
public class Database(DbContextOptions<Database> options) : DbContext(options)
{
    public DbSet<Todo> Todos => Set<Todo>();
    
    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        => optionsBuilder.LogTo(Console.WriteLine);
}
```
Example generated SQLs for my test app
```shell
09/06/2024 15:37:42.815 RelationalEventId.CommandExecuting[20100] (Microsoft.EntityFrameworkCore.Database.Command)
      Executing DbCommand [Parameters=[], CommandType='Text', CommandTimeout='30']
      SELECT "t"."Id", "t"."Content", "t"."Done"
      FROM "Todos" AS "t"
info: Microsoft.EntityFrameworkCore.Database.Command[20101]
      Executed DbCommand (0ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
      SELECT "t"."Id", "t"."Content", "t"."Done"
      FROM "Todos" AS "t"
info: 09/06/2024 15:37:42.815 RelationalEventId.CommandExecuted[20101] (Microsoft.EntityFrameworkCore.Database.Command)
      Executed DbCommand (0ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
      SELECT "t"."Id", "t"."Content", "t"."Done"
      FROM "Todos" AS "t"

```
Why You Need a Portfolio Website
Tags: webdev, programming, jobs, tutorial
Published: 2024-06-09 14:20:11

Having a portfolio website is crucial for professional growth in today's competitive job market. Here's why
**heres my portfolio website link drop a review and shares yours
https://abdullahs-portfolio.vercel.app/**

**Showcase Your Profile
**

- First Impressions Matter: A well-designed portfolio site makes a strong first impression, setting you apart from the competition.
- Personal Branding: It allows you to build and showcase your personal brand effectively.
- Professional Storytelling: You can tell your professional story in a visually appealing and engaging way.

**Highlight Your Project Expertise**

- Detailed Case Studies: Present detailed case studies to illustrate your problem-solving abilities and project management skills.
- Visual Proof of Work: Include images, videos, and interactive elements to bring your projects to life.
- Client Testimonials: Feature testimonials from satisfied clients to build trust and credibility

**Demonstrate Your Skills**

- Show Skills in Action: Display concrete examples of your skills through portfolio pieces like design mockups, code snippets, or writing samples.
- Thought Leadership: Share tutorials, blog posts, or articles to demonstrate your expertise and thought leadership in your field.
- Versatility: Highlight your versatility by showcasing a range of projects and skills.

heres my portfolio website link where its demonstrated 
_https://abdullahs-portfolio.vercel.app_
Key Features of the Best Infant Carriers
Published: 2024-06-09 14:10:50


**Comfort and Support:** The best infant carriers provide optimal comfort and support for both you and your baby. Look for carriers with wide, padded shoulder straps and a supportive waist belt to distribute your baby’s weight evenly. Ensure that the carrier has a sturdy, adjustable seat that supports your baby’s hips and thighs in an ergonomic “M” position.

**Adjustability:** As your baby grows, you’ll want a carrier that can adapt to their changing size. Choose a carrier with adjustable straps and buckles that allow you to customize the fit for both you and your baby. Some carriers even offer multiple carrying positions, such as front-facing, hip-carrying, and back-carrying, to accommodate your baby’s development.

**Breathability: ** Babies can get hot and sweaty when pressed against your body, so it’s essential to choose a carrier made from breathable, lightweight materials. Look for carriers with mesh panels or moisture-wicking fabrics that help regulate your baby’s temperature and prevent overheating.

**Safety:** Your baby’s safety is paramount, so make sure to choose a carrier that meets safety standards and has been tested for quality. Look for carriers with secure buckles, sturdy stitching, and a wide, supportive base that keeps your baby’s airway clear.

**Ease of Use:** As a busy parent, you’ll appreciate a carrier that is easy to put on and take off. Look for carriers with simple, intuitive designs that allow you to quickly adjust the fit and securely place your baby in the carrier. Some carriers even come with handy features like built-in storage pockets or a removable sun hood.

source: [bestinfantcarrier.com](https://bestinfantcarrier.com/)
Best beaches in the world
Tags: frontendchallenge, devchallenge, css
Published: 2024-06-09 14:04:52

This is a submission for [Frontend Challenge v24.04.17](https://dev.to/challenges/frontend-2024-05-29), CSS Art: 09-June-2024

## Inspiration
It's my first time doing something out of my comfort zone. I'm excited to participate in this challenge and eager to take on even more challenges to improve my skills.
<!-- What are you highlighting today? -->

## Demo 
[Demo link](https://6665af80971505d6121bda73--best-beaches-in-the-world.netlify.app/)
[Github](https://github.com/Nisha091999/Best-Beaches-in-the-World)
CSS Font from [Google Font](https://fonts.google.com/)
Hosted the website using [netlify](https://www.netlify.com/)

<!-- Show us your CSS Art! You can directly embed an editor into this post (see the FAQ section of the challenge page) or you can share an image of your project and share a public link to the code. -->

## Journey 
It's been a few months since I last worked on a web application, and I learned a lot during this challenge. Even though I didn't have much time to make it more creative, I'm glad that I participated in it. 
<!-- Tell us about your process, what you learned, anything you are particularly proud of, what you hope to do next, etc. -->

<!-- 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. -->

<!-- We encourage you to consider adding a license for your code. -->

## MIT License

Copyright (c) 2024 Nishanthi

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, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
<!-- Don't forget to add a cover image to your post (if you want). -->

<!-- Thanks for participating! -->
Identifying Container Image Vulnerabilities with Docker Scout
Tags: docker, security, cicd, kubernetes
Published: 2024-06-09 13:39:54

---
title: Identifying Container Image Vulnerabilities with Docker Scout
published: true
description: A guide on how to maintain a more secure containerized software.
tags: Docker, Security, CICD, Kubernetes
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2kcgwo2gueldysu9l05q.jpeg
---

![diagram](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2kcgwo2gueldysu9l05q.jpeg)

[Read the full article on packagemain.tech](https://packagemain.tech/p/identifying-container-image-vulnerabilities)
Unified Cache Keys: How Namespaced Keys Improve Service Interoperability
Tags: redis, systemdesign, microservices, distributedsystems
Published: 2024-06-09 13:36:57

---
title: Unified Cache Keys: How Namespaced Keys Improve Service Interoperability
published: true
description: More than just random keys in a Redis.
tags: Redis, SystemDesign, Microservices, DistributedSystems
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/653484m9d6f6x0m78sav.jpg
---

![diagram](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/653484m9d6f6x0m78sav.jpg)


[Read the full article on packagemain.tech](https://packagemain.tech/p/unified-namespaced-cache-keys)
TronFc cloud mining platform, register and get 38000TRX
Tags: mining, minimicro
Published: 2024-06-09 13:28:47


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4qs3392wb1dxjwdr5ie6.jpg)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0wkfk05ybeotixeppw1p.jpg)#TronFcRegister now: http://tronfc.fun
#TronFcOfficial Telegram Channel: https://t.me/TronFc_Mining8
#TronFcOfficial Telegram Online Customer Service: https://t.me/Tron_Minning_7
Three ways to make money on the platform↓↓↓
The first way: current deposits-the funds deposited in the [basic account] receive mining income once a day.

vip1 current deposits of more than 20, daily interest 8%

vip10 current deposits of more than 500,000, daily interest 29%

The second way is regular deposits-deposit funds into the [wallet account], click on the investment at the bottom of the homepage, select regular investment, and repay the principal and interest in one lump sum when it expires.

#TRONFC

The third way: You can share and invite friends to join through any social platform Tiktok, Facebook, Instagram, YouTube, Twitter and other social platforms to get 13%--2%--1% invitation rewards.

#TronFc #trondao #TRONICS #epicsymphony #TRONAnthem #blockchain #crypto #cryptocurrencies #cryptocurrency #bitcoin #btc #eth #ethereum #web3 #tron #trx #JustinSunTRON #USDT #Mining #ETH #BNB #Binance #imToken #OKX #TronLink #BitgetWallet #TRONAnthem #blockchain #musicinnovation #Bitget #KuCoin #tronfcmining #tronmining #BTCmining #USDTmining #Quantify#Internet makes money#Internet money-making projects
#Trailer,#OfficialTrailer,#MovieTrailer,#Venom,#VenomTheLastDance,#Venom3,#TomHardy,#ChiwetelEjiofor, #JunoTemple ,#RhysIfans ,#PeggyLu ,#AlannaUbach ,#StephenGraham, #MarvelTrailer, #MarvelOfficialTrailer , #Sony, #SonyPictures, #Marvel