teleren/devto huggingface dataset:
The risk of Open Source vs. proprietary 3rd party libraries
Tags: opensource, programming, discuss, business
Published: 2023-05-22 04:45:57

---
title: The risk of Open Source vs. proprietary 3rd party libraries
published: true
description: Using 3rd party libraries is a risky business. Both if they are proprietary and if they are open source. 
tags: opensource, programming, discuss, business
series: opensource
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-05-21 07:38 +0000
---

Using 3rd party libraries always have risks. If you buy them from a company you might have the fuzzy feeling that you will be supported no matter what. However, at the end if the supplier company goes out of business, decides to discontinue the project, or just does not have the bandwidth to provide prompt service you are out of luck.

If this is a security issue and you don't get prompt fix for it, you are at a risk. If the problem is "just" a serious flaw in the software, you don't have any control over how fast you will get a fix.

You might have legal options, but do you as a CTO, a tech lead, or a developer want to wait till the legal options bear fruit? Probably not.

Using Open Source  will not give you that fuzzy feeling, but it will give you controls. You can fix any problem yourself or you can hire someone to do it for you. Open Source has its own risks that I'll discuss in another post, but here are a few.

## Legal

* Does the package have an open source license compatible with the way you will want to use it?
* Does the package contain code that comes from other source that might not be open source or might have different licenses?

## Technical

* Do you really have access to the latest source code?
* Is it written in a language that you are familiar with?
* Does it have a good test coverage? Do you have access to it? Do you know how to run it?
* How many people maintain the project? How many people are familiar with the code-base?
* Does the project have an up-to-date public VCS?
* When was the last change recorded?
* How many open issues are there?
* How many open Pull-Request are there?
* How fast are PRs and Issues addressed?
* What is the complexity of the code?


## Do open source projects have more risk factors?

Seeing the above list one might think that Open Source have more risk factors, but in reality proprietary packages have similar risk-factors, but they are hidden from you and in most cases you cannot alleviate them.

## What do you think?

* What other risk factors do you see?
Surf the Web with Lightning Speed
Published: 2023-05-22 06:59:46

Fast and reliable internet is no longer a luxury, but a necessity in today's digital age. With a diverse range of internet packages, you can choose the perfect plan tailored to your needs, ensuring a seamless online experience. Whether you're a casual web surfer, a streaming enthusiast, or a professional relying on a stable connection, [latest packages](https://latestpackages.com/) offer blazing-fast speeds that will keep you connected, productive, and entertained. Say goodbye to buffering and hello to uninterrupted browsing, streaming, and gaming with our top-notch internet packages
How to return JSON response on API routes in Laravel
Tags: tutorial, laravel, api, webdev
Published: 2023-05-22 08:19:45

If you work with Laravel, you could have found yourself in a situation where you have written your API Controllers, set up your API routes and setup authentication (for example, using Sanctum) to protect your routes from unauthorized access. 
You then try to access a protected route through a browser which will return something like this: 


![Laravel Exception when user unauthorized ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/13tq6f4jsew60c0zqp4x.png)

First of all this is a good thing because it means your API route is protected and can only be accessed by authenticated users. However, it doesn't look pretty at all. 
By default, Laravel returns header responses in HTML format.
If you access the API route/endpoint using an API testing tool like Postman, Fiddler, RESTer, etc., you could easily update the Header by adding an entry called `Accept` and setting it to `application/json`. This would display a 'graceful' json response instead of HTML.
 
To change this default behaviour programmatically, we would want Laravel to return a json response telling the user that they are unauthenticated. How do we achieve this? It is actually pretty simple to do. Let's see how.  

## 1. Create a Custom Middleware
Using the Artisan CLI, create the middleware like this:

```php
php artisan make:middleware ReturnJsonResponseMiddleware
```
Open the middleware file located in App\Http\Middleware. 
Update the handle method to look like this:

```php
public function handle(Request $request, Closure $next)
    {
        $request->headers->set('Accept', 'application/json');
        return $next($request);
    }
```
What this does is that it sets the header to accept and return a json response. 

## 2. Publish the Custom Middleware
To do this, we need to add our middleware to the Laravel Kernel under the application's global HTTP middleware stack. 
To do this, open` Kernel.php` in App\Http and add the custom middleware class:

```php
protected $middleware = [

       ...
        \App\Http\Middleware\ReturnJsonResponseMiddleware::class, //return graceful unauthenticated message
        
    ];
```
That's it! Now when a user tries to access a protect API route through the browser, they will get a json response:

```php
{
message: "Unauthenticated"
}
```


![Graceful json response](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vonmyu6i8pgxy4d0ajz9.png)

I hope this was helpful.
Healthcare Mobile App Development
Tags: healthcaremobileappdevelopment, healthcareappdevelopment
Published: 2023-05-22 07:57:41

Boost your business in the #healthcare industry with our top-notch #AppDevelopmentServices!  Stay ahead of the competition and provide efficient healthcare 
solutions to your customers. Contact us today to transform your ideas into reality! 

Visit: https://www.uplogictech.com/healthcare-mobile-app-development-company

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5i9qz170pn8illkdo9dn.jpeg)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/irle6gjtsjflyof4jzdv.jpeg)
5 soft skills for developers
Tags: webdev, coding, programming, frontend
Published: 2023-05-22 10:37:57

