teleren/devto huggingface dataset:
How To Use JSON with Comments for Configs
Tags: productivity, vscode, javascript, tutorial
Published: 2024-05-26 07:11:06

Most of the tools we use daily in the Node.js ecosystem utilize config files that support various formats such as `.js/cjs/mjs`, `.yaml/toml`, or `.json`. I usually prefer to work with simple text formats like JSON over JavaScript because it spares me the hassle of navigating the ESM vs. CJS battle for the correct file extension and export specifier. Even better, if the config publishes a JSON schema, then you get type safety without having to rely on JSDoc or TypeScript types.

The biggest downside to using JSON for config files is, in my opinion, its lack of support for comments. I want to explain why I enabled a certain feature or disabled a certain rule. I know most tools still accept comments in JSON files because they don't use the native `JSON.parse` function, which errors on comments, but instead use custom packages like `JSON5` that support comments.

My new go-to linter, [Biome.js](https://biomejs.dev/guides/getting-started/), solves this by accepting a `biome.jsonc` (JSON with Comments) as a config file. However, other build tools like [Turbo](https://turbo.build/repo/docs/reference/configuration) only accept a plain `turbo.json` file, even though they allow for comments embedded in the JSON. When you open this file in VSCode, you will encounter numerous errors because of the comments. 

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

VSCode opens this file based on its file extension in JSON language mode (see the language indicator in the bottom bar). Interestingly, if you open a `tsconfig.json`, you will notice that VSCode interprets this file as JSON with Comments even if it doesn't contain any comments.

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


VSCode allows you to associate a file name with a certain language. These [file associations](https://code.visualstudio.com/docs/languages/identifiers) are defined in the `.vscode/settings.json` file:

```jsonc
// .vscode/settings.json
{
  "files.associations": {
    "turbo.json": "jsonc"
  }
}
```
Now opening the `turbo.json` file again will automatically use the right language (JSON with Comments). However, keep in mind that you should verify if your tool actually supports JSON with comments. For example, Node.js doesn't support comments in `package.json`, and doing so will break your package and potentially all dependent packages.
Why Book a Private Chef
Published: 2024-05-26 06:23:33

Date and Time: Ensure the chef knows the exact date and time of the event or meal service.
Guest Count: Provide a final headcount so the chef can plan accordingly.
Venue Information: Share any necessary information about the venue, including kitchen facilities and access.
Special Requests: Inform the chef of any special requests or requirements, such as specific ingredients, allergies, or presentation preferences.
7. Enjoy the Experience
On the day of the service, your private chef will handle everything from shopping for ingredients to preparing and serving the meal. This allows you to relax and enjoy the experience without worrying about the details. After the meal, the chef will typically handle the cleanup, leaving your kitchen spotless.

8. Provide Feedback
After the event, provide feedback to your chef. This is valuable for their professional development and helps them improve their service. If you were satisfied with the experience, consider writing a testimonial or review to support their business.

Conclusion
Booking a private chef can transform any meal into a memorable culinary experience. By following these steps and taking the time to find the right chef for your needs, you can ensure a seamless and enjoyable experience. Whether it’s a one-time event or regular meal service, a private chef brings creativity, expertise, and a touch of luxury to your dining table.

http://www.eventchefs.co.uk
python command isn't working and python3 working on mac
Tags: python
Published: 2024-05-26 06:21:17

On macOS, it is common to have multiple versions of Python installed, leading to confusion between commands like `python` and `python3`. Here’s a detailed guide to understanding and resolving the issue:

### Understanding the Issue
- **`python` Command**: On some macOS systems, `python` points to Python 2.x.
- **`python3` Command**: This typically points to Python 3.x.

Starting with macOS Catalina, Apple does not include Python 2 by default, but you might still encounter environments where `python` refers to Python 2, while `python3` is explicitly Python 3.

### Steps to Resolve the Issue

1. **Check Python Versions**
   Run the following commands to see which versions of Python are installed:
   ```sh
   python --version
   python3 --version
   ```

2. **Use Python 3 Explicitly**
   If `python3` works and `python` does not, use `python3` to ensure you're using Python 3:
   ```sh
   python3 your_script.py
   ```

3. **Update Shell Profile to Alias `python` to `python3`**
   You can create an alias in your shell profile to make `python` refer to `python3`.

   - **For `bash` (default on older macOS versions):**
     Edit your `~/.bash_profile` or `~/.bashrc` file:
     ```sh
     nano ~/.bash_profile
     ```
     Add the following line:
     ```sh
     alias python=python3
     ```
     Save the file and reload the profile:
     ```sh
     source ~/.bash_profile
     ```

   - **For `zsh` (default on newer macOS versions including Catalina and later):**
     Edit your `~/.zshrc` file:
     ```sh
     nano ~/.zshrc
     ```
     Add the following line:
     ```sh
     alias python=python3
     ```
     Save the file and reload the profile:
     ```sh
     source ~/.zshrc
     ```

4. **Check Python Path**
   Ensure that the correct Python 3 path is set:
   ```sh
   which python
   which python3
   ```

5. **Install Python 3 if Needed**
   If `python3` is not installed, you can install it using Homebrew:
   ```sh
   brew install python
   ```

### Summary
By creating an alias or using `python3` directly, you can avoid issues with the `python` command not working due to the version mismatch. Adjusting your shell profile ensures consistency across terminal sessions.

Feel free to ask if you need further assistance or clarification on any of these steps.
Simple database design for complex business model
Tags: spring
Published: 2024-05-26 05:43:46

One of the barriers of agile software architecture is the database schema changes. That is once the schema is set and data has been populated, it is very difficult to separate them, even they can separated, this affect the database layer or ever the business layer. Bugs and malfunction is unpreventable.  

Here is what I have done to make a relational database design to be agile: 

**_Simple database table for elements:_**

To define database tables as simple and small as possible. They should base on elements rather than business entities.
To define a table for storing an element and it is simple so we can decorate it later whatever we like. For example, if a person table is defined, the name fields should not be part of it. That means person and name are separated as elements and they are joint to be a business entity. You may think this is the normalization of the database and it probably true. But I think we should focus on elements which is purely abstraction. 
Let's see how a girl got names. When she was born, she was known as a female at that time without a name yet. Then she was given a name. When she gets married, she would likely get another name, at least, the surname would be changed.

Let's define the schema of a person in such a way. A table called "person" with person id, DOB, status date and status. A table called "name" with surname, given name, other names, preferred name, start date, end date and status as well. A table called "person name relationship" with a start date and an end date and status. A table called gender with name, start data, end date and status etc. 

**_Link elements together with relationships to form an entity:_**

To use the relationship to link the person to the name, the gender to form an entity "person" this time so the person entity can have many names and different gender. With this way of design, nationality, home address, emails, phone numbers and most everything can decorate the element "person" accordingly to be a colorful entity "person". Because we focus on elements, it is so flexible to meet the business requirement.

**_Consistence of data:_**

The status of the elements and the re-runnable process can enforce the data consistence. Check lists can be used to identify where the problems are if there is any. 

**_Join elements with database views to form business entity interface:_**

To use database views to link elements together with their relationships to form entity interface for applications. The application only accesses data via views and it doesn't need to know how the database was designed and built. This does not just simplify coding, but also make data retrieval flexible because many views can be created accordingly and easily. The views also provide almost guarantee of the data consistence and data visibility.

To summarized above, to use decorating pattern to design the relational database.

Here is the example that I have developed. Any suggestions or opinions are welcome. Thanks.
 
https://github.com/squaressolutions/soms
Marian Institute of Management
Published: 2024-05-26 05:57:24

**[Marian Institute of Management](https://mim.mariancollege.org/)**

MBA program in MIM, under Marian school, Kuttikkanam ( Independent, re licensed with A++ grade/CGPA 3.71/4) is one of the most outstanding MBA programs in Kerala. It is partnered to MG College, Kottayam, Kerala. MIM is endorsed by the All-India Board for Specialized Training (AICTE), New Delhi with an authorized admission of 180 understudies. A confided in name on its legitimacy in the advanced education the scholarly world in Kerala and abroad, MIM is a co-instructive foundation unmistakably situated in a beautiful, peaceful and climatically empowering milieu at Kuttikkanam, oversaw by the Catholic See of Kanjirapally
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oo9v5gu33clhp24j5zuq.PNG)
[DAY 18-20] I Built A Game & A Calorie Counter In Javascript
Tags: beginners, learning, javascript, webdev
Published: 2024-05-26 05:49:59

Hi everyone! Welcome back to my blog where I document the things I learned in web development. I do this because it helps retain the information and concepts as it is some sort of an active recall.

On days 18-20, I built a text-based role-playing game and a calorie counter to learn basic Javascript concepts and form validation.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gx5n6pb2wc9tfgow5u1d.PNG)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xq7n7petlhn55yebdysf.PNG)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/69n5gmlukrmo33yvi1xu.PNG)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/biy03u6b8mocxpg1vk7a.PNG)

