teleren/devto huggingface dataset:
shadcn-ui/ui codebase analysis: How does shadcn-ui CLI work? — Part 2.7
Tags: javascript, opensource, nextjs, shadcnui
Published: 2024-07-05 20:46:55

I wanted to find out how shadcn-ui CLI works. In this article, I discuss the code used to build the shadcn-ui/ui CLI.

In part 2.6, we looked at function getTsConfigAliasPrefix that returns the alias used in paths in your project’s ts-config.json.

Let’s move on to the next line of code.

![](https://media.licdn.com/dms/image/D4E12AQF7xUAIIGQwVQ/article-inline_image-shrink_1500_2232/0/1720212190037?e=1725494400&v=beta&t=9yG8vfoP5NiM3EDRdjLqeUgL9KT9mp9oHhkTnfM5fmA)

At L84, it is a simple check that returns null if any of the projectType or tailwindCssFile or tsConfigAliasPrefix does not exist.

Let’s learn more about isTypescriptProject(cwd)

```js
const isTsx = await isTypeScriptProject(cwd)
```

[isTypescriptProject](https://github.com/shadcn-ui/ui/blob/main/packages/cli/src/utils/get-project-info.ts#L174) is a function imported from [ui/packages/cli/src/utils/get-project-info.ts](https://github.com/shadcn-ui/ui/blob/main/packages/cli/src/utils/get-project-info.ts#L174) and this function checks if the cwd (current working directory) has a tsconfig.json file.

```js
export async function isTypeScriptProject(cwd: string) {
  // Check if cwd has a tsconfig.json file.
  return pathExists(path.resolve(cwd, "tsconfig.json"))
}
```

pathExists
----------

pathExists is a function imported from [fs-extra](https://www.npmjs.com/package/fs-extra)

```js
import fs, { pathExists } from "fs-extra"
```

Conclusion:
-----------

To check if a project uses TypeScript, you could do the same thing that shadcn-ui/ui CLI package does. That is, check if tsconfig.json path exists in the given cwd using pathExists function provided by [fs-extra](https://www.npmjs.com/package/fs-extra).

> _Want to learn how to build shadcn-ui/ui from scratch? Check out_ [_build-from-scratch_](https://tthroo.com/)

About me:
---------

Website: [https://ramunarasinga.com/](https://ramunarasinga.com/)

Linkedin: [https://www.linkedin.com/in/ramu-narasinga-189361128/](https://www.linkedin.com/in/ramu-narasinga-189361128/)

Github: [https://github.com/Ramu-Narasinga](https://github.com/Ramu-Narasinga)

Email: [ramu.narasinga@gmail.com](mailto:ramu.narasinga@gmail.com)

[Build shadcn-ui/ui from scratch](https://tthroo.com/)

References:
-----------

1.  [https://github.com/shadcn-ui/ui/blob/main/packages/cli/src/utils/get-project-info.ts#L84C3-L88C47](https://github.com/shadcn-ui/ui/blob/main/packages/cli/src/utils/get-project-info.ts#L84C3-L88C47)
2.  [https://github.com/shadcn-ui/ui/blob/main/packages/cli/src/utils/get-project-info.ts#L174](https://github.com/shadcn-ui/ui/blob/main/packages/cli/src/utils/get-project-info.ts#L174)
3.  [https://github.com/shadcn-ui/ui/blob/main/packages/cli/src/utils/get-project-info.ts#L10](https://github.com/shadcn-ui/ui/blob/main/packages/cli/src/utils/get-project-info.ts#L10)
4.  [https://www.npmjs.com/package/fs-extra](https://www.npmjs.com/package/fs-extra)
Creating Virtual Machine Scale Set Using Azure Portal
Tags: virtualmachine, scaleset, resources, networking
Published: 2024-07-05 20:45:39

**Table of Contents**

           Introduction
Step 1. Sign to Azure Account
Step 2. Create a Virtual Machine Scale Set
Step 3. Create a Virtual Machine Scale Set
Step 4. Configure Basic Settings




         Introduction

Creating a Virtual Machine Scale Set (VMSS) in Azure involves several steps. A VMSS allows you to deploy and manage a set of identical, auto-scaling virtual machines. Here's a step-by-step guide to create a VMSS using the Azure portal:

Step 1    Sign to Azure Account
         (a)  Go to Azure Portal (portal.azure.com)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u0p34hly86tn34f1mfcy.png)
          (b) Sign in with your Azure Credentials

Step 2     Create a Virtual Machine Scale Set
       (a) At the search bar, type **Vmss and select Virtual Machine Scale Set **

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8i8lg3fvcp2npbhrlw5s.png)
       (b) Click + Create to create **Virtual Machine Scale Set**

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

       (c) Fill in the required rows from **Project details** which include;
**Subscription;** Choose your Azure Subscription.
 **Resource Group;** Create a new name for the Resource Group. (vmss-RG)


(d) At the **Scale set Details,** make sure you put the Virtual Machine scale set Name (hagital-vmss). 
Leave the region to (US) East us and Availability zone to None

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

(e) In the **Orchestration** ,set orchestration mood  to 'uniform'

(f) In **Scaling**, set the scaling mood to ' Autoscaling

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


'
In scaling configuration, click configure to review all scaling options.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/syng4nzi7vd8x29a2dya.png)
(g) Click on + add a scaling condition 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/25webzpgy0adpd64qrqn.png) 
Another window will open at the right side corner. Continue with the prompt captioned **Add a scaling condition.**
Leave the condition name to vmss-condition
Leave the scale mode to autoscaling. 
Initial Instant count ........ 2
**Instance limit**
Minimum ....... 2
Maximum ....... 4
Newbie Rust Programmer Project Practice
Published: 2024-07-05 19:18:42

I am currently an active beginner Rust programmer who has just started learning. During my learning process, I have a high acceptance of Rust and really appreciate its memory management design and unique programming language features. As a beginner in Rust, we all need some programming exercises to help us get into the world of Rust programming. I have been learning Rust for about a week now, and I tried to mimic the mdbook program using Rust, developing a similar program. Through this program, I practice some Rust programming skills. Now, the source code is open-source on GitHub. Are there any other beginners in Rust? We can maintain or learn from this project together. 😄

Github：https://github.com/auula/typikon

As a newbie Rust programmer, I hope my project can get some attention. 😄 If you like it, please give it a star 🌟.

1. Introduce

Typikon name derived from Typikon Book, the a static website rendering tool similar to mdbook and gitbook, but it focuses only on rendering markdown into an online book, and is easier to use than the other tools.

2.Preview


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

3. Document
To learn how to use the Typikon program, you can refer to the documentation that I have written. This documentation is generally rendered and built using Typikon. The online documentation can be accessed at the following address: https://typikonbook.github.io🌟.
Are you facing hard times as a developer?
Tags: webdev, help, beginners, programming
Published: 2024-07-05 19:46:55

Are you having difficulty finding a community of developers and mentors in your coding journey? are you having a hard time fixing your code on your own? 

At https://progskill.com/projects we got your back. Join our platform, submit your project, and get immediate feedback from our dedicated team of experts/developers.

Here you will get dedicated mentorship and the help you need in your software development journey. https://progskill.com/projects
Computer Vision Meetup: 5 Handy Ways to Use Embeddings, the Swiss Army Knife of AI
Tags: computervision, ai, machinelearning, datascience
Published: 2024-07-05 19:43:17

Discover the incredible potential of vector search engines beyond RAG for large language models! Explore 5 handy embeddings applications: robust OCR document search, cross-modal retrieval, probing perceptual similarity, comparing model representations, concept interpolation, and a bonus—concept space traversal. Sharpen your data understanding and interaction with embeddings and open source FiftyOne.

About the Speaker

[Harpreet Sahota](https://www.linkedin.com/in/harpreetsahota204/) is a hacker-in-residence and machine learning engineer with a passion for deep learning and generative AI. He’s got a deep interest in RAG, Agents, and Multimodal AI.

Not a Meetup member? Sign up to attend the next event:

https://voxel51.com/computer-vision-ai-meetups/

Recorded on July 3, 2024 at the AI, Machine Learning and Computer Vision Meetup.
Install GO in UBUNTU machines
Tags: installgo, setupgo, goforebpf, go
Published: 2024-07-05 19:23:36

## Download Source
Download source from this link  [Go Binaries](https://go.dev/dl/)
## Unpack Packages 
After downloading the binary file may be in your `~/Downloads` folder from terminal
use this command
```
cd Downloads
```
Then list the items in the directory by this command
```
ls -l | grep go
```

![go-binary-find](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gmpuosioe0ju97xqpubo.png)

Extract the binary files from the `go1.22.2.linux-amd64.tar.gz` file in the download folder (you may have download the another version) use this command
```
sudo tar -C /usr/local -xzf go1.22.2.linux-amd64.tar.gz
```
This command will extract the file into `/usr/local` folder

## Add to PATH variable
Where the `go binaries` are you need to find it and then the path should be added to you path variable otherwise you will encounter some problems like `go command not found` by this command will be able to locate the `go binary` where it is 
```
whereis go
```

![whereis-go](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wdta72y62mg6n58433xa.png)
Now copy the path and use below command
```
export PATH=$PATH:{your_copied_path_here}/bin
```
## Verify Installation
Now use below command to verify your Installation
```
go version
```

![verify-installation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/59e2upgoaintn8reoz2x.png)
How to setup Host for learning eBPF and XDP
Tags: ebpfsetup, xdpsetup, bpftool
Published: 2024-07-05 19:15:22

## Install Necessary Packages
- First update your linux package index
```
sudo apt-get update
```
Then install the following packages :


- `clang` compiler for compiling eBPF programs
```
sudo apt-get install -y clang
```
- `llvm` provides libraries and tools for manipulating intermediate code, used by clang.
```
sudo apt-get install -y llvm
```
- `libelf-dev` helps in working with **ELF** (Executable and Linkable Format) files, which are used for eBPF bytecode.
```
sudo apt-get install -y libelf-dev
```
- `libbpf-dev` library for loading and interacting with eBPF programs.
```
sudo apt-get install -y libbpf-dev
```
- `libpcap-dev` provides functions for network packet capture, useful for testing and debugging.
```
sudo apt-get install -y libpcap-dev
```
- `gcc-multilib` allows compiling programs for both 32-bits and 64-bits architechtures.
```
sudo apt-get install -y gcc-multilib
```
- `build-essential` package that includes essential tools for compiling software (like gcc,make).
```
sudo apt-get install -y build-essential
```
- `linux-tools-common` provides common tools for kernel developers.
```
sudo apt-get install -y linux-tools-common
```
- `linux-headers-$(uname -r)` kernel headers specific to your sudoning kernel version, needed for compiling kernel modules.
```
sudo apt-get install -y linux-headers-$(uname -r)
```
- `linux-tools-$(uname -r)` tools specific to your sudoning kernel version, useful for performance monitoring.
```
sudo apt-get install -y linux-tools-$(uname -r)
```
- `linux-headers-generic` generic kernel headers, useful for compiling kernel modules across different kernel versions.
```
sudo apt-get install -y linux-headers-generic
```
- `linux-tools-generic` generic tools for various kernel versions, useful for performance and debugging.
```
sudo apt-get install -y linux-tools-generic
```
- `iproute2` collection of utilities for network configuration and management.
```
sudo apt-get install -y iproute2
```
- `iputils-ping` provides the ping utility for testing network connectivity.
```
sudo apt-get install -y iputils-ping
```
- `dwarves` contains tools like `pahole` to inspect the structure of compiled programs.
```
sudo apt-get install -y dwarves
```
- `tcpdump` a packet analyzer that allows you to capture and display network packets.
```
sudo apt-get install -y tcpdump
```
- `bind9-dnsutils` provides tools for **DNS** querying and testing. (nslookup, dig like tools)
```
sudo apt-get install -y bind9-dnsutils
```
## Install All
```
sudo apt-get update 

sudo apt-get install -y clang llvm libelf-dev libbpf-dev libpcap-dev gcc-multilib build-essential linux-tools-common

sudo apt-get install -y linux-headers-$(uname -r) linux-tools-$(uname -r) linux-headers-generic linux-tools-generic

sudo apt-get install -y iproute2 iputils-ping dwarves tcpdump bind9-dnsutils
```
Containers vs. Virtual Machines: A Beginner’s Journey
Tags: docker, container, dockerimage, virtualmachine
Published: 2024-07-05 19:10:47

**Containers:** A containers is an isolated environments for running an application. A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings.

**Pros of Containers:**

- **Lightweight:** Containers share the host OS, making them much lighter and faster to start than VMs.
- **Efficiency:** They use fewer resources, allowing more containers to run on the same hardware compared to VMs.
- **Scalability:** Ideal for microservices and scaling applications quickly.

**Cons of Containers:**

- **Shared Kernel:** Since containers share the host OS kernel, they offer less isolation than VMs.
- **Compatibility:** Containers are limited to the OS of the host system.

**Virtual Machine(VM): VM** is a abstraction of machines (physical hardware). A virtual machine is a digital copy of a physical machine. You can have multiple virtual machines with their own individual operating systems running on the same host operating system.

**Pros of Virtual Machines:**

- **Isolation:** VMs offer strong isolation, as each VM runs its own OS.
- **Versatility:** They can run different OSes on the same physical hardware.
- **Security:** Enhanced security due to complete OS separation.

**Cons of Virtual Machines:**

- **Resource Intensive:** VMs are heavy, consuming significant CPU, memory, and storage resources.
- **Slower Startup:** VMs take longer to boot up due to their complete OS stack.

### **When to Use What?**

- **Use VMs if:** You need strong isolation for security purposes, need to run multiple different OSes, or are dealing with legacy applications that require a full OS environment.
- **Use Containers if:** You’re developing microservices, need rapid scaling, or want to maximize resource efficiency.

## Different between Containers and Virtual Machines

### Containers

1. A containers is an isolated environments
for running an application.
2. Allow running multiple apps in isolation.
3. More lightweight.
4. Use "OS" of the host.
5. Need less hardware resources.
6. containers does not container full-blown
operating system.

### Virtual Machines(VM)

1. VM is a abstraction of machines (physical hardware).
2. on same physical machine we can have two different
machine, where each running completely different application
and each application has exact dependencies.
3. More heavyweight
4. Slow to start (Entire apps needs to be loaded).
5. Resource intensive (Each machine takes actual hardware.
resources).
6. Each VM needs a full-blown OS.


![container-vs-virtualMachines](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fgvu1tljyg77desg1sfa.png)
3 Livros que eu acho que todo dev deveria ler pelo menos 1 vez
Tags: livros, development, learning, productivity
Published: 2024-07-05 19:10:01

1) Sicp

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

O sicp (Structure and Interpretation of Computer Programs) traduzido do inglês-Estrutura e Interpretação de Programas de Computador é um livro de ciência da computação clássico dos professores do MIT da metade década de 80 até o final da década de 90 para ensinar ciências da computação, que mais tarde se tornou um programa oficial do MIT no curso de ciências da computação usando uma linguagem é considerada uma das mais simples do mundo (scheme um dialeto lisp tipo 2) para ensinar conceitos dos mais básicos até os mais avançados, para vocês terem uma noção no final do curso de ciências da computação os alunos tinham fazer um projeto que era escrever um interpretador para alguma determinada linguagem. Tenho certeza que depois que você ler esse livro você vai se tornar um programador muito melhor não só escrevendo códigos mas como um conhecedor da area da tecnologia.

2) O programador pragmático

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

A filosofia do livro o programador pragmático te faz refletir sobre suas ações, te faz começar a assumir responsabilidade pelos seus erros e te faz entender que tudo bem não saber tudo sobre um determinado assunto, ler o programador pragmático te faz não só um programador melhor, mas uma pessoa melhor.  Considero esse livro uma leitura obrigatória para todos que querem se tornar um programador sagaz, que entende completamente seu papel dentro do seu time ajudando a tomar decisões embasadas e fazendo o seu produto ser o mais eficiente possível. Vou deixar duas quotes do livro aqui para vocês: "Aprenda a não culpar alguém ou dar desculpas. Não ponha a culpa de todos os problemas em um fornecedor, uma linguagem de programação, na gerência ou em seus colaboradores. Qualquer um ou todos eles podem ter uma parcela de culpa, mas cabe a você fornecer soluções e não desculpas." um outro trecho muito bom e que esta logo no inicio do livro é "Se havia o risco de ocorrer algo que o fornecedor não poderia resolver, você deveria ter um plano de contingência. Se o disco ficar danificado – e todo o seu código-fonte também ficar comprometido – e você não tiver um backup, a falha é sua. Dizer a seu chefe “o gato comeu meu código-fonte” não resolverá."

3) Entendendo algoritmos


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

O livro entendendo algoritmos é um livro tanto para quem esta começando quanto para quem ja é programador a algum tempo, explica de forma simples como funcionam os algoritmos, o que eles são tirando aquela ideia que algoritmos são o bicho de sete cabeças que vocês provavelmente viram no curso de ciências da computação de vocês. Depois que vocês lerem esse livro tenho certeza que vão começar a resolver aquele problema de uma forma mais simples, a pensar de uma forma mais simples e lógica.
How To Sort Array of Strings
Tags: javascript, webdev
Published: 2024-07-05 19:07:49

I was building a [pdf merger]( https://github.com/codarbind/pdf-merger) that takes two pdf files, merge them, then return a single file - result of the merging.

There is a requirement that the files must be in order, i.e. a particular file has to be at the top.

Since I exposed this via an endpoint, and I am using multer to manage file uploads as shown below

```
 upload.fields([{ name: 'pdf1', maxCount: 1 }, { name: 'pdf2', maxCount: 1 }])
```

Multer would not order the files, and there is no guarantee on how what I would get from Multer I had to resort to sorting the array of 'processed files' from multer. I sorted by 'filename.'

```
files.sort((a, b) => a.filename - b.filename);
```

To my greatest shock, the array was not sorted.

I hurriedly went to my terminal. launched REPL and tried it, then it got sorted on REPL. 


![repl sorted the array of strings] (https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r96y2afjpsilfxh4wdmv.png)


😲

How? Why?

Then I went back to the basics of sorting, comparing, and returning -1, 0, or 1 if the first argument is lesser, equal, or greater than the second argument, respectively.

Like this -


![sorting array of strings with guarantee](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9wfisw4k7s2i6bwxh8dd.png)

Have you encountered a similar issue before? Or an inconsistency on REPL?

I would love to hear from you.
What is Open Source Success?
Tags: opensource
Published: 2024-07-05 19:05:41

---
title: What is Open Source Success?
published: true
description: In this video, we look at some of the open source metrics you might use to determine whether or not a project is successful.
tags: opensource
---


## Mentioned Resources

- [State of JS 2023 - metaframeworks](https://app.opensauced.pizza/workspaces/69c010b5-222b-4028-b61f-842484aac012)
- [Gatsby repo page](https://app.opensauced.pizza/s/gatsbyjs/gatsby)
- [Next.js Repo Page](https://app.opensauced.pizza/s/vercel/next.js)
- [State of JS Repor](https://2023.stateofjs.com/en-US/libraries/meta-frameworks/)
- [Jason Huggins X Post](https://x.com/hugs/status/1804285915516338506)
Weekly Updates - July 5, 2024
Tags: couchbase, community, cpp, rails
Published: 2024-07-05 19:04:05

Hi everyone :wave: 

It’s July meaning we’ve entered the second half of the year. At Couchbase we don’t do things by half measure so here are some of the latest happenings.

- 👏 **Announcing General Availability of the C++ SDK for Couchbase** - We are thrilled to announce the General Availability (GA) of the C++ SDK, which adds support for native C++ language to our existing comprehensive set of SDK libraries in 11 programming languages and marks a significant milestone in our commitment to providing robust, high-performance tools for developers to build modern, scalable applications. [*Learn more here >>*](https://www.couchbase.com/blog/announcing-general-availability-of-the-cpp-sdk-for-couchbase/)
<br> 


- :book: **Couchbase on Rails: A Guide to Introducing Dynamic and Adaptive Data to Your Application** - Our Senior Dev Evangelist Ben Greenberg provides insights as well as sample code to integrate Couchbase into your Ruby on Rails application. [*Check out the guide >>*](https://www.couchbase.com/blog/couchbase-rails-guide-adaptive-data/)
<br>

- 💻 **New Blog Post: Accelerate Couchbase-Powered RAG AI Application With NVIDIA NIM/NeMo and LangChain** This post introduces a concept of an interactive chatbot based on a Retrieval Augmented Generation (RAG) architecture with Couchbase Capella as a Vector database as we announce our new integration with NVIDIA NIM/NeMo. [*Read more >>*](https://www.couchbase.com/blog/accelerate-rag-ai-couchbase-nvidia/)
<br>


- :mortar_board: **ICYMI: Benchmarking Databases with YCSB* Now on demand, our recent webcast covers everything you need to know to benchmark databases effectively on your own using the Yahoo! Cloud Serving Benchmark (YCSB). [*Watch now >>*](https://info.couchbase.com/benchmarking-databases-with-ycsb-2024june.html?utm_campaign=adaptive-apps&utm_medium=community&utm_source=discord&utm_content=webinar&utm_term=developer)

See you next week!