teleren/devto huggingface dataset:
Level Up Your Command Line with Amazon CodeWhisperer
Published: 2024-03-13 14:03:00

## Introduction

The command line: a powerful tool for developers, but notoriously unfriendly.  While it grants fine-grained control, memorizing complex commands and options can slow you down.  Here's where Amazon CodeWhisperer for command line comes in, bringing the power of AI to your terminal.

**Modernizing the Command Line Experience**

CodeWhisperer for command line, currently in preview,  augments your existing workflow with AI-powered features:

* **Intelligent Code Completions:**  Say goodbye to typos and repetitive commands.  CodeWhisperer offers IDE-style completions for over 500 popular CLIs, including Git, npm, Docker, and the AWS CLI itself.  Start typing, and CodeWhisperer suggests options, reducing errors and saving you time.

* **Inline Documentation at Your Fingertips:**  No more context switching!  CodeWhisperer provides inline documentation as you type.  Need a quick refresher on a specific option?  No problem - the information is right there, eliminating the need to  search online manuals.

* **Natural Language to Bash Translation:**  This is where things get exciting.  CodeWhisperer's `cw ai`  command lets you write commands in natural language.  Imagine describing what you want to achieve, like "download data from my S3 buckets to my desktop," and CodeWhisperer translates it into an executable bash snippet. 

**Benefits for Developers**

These features combine to offer significant benefits:

* **Increased Productivity:**  Spend less time memorizing commands and options, and more time getting things done.
* **Reduced Errors:**  Intelligent completions minimize typos and incorrect usage.
* **Improved Learning Curve:**  New developers can get up and running faster with inline documentation and natural language translation.
* **Enhanced Workflow:**  Stay focused in your terminal environment without needing to switch to a browser for reference.