10 things I learned:

1. JavaScript interacts with HTML using the syntax `document.querySelector()` and `document.getElementById()`.

2. Initialize buttons with object properties such as `.onclick` (e.g. `button.onclick = myFunction`)

3. The use of arrays [] and objects {} in building my role playing game.
   - Utilizing key-value pairs within objects.

4. Refactoring such as using compound assignments for clean code.

5. Adding newlines in Javascript using \n.

6. Block scoping where I put a variable inside a code to only be accessible inside that block.

7. Regular expressions to avoid non-alphanumeric characters in building my calorie counter.

8. More method calls like `.replace()`, `.Number()`, `.toLowerCase()`,`.addEventListener()`, etc.

9. Template literal syntax (e.g. `string string string ${variable}` ), this is a great alternative to concatenations.

10. To use ternary operators (e.g. `const variableName = condition ? ‘if true statement’ : ‘if false statement’;`)

Comparing my progress when I was learning HTML and CSS, previously, I was able to build 1-2 projects per day. But now in Javascript, I can only build 1 or complete half a project per day.

The reason why it takes longer than before is because for me, Javascript is harder to digest than HTML and CSS. Also, I’m taking more time to understand its concepts and learn the purpose of every syntax that freecodecamp is teaching me. Additionally, I take the time to understand the why behind every line of code that I write.