Soft skills are essential for developers, as they complement technical expertise and contribute to effective collaboration, communication, and overall professional success. Here are some important soft skills for developers:

**Communication:** For developers, being able to communicate clearly is essential. Both technical and non-technical stakeholders require the capacity to communicate ideas coherently, actively listen to others, and understand technical knowledge.

**Collaboration:** Developers often work in teams, so strong collaboration skills are vital. This includes the ability to work well with others, contribute to discussions, share knowledge, and resolve conflicts constructively.

**Time management:** Developers often face multiple tasks and deadlines. Effective time management skills help them prioritize tasks, meet deadlines, and maintain productivity without compromising quality.

**Adaptability:** Since technology is a sector that is continuously changing, developers must be able to evolve with it. The ability to quickly adapt to altering goals, embrace new approaches, and be open to learning new technology are all desirable qualities.

**Continuous learning:** The technology landscape evolves rapidly, so developers must be committed to continuous learning. Staying up-to-date with new technologies, frameworks, and industry trends ensures professional growth and enhances problem-solving abilities.

----
👉 Get Frontend tips tricks on **Instagram**: [Rafi kadir](https://www.instagram.com/i_am_rafikadir/)
👉 Connect on **Linkedin** : [Rafi kadir](https://www.linkedin.com/in/rafikadir/)
Effortless NFS file transfer in CI/CD pipelines without Privileged access
Published: 2023-05-22 15:23:59

In the realm of continuous integration and deployment (CI/CD) pipelines, the seamless transfer of artifacts to any remote servers holds immense significance.
Traditionally, in the case of NFS, achieving this demands mounting of the nfs share inside the runner, thereby restricting it to a specific node and granting privileged access.
However, NCP (NFS Copy), can be utilized to 
allows direct artifact copying to remote NFS servers without the need for mounting, eliminating the constraints of privileged access.

In this article, we delve into the utilization of NCP in GitLab pipelines.

## Understanding the Pipeline

Let's examine a sample pipeline to better understand how NCP can be leveraged for artifact transfer:

```yaml
stages:
  - build
  - publish

build:
  stage: build
  script:
    - echo "build test artifact" > output.txt
  artifacts:
    paths:
      - output.txt
    expire_in: 2 hours

publish:
  stage: publish
  needs: ["build"]
  image: docker.io/khaliq/ncp:latest
  script:
    - ncp to --host 192.168.0.80 --nfspath data --input output.txt
```
The pipeline consists of two stages: `build` and `publish`. In the `build` stage, a test artifact is created by echoing the text "build test artifact" into a file called `output.txt`.

This stage is responsible for building the artifact that will later be transferred to the remote NFS server.

```yaml
publish:
  stage: publish
  needs: ["build"]
  image: docker.io/khaliq/ncp:ncp
  script:
    - ncp to --host 192.168.0.80 --nfspath data --input output.txt
```

The publish stage is where the artifact is transferred using NCP. Here's a breakdown of the command used:

`ncp to`: Specifies the direction of the transfer, indicating that the artifact will be sent to the remote server.
`--host`: Specifies the IP address or hostname of the remote NFS server.
`--nfspath`: Defines the target path on the remote server where the artifact will be stored.
`--input`: Specifies the input artifact to be transferred, in this case, `output.txt`.

With this simple command, it handles the transfer of the artifact to the specified remote NFS server, without the need to mount nfs shares.

## Conclusion
NCP simplifies remote NFS server integration in CI/CD pipelines. By eliminating nfs share mounting and the need for privileged access, it streamlines artifact transfer, granting the freedom to run jobs anywhere.

Checkout the [GitHub repository](https://github.com/kha7iq/ncp) for more information.
Advanced Tailwind Syntax
Tags: frontend, learning, react, vue
Published: 2023-05-22 14:31:06


It's common to use Tailwind with classes like `m-4 bg-red-500` that use the `theme` tokens.  
[Tailwind Docs](https://tailwindcss.com/docs/installation) is well done and covers everything.

---

But when you need to write CSS that doesn't use theme, you are using the tailwind syntax for **arbitrary rules**.

**This is when you can find this cheat sheet useful.**

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

{% embed https://tailwind-syntax-examples.vercel.app/ %}

---

Feel free to suggest something that is missing...
WASM: Memory Management
Tags: cpp, webassembly, javascript
Published: 2020-07-02 16:37:50

So you have chosen to write your new web app in WASM - exciting! On top of that, you want to write it in C++ to have fine-grained control over data storage and manipulation.

Here's some great advice that will help you overcome serious headaches.

Firstly, because the memory available to your program is actually a JS object, it is available as one contiguous chunk that is limited to linear scaling. This means that you have to be very careful about deleting objects and freeing memory. In fact, stop deleting objects altogether. If you feel the need to get rid of temporary memory objects then create a separate temporary memory object within JS for that operation, like so:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/mmngiq9nrnjdtbmgzrot.png)

The second big hint is, align your data structures. When you have lots of data structures that go in and out of the execution scope, you will run into lots of segmentation faults due to memory misalignments, particularly if your structures have many levels of invariably scaling sub-structures, such as in the case of Markov chains.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/esebq0tujxfbdrepjvhl.png)

No alt text provided for this image
Explicit memory alignment will have penalties in terms of growth of memory as your Markov chains' complexities increase - this is where multiple memory objects come in handy. This drawback is worth the performance and stability bonuses, which you will learn as you dig into WASM.

Have fun in your WASM journey!
FLAMES
Tags: githubhack23, github, javascript, web
Published: 2023-05-23 05:58:23

### What I built
I 've built a relationship finder application which tells the relationship between two people

### Category Submission: 
Wacky Wildcards
### App Link
https://kavinofficial.github.io/FLAMES/
### Screenshots 

![FLAMES description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/otmxls9bzpl0q60xglnk.png)
### Description 
FLAMES is one of the fun projects I have done, though it is a small project , it was a good experience to create that. It finds the relationship of two people by using the characters of their names, it too has a bonding meter.  
### Link to Source Code 
https://github.com/kavinofficial/Crush-Finder
### Permissive License 
I've added MIT license.
## Background (What made you decide to build this particular app? What inspired you?) 
The manual calculation of FLAMES frustrated me , so I created this to save my time ,My friends inspired me to do this.
### How I built it
Now I'm learning front end development ,Codespaces helped me to learn some of them. 
### Additional Resources/Info
I have used stack overflow, dev.to to solve few errors that occurred during the development of this project.
Clean Architecture ฉบับเริ่มต้น
Tags: architecture
Published: 2023-05-23 10:40:55

เชื่อว่าในการพัฒนาซอฟต์แวร์นั้น ความเข้าใจในเรื่องสถาปัตยกรรม (Software Architecture) มีความสำคัญอย่างยิ่ง เพราะนอกจากจะช่วยออกแบบระบบได้ดียิ่งขึ้น ยังเป็นการเปิดมุมมองต่อแนวคิดเบื้องหลังของสถาปัตยกรรมเหล่านี้อีกด้วย เพื่อให้นำมาปรับใช้ได้เหมาะสมกับงาน

ในบทความนี้จะพามารู้จักกับ Clean Architecture ซึ่งเป็นการอ้างอิงจากบทความของ Robert C. Martin แม้ว่าบทความนั้นจะมีอายุมากกว่า 10 แล้ว แต่แนวคิดก็ยังนับว่าน่าสนใจไม่น้อยเลยทีเดียว

---

## รู้จัก Clean Architecture
สถาปัตยกรรมนี้ให้ความสำคัญกับ *Separation of Concern* คือมีการแบ่ง layer การทำงานของซอฟต์แวร์เป็นชั้นๆ ซึ่งในแต่ละชั้น layer จะทำงานในขอบเขตของตัวเองไม่ปะปนกัน


![Diagram](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mz1yfeua8krg61ud61yy.png)


ในแผนภาพสะท้อนหลักการ The Dependency Rule โดยวงกลมด้านนอกจะเกี่ยวข้องกับการติดต่อประสานเครื่องไม้เครื่องมือต่างๆ สามารถปรับเปลี่ยนได้ตลอด ส่วนวงกลมด้านในจะเป็นการกำหนดนโยบายซึ่งเกี่ยวข้องกับ business โดยตรง จึงไม่ได้ปรับเปลี่ยนบ่อย

นอกจากนี้ยังกล่าวว่า *source code dependencies can only point inwards* คือวงภายในจะต้องไม่รับรู้และไม่พึ่งพาอาศัยโค้ดจากวงภายนอก แต่วงนอกพึ่งพาอาศัยวงภายในตามลูกศร `depend on`

เดี๋ยวเรามาลงรายละเอียดในแต่ละวงกัน เริ่มจากด้านนอกเข้าไปด้านใน

### Frameworks and Drivers
เป็นส่วนที่จัดการกับ Framework และติดต่อกับเครื่องมือภายนอกอื่นๆ ด้วย driver ซึ่งอาจไม่ได้เขียนโค้ดมาก แต่จะเป็นการลงรายละเอียดที่จำเพาะ (specific) เช่น ติดต่อกับ database ตัวไหน หรือจะใช้ Web Framework อะไร เป็นต้น

### Interface Adapters
ใช้ในการแปลงข้อมูล (convert data) ให้อยู่ใน format ที่เหมาะสม ให้วงในและนอกสื่อสารกันได้ แบ่งได้เป็นหมวดหลักๆ ดังนี้
- **Presenters**: ใช้จัดการ UI logic หรือ states แปลงให้แสดงผลได้เหมาะสม
- **Controllers**: ใช้จัดการ input/output จากระบบภายนอก เช่น UI, external services โดยรับ request มา validate/process ตาม business logic
- **Gateways**: อาจเรียกว่า repository หรือ data access layer ใช้จัดการ communication จาก data source เพื่อทำ data access operation

### Application Business Rules
เป็นการกำหนด rule ที่จำเป็น (แต่ยังไม่ใช่ core-business-rule) ใน layer นี้มี Use Case ใช้บอกว่า application มี function ใช้ทำอะไรได้บ้าง นอกจากนี้ใช้กำหนดว่าควรเรียก Controller/Gateway มาใช้ในแต่ละ use case

### Enterprise Business Rules
ส่วนนี้จะกำหนด core-business-rule เช่น model/entity ที่ใช้เก็บ data structure  ซึ่งมีการเปลี่ยนแปลงน้อย และไม่ได้รับผลกระทบจากการเปลี่ยนแปลงของภายนอกมาก

---

หวังว่าบทความ Clean Architecture นี้จะเป็นประโยชน์กับผู้ที่เริ่มต้นศึกษา และสามารถอ่านรายละเอียดที่น่าสนใจที่ด้านล่างนี้ได้เลย

References:
- [Clean Coder Blog](https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html)
- [The Clean Architecture — Beginner’s Guide](https://betterprogramming.pub/the-clean-architecture-beginners-guide-e4b7058c1165)
A custom action to deploy mdBook
Tags: githubhack23
Published: 2023-05-23 15:37:35

## What I built 

I built a Github action for automating the deployment of a compiled book.

### Category Submission: 

DIY Deployments - DevOps & CI/CD

### App Link

https://github.com/Rapha-Borges/mdBook-action

### Screenshots

![Screenshot of the Github Action](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gnt0or4qbh7sjh4o150y.png)

### Description 

This Github action is designed to be triggered when a push occurs on the "main" branch of a repository. It performs a series of steps within a job named "build" on the latest version of the Ubuntu operating system.

The action utilizes a Docker container with the image "raphaelborges/mdbook:1.0.2" to compile a book located at the path "/github/workspace/book". It then executes a shell script named "copy.sh".

The "copy.sh" script creates a worktree, sets Git configuration, deletes and clears the "gh-pages" branch, copies files from specified directories, commits the changes, and pushes them to the "gh-pages" branch on the remote repository.

This action automates the process of compiling the book and deploying it to a designated location using custom settings, simplifying the workflow for users.

### Link to Source Code 

https://github.com/Rapha-Borges/mdBook-action

### Permissive License 

MIT License

## Background (What made you decide to build this particular app? What inspired you?) 

I built this Github action to automate the deployment of ebooks using customized configurations that better meet the needs of the projects I am involved in. The motivation behind creating this action was to streamline the process and eliminate manual steps required for ebook deployment.

### How I built it (How did you utilize GitHub Actions or GitHub Codespaces? Did you learn something new along the way? Pick up a new skill?) 

To build this Github action, I leveraged the power of GitHub Actions, which provides a flexible and robust platform for automating workflows. I utilized the "actions/checkout@v3" action to perform repository checkout and the "docker://" syntax to use a specific Docker container for compiling the book. The shell script, "copy.sh," was developed to handle the file copying and Git operations required for deployment.

During the development process, I gained valuable experience in utilizing GitHub Actions to orchestrate CI/CD workflows. I learned about Docker integration within GitHub Actions, enabling seamless execution of tasks in isolated environments.

### Additional Resources/Info

For more information about this project, please refer to the official repository at [https://github.com/Rapha-Borges/mdBook-action].

Additionally, you can find examples of usage and implementation at the following links: [https://github.com/badtuxx/DescomplicandoPrometheus], [https://github.com/rochacbruno/py2rs].
Introducing Terminal-Chat-App: Chat, Create, and Join Public Chat Rooms from the Command Line
Tags: githubhack23
Published: 2023-05-23 23:56:09

## What I built
The Terminal Chat App is a command-line chat application that allows users to join public chat rooms and chat from the command-line interface. Users can also create new chat rooms and interact with other users in real-time

### Category Submission: Wacky Wildcards

### App Link
https://www.npmjs.com/package/tarminal-chat-app

### Screenshots

![Terminal Chat App Demo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ie2uwrb9l8oh3iasvalx.jpg)

##### Video demo
https://youtu.be/GfpvChlPq3g

### Description 
The Terminal Chat App is a command-line chat application that allows users to join public chat rooms and chat from the command-line interface. Users can also create new chat rooms and interact with other users in real-time


Features:
Command-line interface
Join public chat rooms
Create public chat rooms
Chat in real-time
User authentication


### Link to Source Code 
https://github.com/HayatsCodes/terminal-chat-app

### Permissive License 
[MIT](https://choosealicense.com/licenses/mit/)

## Background (What made you decide to build this particular app? What inspired you?) 
As a software engineer looking for my first job, I wanted to be challenged and get out of my comfort zone by building a novel real-life project. I actually had the idea before the hackathon but procrastinated. However, the hackathon refueled me to build the project.

### How I built it (How did you utilize GitHub Actions or GitHub Codespaces? Did you learn something new along the way? Pick up a new skill?) 
I'd never heard of GitHub codespaces before the hackathon, and I got to find out what I'd been missing all along. It was at least 3X faster than my normal local workspace because of the dedicated virtual machines of up to 32 cores (I used the 2-core machine, and it was still significantly faster than my machine). I loved the fact that I used the default Linux image and didn't need to configure the workspace to get stuff done. I was so excited about GitHub codespaces that I posted about it on LinkedIn and also wrote an article about it on DEV. It was fun building on GitHub codespaces and I'm glad to have discovered it through this hackathon. I only used GitHub actions to automate the server's API test.
### Additional Resources/Info
The server was deployed to railway.app while the user interface was published on the NPM registry.