**Getting Started (It's Easy!)**

CodeWhisperer for command line is currently available in preview for macOS and works with major shells (bash, zsh, fish) and terminal emulators (iTerm2, Terminal, Visual Studio Code terminal, etc.).  

Head over to the AWS documentation [AWS CodeWhisperer install](https://docs.aws.amazon.com/codewhisperer/latest/userguide/command-line-getting-started-installing.html) for  installation instructions and to explore the [AWS CodeWhisperer documentation](https://docs.aws.amazon.com/codewhisperer/latest/userguide/what-is-cwspr.html) to learn more about this exciting new tool.

**The Future of the Command Line**

Amazon CodeWhisperer for command line represents a significant leap forward for the command line experience. By leveraging AI, it empowers developers to be more productive and efficient.  As CodeWhisperer evolves, we can expect even more advanced features, making the command line an even more powerful and accessible tool.
Managing .NET Solution Files with dotnet sln
Tags: dotnet, dotnetcore, tools, aspnet
Published: 2024-03-13 13:52:12

It allows you to list existing projects, modify their configuration, and add new ones. To create a solution file, use the dotnet new sln command.


## Overview

The dotnet sln command is a powerful tool for managing projects within a .NET solution file. Whether you need to list existing projects, modify their configuration, or add new ones, dotnet sln streamlines these tasks.

## Creating a Solution File

Before using dotnet sln, ensure that your solution file already exists. If not, you can create one using the dotnet new command with the sln template name.

To create a .sln file in the current folder (with the same name as the folder), run:

    dotnet new sln

To create a .sln file with a custom name, execute:

    dotnet new sln --name MySolution

To create a .sln file in a specific folder, use:

    dotnet new sln --output MySolution

## Listing Projects

To view all projects within a solution file, use the list command:

    dotnet sln list

## Adding Projects to the Solution

To expand your solution, you can add one or more projects using the dotnet sln add command. Here are the details:

    dotnet sln add [--in-root] [-s|--solution-folder <PATH>] <PROJECT_PATH> [<PROJECT_PATH>...]

* <PROJECT_PATH>: Specify the path to the project(s) you want to include in the solution.

* --in-root: An optional flag that allows you to add projects directly to the root of the solution.

* -s|--solution-folder <PATH>: Optionally, provide the folder where the solution file resides.

## Examples

- To add a single project to your solution:

`    dotnet sln add MyProject.csproj
`
- To add multiple projects:

`    dotnet sln add Project1.csproj Project2.csproj
`
- If you want to add projects to the root of the solution:

`    dotnet sln add --in-root MyProject.csproj
`
- Specify a custom solution folder:

`    dotnet sln add -s MySolutionFolder MyProject.csproj
`
Remember that the dotnet sln command simplifies managing project dependencies and organization within your solution.

## Compatibility

This article applies to .NET Core 3.1 SDK and later versions.

## More Articles
[**New LINQ Methods in .Net 9**](https://medium.com/c-sharp-progarmming/new-linq-methods-in-net-9-4a5d9682d66c)
[**Building NuGet Packages with the .NET CLI**](https://medium.com/c-sharp-progarmming/building-nuget-packages-with-the-net-cli-da03ef007f23)
[**Persist Your Data with SQLite and EF Core**](https://medium.com/c-sharp-progarmming/persist-your-data-with-sqlite-and-ef-core-4781ab6af922)
[**Boost API Development: Mastering Minimal APIs with EF Core**](https://medium.com/c-sharp-progarmming/boost-api-development-mastering-minimal-apis-with-ef-core-4793160a059a)

### Follow me on

[C# Publication](https://medium.com/c-sharp-progarmming), [LinkedIn](https://www.linkedin.com/in/sukhpinder-singh-532284a2/), [Instagram](https://www.instagram.com/sukhpindersukh/), [Twitter](https://twitter.com/sukhsukhpinder), [Dev.to](https://dev.to/ssukhpinder)
Understanding the useState Hook in React: Simplifying State Management
Tags: react, webdev, beginners, javascript
Published: 2024-03-13 13:40:52

> If you like this blog, you can visit my personal blog [sehgaltech](https://blog.sehgaltech.com/) for more content.


The useState hook is a built-in hook in React that allows you to add state to your functional components. It is a part of the Hooks API introduced in React 16.8.

The useState hook takes one argument, which is the initial state, and returns an array of two elements: the current state and a function to update it.

Here is an example of how to use the useState hook:

```javascript
import React, { useState } from 'react';

function Counter() {
  // Declare a new state variable, which we'll call "count"
  const [count, setCount] = useState(0);

  return (
    <div>
      <p>You clicked {count} times</p>
      <button onClick={() => setCount(count + 1)}>
        Click me
      </button>
    </div>
  );
}
```

In this example, useState(0) declares a new state variable called count and initializes it to 0. The setCount function is used to update the state. When the user clicks the button, the onClick handler calls setCount with the new value, which triggers a re-render of the Counter component with the updated state.

There is also a second way to update the state in React using the useState hook that is `setCount(prev => prev + 1)`. Here, `setCount` is the function returned by the `useState` hook that allows you to update the state.

The function setCount is being called with a function as its argument. This function takes the previous state (which we're calling prev) as its argument and returns the new state. In this case, the new state is the previous state plus one (prev + 1).

This is particularly important when the new state depends on the previous state. React may batch multiple setCount calls into a single update for performance reasons. This means that, when the next state depends on the previous one, you could potentially be reading a state that is out-of-date if you do not use a function to update the state.

By passing a function (prev => prev + 1) to setCount, you are ensuring that React will always apply the state update with the most recent version of the state.
<br>


> If you like this blog, you can visit my personal blog [sehgaltech](https://blog.sehgaltech.com/) for more content.
Your Dream Property In Rishikesh
Published: 2024-03-13 13:33:00

Are you dreaming of owning a piece of paradise in the serene and spiritual city of Rishikesh? Look no further! In this blog post, we will explore the various properties for sale in Rishikesh and guide you on how to find your dream property in this breathtaking city.

The Appeal Of Rishikesh
Rishikesh, nestled in the foothills of the Himalayas, is not only a popular pilgrimage destination but also a haven for spiritual seekers and adventure enthusiasts.

From the iconic Laxman Jhula to the tranquil ashrams and yoga centres, Rishikesh offers a unique blend of spirituality, natural beauty, and adventure.

Scenic Location: Rishikesh, located in the foothills of the Himalayas, offers breathtaking views of the mountains and the holy Ganges River.

Owning a property here gives you the opportunity to wake up to stunning natural beauty every day.

Spiritual Hub: Rishikesh is known as the “Yoga Capital of the World” and is a popular destination for spiritual seekers.

Many ashrams and yoga centres are located here, offering a serene and peaceful environment for those looking to connect with their inner selves.

Adventure Activities: Rishikesh is a hub for adventure activities like white-water rafting, trekking, and camping.

Owning a property here means having easy access to these thrilling experiences, making it a great investment for adventure enthusiasts.

The properties for sale in Rishikesh offer a unique combination of natural beauty, spiritual serenity, and adventure opportunities, making them an attractive option for those seeking a peaceful and fulfilling lifestyle.
Compliant robotics & hugging people
Tags: ros, robotics, stickers
Published: 2024-03-13 13:31:42

Many years ago, I was working on a MSc Project with A #ROS robot called Baxter

The MSc project was around collaborative robotics and VR. - The idea was that you could reach out and touch a surface in VR, and that that surface could be manipulated by the robots end-effector - for example, a doorknob.

I had a few good prototypes working, (including the doorknob example) but ultimatly the project didnt progress

> Ill try to dig up a video of this some time!

Sadly the company that built and maintained Baxer - https://www.rethinkrobotics.com/ Decided to discontinue this model, and no longer support it. 

As such, it was hard to give to other students, and so it was decided to build a demo out of baxter.

--- 

## So I rigged a robot to hug people, and print stickers...


{% embed https://www.youtube.com/watch?v=mQ63okIuWfE %}

The project was split into 3 seperate systems.

### Server 
The server was a python flask http server, which worked to orchestrate the system. 
* It requested/responded to data from the android app (image files and triggers)
* It handled the ROS communication to replay pre-recoreded robot path movements.
* It used python, and opencv to generate the final sticker files.
* It used a bespoke printer driver developed by epson to print the final sticker!

### Android App
This was a very early [cordova](https://cordova.apache.org/) app that was designed to run on the tablet - a rooted Amazon fire tablet. The app was written in javascript, compiled for Android.

The app sent push/get commands to the Server, and also used the camera to obtain the "Selfie" image.

### Robot
The Robot itself was running ROS, and I wrote a custom application designed to replay specific motion paths. 

ROS is (or was at the time) not really designed to do specific repeatable motion paths. It was designed to be more specific - eg "Move from XYZ to XYZ". But since we are dealing with close proximity to humans, we needed a more consistant approach.

The application instead worked its way through a series of points, with a threshold for achieving each one. 
As the "Hug" action takes place, the threshold was increased, to allow for "larger" or "smaller" people.... (if someone with a larger body mass gets hugged, the robot doesnt try to squeeze too hard!)

---

## Legacy.

The demo has now been running for almost 8 years, and as of 2024 seems to still be working!

One day I suspect baxter will break down. Hopefully I will be called back to fix him...

{% embed https://twitter.com/KurtBarling/status/1710646833893253208 %}


![Baxter](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bn4psljeig8m7t894bgb.png)
My New Favorite CSS Trick: will-change
Tags: css, animation, frontend, development
Published: 2024-03-13 13:07:49

I recently discovered a handy CSS trick that's made a noticeable difference in how I handle animations and transitions. Meet the useful `will-change` property, a simple but effective way to tell the browser about upcoming changes to an element's properties.

**What is `will-change`?**

Honestly, until a few days ago, I had no idea this property even existed. The `will-change` property is a way to tell the browser, "Hey! I'm going to change these specific properties on this element soon, so you might want to get ready for that."

It's like allowing the browser to optimize and prepare for the upcoming changes. Impressive, isn't it?

**How to Use `will-change`**

Using `will-change` is super simple. You just list out the properties that you plan to animate or transition, like this:

```css
.my-element {
  will-change: transform, opacity;
}

.my-element:hover{
   transform: scale(2);
   opacity: 0;
```

This line of code tells the browser, "Get ready because I'm going to be changing the `transform` and `opacity` properties on this element."

**Why You Should Care**

Let me give you a real-world example of why `will-change` is so awesome. Imagine you're working on a complex animation that involves multiple elements moving around, scaling, and fading in and out. Without `will-change`, the browser might struggle to keep up, leading to janky animations.

But when you use `will-change`, you're essentially giving the browser a chance to optimize and prioritize the right resources for those specific property changes.

**A Word of Caution**

Now, as with any powerful tool, `will-change` should be used responsibly. If you overuse it or specify properties that never actually change, you could end up wasting system resources and potentially causing performance issues.

Use `will-change` judiciously and only for elements that will undergo complex animations or transitions. Specify only the properties that you know will change, and be sure to remove the `will-change` declaration once the animation or transition is complete.

**Give It a Try!**

I can't recommend `will-change` enough, especially if you're working on complex animations or transitions. It's a game-changer, and it's so easy to implement.
Flowing Code
Tags: coding, selfdevelopment, productivity
Published: 2024-03-13 12:54:30

In 1970, psychologist Mihaly Csikszentmihalyi named the state of mind known as **flow**. Sharing many similarities with [hyperfocus](https://en.wikipedia.org/wiki/Hyperfocus), it is best described as a moment of clarity in which one is fully immersed in a state of intense focus.

If you've been coding for a while, you've probably experienced this. It requires a specific setup, but it always ends up in a tremendous amount of work being accomplished in little time.

I like cooking, so I though about introducing this topic as a recipe.

To cook a full batch of Flow, you'll need to following ingredients:
- A full night of sleep. Let the dev rest long enough to feel energized.
- Water. Truth be told, I'm not sure this one is absolutely necessary, but I like to start off the day with a large glass of water with a pinch of salt and a few drops of lemon juice. Mostly because tap water tastes like granite around here.
- A challenging task. It is nearly impossible to reach a state of flow when working on something easy/repetitive. If the task at hand requires you to replace a bunch of icons throughout a large scale web application, you don't need a state of flow you need ~~an intern~~ a large amount of coffee.
- A clear goal. I like to work with user stories, to know exactly what's expected. Pen and paper are enough, just write down what you need to accomplish, and cross it off as you progress.
- The knowledge. Ideally, you should already be experienced enough to know how to build whatever you're working on. That means no chatGPT, no stackOverflow, just pure coding.
- Needless to say, ditch all external distractions. Phone must be in airplane mode, notifications are turned off, VSCode is in zen mode.

The goal is to setup an environment that'll naturally bring you into this state of flow. You cannot force it, you need to let it slip in.
Lessons Learned from Revisiting a Low-Stake Client Project
Tags: programming, productivity, writing, development
Published: 2024-03-13 12:49:10

Recently, I found myself revisiting a project from last year that involved working with React Native and NEST for a client who wasn't particularly tech-savvy. The experience wasn't exactly enjoyable due to communication issues and vague requirements, leading to a project that felt like a chore. However, upon digging back into the codebase, I uncovered some valuable lessons that I believe are worth sharing:

1. **Prioritize Version Control:** Managing versions diligently can save you from headaches down the road by ensuring that changes are tracked and reversible.

2. **Embrace Authenticator Apps:** Utilizing authenticator apps adds an extra layer of security to your projects, safeguarding sensitive information from potential threats.

3. **Choose Reliable Libraries:** Opting for well-maintained libraries reduces the risk of encountering bugs and compatibility issues, enhancing overall project stability.

4. **Comment Your Logic:** Adding clear comments to your codebase aids in understanding and maintaining the logic behind your implementations, especially when revisiting the project after some time.

5. **Commit with Clarity:** Crafting informative commit messages facilitates collaboration and enhances accountability, making it easier to track changes and understand the project's development history.

6. **Align Technologies with Project Scope:** Selecting technologies that are well-suited for the project's requirements can streamline development and ensure efficient resource utilization.

7. **Maintain a Clear Project Structure:** Organizing your project with a clear and intuitive structure enhances readability and navigation, fostering productivity and collaboration among team members.

8. **Embrace Documentation:** Investing time in reading and creating comprehensive documentation pays off by providing invaluable guidance and reference points for yourself and others working on the project.

By reflecting on these lessons, I've reaffirmed the importance of foundational practices in software development and their impact on project success. Whether you're starting a new project or revisiting an old one, incorporating these principles can contribute to a smoother and more rewarding development experience.
How to Enable free SSL in Your Domain Hosted on Remote Server or VPS ( only on domain if you have, not in server_ip )
Published: 2024-03-13 12:43:24

Install Certbot and it’s Nginx plugin

```
sudo apt install certbot python3-certbot-nginx
```


Verify Web Server Ports are Open and Allowed through Firewall

```
sudo ufw status verbose
```


Obtain an SSL certificate

```
sudo certbot --nginx -d your_domain.com -d www.your_domain.com -d api.your_domain.com -d admin.your_domain.com -d www.admin.your_domain.com
```

Check Status of Certbot

```
sudo systemctl status certbot.timer
```


Dry Run SSL Renewal

```
sudo certbot renew --dry-run
```
How to install Laravel 11 on linux
Tags: php, laravel, webdev
Published: 2024-03-13 12:14:00


## Prerequisite

By default, Laravel v11 tries to connect to a sqlite database, so ensure it is properly installed with

```shell
sudo apt install php-sqlite3
```

## Install PHP8.3

Laravel 11 requires PHP 8.2 or 8.3, so let's install the latest version

It should work the same way if you installed MySql and not PostGre

### 1. Run system updates

```shell
sudo apt update && apt upgrade -y
```

### 2. Add Ondrej repository

The current maintainer of PHP is Ondrej Sury. It sounds odds that the package of such a language doesn't belong to an organisation, but here you can add it safely : 

```shell
sudo add-apt-repository ppa:ondrej/php
```

Update all repositories once again with

```shell
sudo apt update
```

Check PHP version with 

```shell
php --version
# PHP 8.3.3-1+ubuntu22.04.1+deb.sury.org+1 (cli)
```

### 3. Add dependencies

Laravel will be buggy if you don't install PHP base modules

```shell
sudo apt-get install -y php8.3-cli php8.3-common php8.3-fpm php8.3-zip php8.3-gd php8.3-mbstring php8.3-curl php8.3-xml php8.3-bcmath
```

## Install composer

`composer` is a tool to build new laravel application.

Follow first paragraph of https://getcomposer.org/download/

Ensure it is properly working on your machine by typing

```shell
composer  --version
# Composer version 2.7.2 2024-03-11 17:12:18
```

## Create a default Laravel 11 application

```shell
composer create-project laravel/laravel=11 MyApp
```

Installation will last a few second, it should end up with migrations, like this

```shell
# long previous logs...

   INFO  Running migrations.  

  0001_01_01_000000_create_users_table .......................... 31.91ms DONE
  0001_01_01_000001_create_cache_table .......................... 18.81ms DONE
  0001_01_01_000002_create_jobs_table ........................... 24.48ms DONE
```

## Run the application

```shell
cd MyApp
php artisan serve
```

Open browser at http://127.0.0.1:8000, and ta-da!
Serverspace in Brazil!
Tags: braziliandevs, development, cloud, cloudcomputing
Published: 2024-03-13 12:24:23

**Ola!**

Serverspace is expanding into new regions and has launched its sales in Latin America, Brazil! Local users can now deploy infrastructure in the Serverspace cloud.

To ensure a seamless experience for Brazilian users, we've launched a localized website, [Serverspace.com.br](https://serverspace.com.br/), provided a control panel, and introduced payment options in the local currency, the Brazilian Real.

Serverspace complies with the Brazilian General Personal Data Protection Law (LGPD) to safeguard users' data. 

Want to know more? Read the full press-release [here](https://serverspace.us/about/news/serverspace-in-brazil/
): [https://serverspace.us/about/news/serverspace-in-brazil/
](https://serverspace.us/about/news/serverspace-in-brazil/
)
Also, we’d like to inform you that we connected the [Equinix SP3 data center](https://serverspace.us/infrastructure/data-center-sao-paulo/) in São Paulo for all our users. The data center meets international quality standards and holds three Tier III certifications from the Uptime Institute. Operational Sustainability has a maximum Gold level.

_How to deploy a server in Brazil?_

1. [Sign up!](https://serverspace.us)
2. Click "Create server" in the vStack cloud section;
3. Select São Paulo, Brazil among the data centers;
4. Set up the server configuration;
5. Click the "Order" button.

_Need help? Our 24/7 tech support is just a tab click or phone call away at +1 647 4935 0400._

<a href="http://serverspace.us?utm_source=devto&utm_medium=articles&utm_campaign=main"><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h3i5ukd2vvi8bst6tohi.png"></a>

_[Serverspace](http://serverspace.us?utm_source=devto&utm_medium=articles&utm_campaign=main) is an international cloud provider offering automatic deployment of [virtual infrastructure](http://serverspace.us?utm_source=devto&utm_medium=articles&utm_campaign=main) based on Linux and Windows from anywhere in the world in less than 1 minute. For the integration of client services, open tools like API, CLI, and Terraform are available._