Overall, I'm having fun with my coding progress and day by day I feel the improvement and it helps a lot in maintaining momentum to keep being consistent in learning.

That’s all for now, thank you for reading. I’ll see you all next blog!
Importance of Using a BMI Calculator for Your Health
Published: 2024-05-26 05:11:29

Body Mass Index (BMI) is a widely used tool to assess an individual's weight status in relation to their height. While it may not provide a complete picture of health, utilizing a **[BMI Calculator](https://bmicalculator.fit/)** can be a valuable step towards understanding and managing your weight and overall well-being. In this article, we will explore the reasons why using a BMI calc is important for maintaining good health. 
 
1. **Assessing Weight Status**: One of the primary reasons to use a BMI calculator is to determine whether you are underweight, normal weight, overweight, or obese. By calculating your BMI, you can get a general idea of where you fall on the weight spectrum and whether you may be at risk for certain health conditions associated with being over or underweight. 
 
2. **Health Risk Identification**: BMI is linked to various health risks, such as heart disease, diabetes, high blood pressure, and certain types of cancer. Knowing your BMI can help you and your healthcare provider identify potential health risks early on, allowing for preventive measures to be taken to reduce the risk of developing these conditions. 
 
3. **Setting Health Goals**: Monitoring your BMI over time can help you set realistic health and fitness goals. Whether you are aiming to lose weight, gain muscle mass, or maintain your current weight, tracking changes in your BMI can provide valuable feedback on the effectiveness of your efforts and help you stay motivated on your health journey. 
 
4. **Informing Lifestyle Choices**: Your BMI can guide you in making informed decisions about your diet, exercise routine, and overall lifestyle choices. For example, if your BMI indicates that you are overweight, you may consider incorporating more physical activity into your daily routine and making healthier food choices to achieve a healthier weight. 
 
5. **Professional Guidance**: Healthcare professionals often use BMI as a screening tool to assess patients' weight status and overall health. By knowing your BMI, you can have more meaningful discussions with your healthcare provider about your weight management goals and receive personalized recommendations for improving your health. 
 
6. **Overall Well-Being**: Maintaining a healthy weight is essential for overall well-being and quality of life. By using a BMI tool to monitor your weight status, you can take proactive steps to protect your health, improve your energy levels, enhance your self-esteem, and reduce the risk of chronic diseases associated with obesity and underweight. 
 
In conclusion, using a **[BMI Calculator](https://bmicalculator.fit/)** is a simple yet effective way to gain insight into your weight status and overall health. While BMI should be considered in conjunction with other health indicators, it can be a valuable tool for setting goals, identifying health risks, and making informed decisions to improve your well-being. Embrace the power of knowledge that a BMI calc provides and take proactive steps towards a healthier, happier you.
My Experience at GEIW: Developing CleanBox to Combat Phishing Attacks
Tags: hackathon
Published: 2024-05-26 04:47:31



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

The excitement in the air was undeniable as I joined hundreds of innovators at the Global Entrepreneur and Innovation Week (GEIW) Hackathon. This event was far from a typical coding competition; it was an intense burst of brainstorming, problem-solving, and boundary-pushing, all under a tight deadline.

Our first challenge was uniquely Moroccan: addressing drought. With only 48 hours to find a solution, our team focused on a promising idea—a Drought Prediction Platform. We envisioned a user-friendly tool leveraging data and analytics to forecast droughts, helping farmers and policymakers make informed decisions. Fueled by late-night caffeine, our coding sessions were both intense and exhilarating, and the strong sense of camaraderie drove us to create something impactful.

Advancing to the final phase brought an unmatched thrill. This time, the global challenge was phishing. We saw a chance to protect organizations and individuals with our solution: CleanBox, a Software-as-a-Service (SaaS) designed to secure email. CleanBox would serve as a protective mail server, filtering emails before they reached clients' inboxes, significantly reducing phishing risks.

The last 24 hours were a whirlwind of focused development, pitch refinement, and battling fatigue. Our determination to create a practical solution fueled every keystroke. When it was time to present, our nervous energy turned into a passionate demonstration of CleanBox.

Though we didn't win the final prize, the experience was transformative. GEIW wasn't just about winning; it was about the journey of innovation, the power of collaboration, and the excitement of bringing ideas to life. We tackled two very different challenges, sharpened our skills under pressure, and gained newfound confidence in our ability to make a difference.

To view the complete code for our project and the documentation, you can visit our GitHub repository here : 
[the model repo](https://github.com/issam-assiyadi/fishing-model)
[the main repo](https://github.com/elmahdigaga/clean-box)
The repository contains everything needed to understand and reproduce our system, including preprocessing scripts, model training, and prediction functions.
[FASTPANEL] Getting started with FASTPANEL
Tags: fastpanel, vps, linux, webhosting
Published: 2024-05-26 04:42:46

**Introduction**

FASTPANEL is a simple and powerful server management panel that allows you to create sites in a few clicks, manage mail, databases, backups, plan tasks, and analyze traffic. Set and configure access rights as you like - each site can be assigned to a single user. To improve the security of your account, connect two-factor authentication.

More information can be found on an official web page:

[https://fastpanel.direct/](https://fastpanel.direct/)

Demo version can be tried here:

https://fastpanel.direct/demo

FASTPANEL template

In [VPSsell](https://www.vpssell.com/) you are able to install FASTPANEL template really easy and fast, only with few mouse clicks:

1.Login to the Client Area;
2.Select at the top of the menu the "My Services > VPS" tab;
3.Press the "Manage" button at the service table;
4.Press the "Install OS" button;
5.Choose operating system, agree with the warning, and press "Continue";
6.Wait for 5-10 minutes and refresh the VPS management page.

FASTPANEL template contains:

Debian 10
Apache 2.4
NGINX 1.18
PHP 7.3
MySQL 5.7

1. Login

FASTPANEL uses 8888 port, so to connect to the control panel on your internet browser enter:

https://ip_of_your_server:8888

On your first login, the Panel will ask you for a license. In order to get one, simply enter your email address. The license data will be sent to your email address.

Log in details for the first attempt to log in are:

Username: fastuser

The password for the "fastuser" user matches the "root" user password. It can be found in your VPS management page under the Login Details tab.
"sh: next: command not found" in Next.js Development? Here's the Fix!
Published: 2024-05-26 04:29:26

Ever run `npm run dev` in your Next.js project only to be greeted by the confusing `sh: next: command not found` error? Don't worry, this is a common hurdle faced by developers, and it's easily fixable.

This error pops up because the next command isn't recognized by your terminal. It could be due to two reasons:

- **Next.js Installed Locally:** Most likely, Next.js is installed as a project dependency, not globally on your system.
- **Missing Script:** Your package.json might be missing the script that triggers the next dev command.

Let's explore solutions for both scenarios:

## Solution 1: Running Next.js Locally

If you prefer to keep Next.js specific to your project, follow these steps:

## 1. Utilize the Full Command

Since Next.js is a local dependency, you can directly run the development server using the full command:

```
npm run dev
```

This should trigger the script defined in your package.json (assuming it includes next dev).

## 2. Verify package.json Script:

Open your project's package.json and check for the "scripts" section. Make sure it contains the following script:

```
JSON
"scripts": {
  "dev": "next dev"
}
```

If missing, add this script and try npm run dev again.

## Solution 2: Installing Next.js Globally (Optional)

This approach allows you to use next commands from any directory in your terminal. However, it's generally recommended to keep Next.js local to avoid version conflicts with other projects. Here's how to do it (use with caution):

### Global Installation:

```
npm install -g next
```

This installs Next.js globally on your system.

### Run Next.js Commands:

Now you can directly use commands like `next dev` or `next build` from any directory.

By following these solutions, you should be able to resolve the "sh: next: command not found" error and successfully launch your Next.js development server. Remember, keeping Next.js local is preferred for better project isolation.

Happy Coding!