teleren/devto huggingface dataset:
What is Web API and REST API?
Tags: webapi, webdev, restapi, api
Published: 2023-07-30 07:40:52

**Here's a table explaining the differences between Web API and REST API:**

| Aspect            | Web API                                     | REST API                                      |
|-------------------|---------------------------------------------|-----------------------------------------------|
| Definition       | An API (Application Programming Interface) that is designed to be consumed by web applications over HTTP. It is a broad term encompassing various API styles. | A type of Web API that follows the principles of Representational State Transfer (REST) architecture. |
| Architectural Style | No specific architectural style is mandated, allowing for flexibility in design. | Adheres to the principles of REST, which is a specific architectural style for designing networked applications. |
| Endpoint Naming | Typically uses arbitrary endpoint names, often reflecting the server's internal structure. | Uses meaningful and standardized endpoint names that represent resources. |
| Data Format | Can support various data formats, including XML, JSON, and others, depending on the implementation. | Primarily uses JSON as the data format, but can also support XML and other formats. |
| Statelessness | May or may not be stateless, depending on the implementation. | Designed to be stateless, meaning each request from a client to the server must contain all the information needed to understand and process the request. |
| CRUD Operations | Supports CRUD (Create, Read, Update, Delete) operations, but the implementation can vary. | Emphasizes CRUD operations, and each operation maps to an HTTP method (GET, POST, PUT, DELETE) for working with resources. |
| Error Handling | Error handling approaches can differ based on the API implementation. | Utilizes standard HTTP status codes and error responses for consistent error handling. |
| Uniform Interface | No strict requirements for a uniform interface. | Follows a uniform interface with standardized HTTP methods and resource URIs. |
| State Management | May require server-side sessions or other mechanisms for state management. | Stateless design eliminates the need for server-side sessions, simplifying the architecture. |
| Scalability | Scalability depends on the specific design and architecture choices. | RESTful APIs can be highly scalable due to their statelessness and uniformity. |

It's important to note that all REST APIs are Web APIs, but not all Web APIs follow the principles of REST. REST is just one approach to designing Web APIs, and there are other styles like SOAP, GraphQL, and more.
Some widely use React modules
Published: 2023-07-30 07:35:47

Here are list of 20 widely used and popular React modules along with instructions on how to install each of them using npm:

1. React: The core library for building React applications.
   Installation: `npm install react`

2. react-dom: Provides methods for working with the DOM in React applications.
   Installation: `npm install react-dom`

3. react-router-dom: A library for handling routing in React applications.
   Installation: `npm install react-router-dom`

4. axios: A popular HTTP client for making API requests in React.
   Installation: `npm install axios`

5. redux: A state management library for React applications.
   Installation: `npm install redux`

6. react-redux: Official bindings for using Redux with React.
   Installation: `npm install react-redux`

7. redux-thunk: A middleware for handling asynchronous actions in Redux.
   Installation: `npm install redux-thunk`

8. prop-types: A library for defining and validating prop types in React components.
   Installation: `npm install prop-types`

9. moment: A library for working with dates and times in React applications.
   Installation: `npm install moment`

10. react-icons: Provides a collection of popular icons as React components.
    Installation: `npm install react-icons`

11. react-modal: A flexible and accessible modal dialog component for React.
    Installation: `npm install react-modal`

12. react-toastify: A library for displaying toast notifications in React applications.
    Installation: `npm install react-toastify`

13. react-datepicker: A date picker component for React applications.
    Installation: `npm install react-datepicker`

14. react-slick: A carousel/slider component for React.
    Installation: `npm install react-slick`

15. react-dnd: A library for implementing drag and drop functionality in React.
    Installation: `npm install react-dnd`

16. styled-components: A popular library for styling React components using tagged template literals.
    Installation: `npm install styled-components`

17. formik: A library for building forms in React with easy form validation.
    Installation: `npm install formik`

18. yup: A validation library used in conjunction with Formik for form validation.
    Installation: `npm install yup`

19. react-helmet: A library for managing the document head in React applications.
    Installation: `npm install react-helmet`

20. react-testing-library: A utility library for testing React components in a user-centric way.
    Installation: `npm install react-testing-library`
Can you rebase on just the main branch? No.
Tags: git
Published: 2023-07-30 06:20:22

_📝 This post is part of my ["Shorts"](https://poddarayush.com/shorts) series. Each post in this series is hyper-focused on a single concept and should take less than 1 minute to read._

In an [earlier post](https://poddarayush.com/shorts/git-rebase-intro/), I introduced you to the powerful `git-rebase` command. The syntax for the command is:

```sh
git rebase <baseBranch>
```

Rebase on anything
------------------

The `baseBranch` need not necessarily be a branch. It can be anything - a tag, a commit ID, relative reference to `HEAD`, etc.

For example, if you have a commit with ID as `e92aa98f`, you can do:

```
git rebase e92aa98f
```

And voila, your feature branch’s base would change to this commit.

### To be noted - for next post

The commit ID can be any commit, i.e., it can also be a commit that is already part of your feature branch. This ability to rebase on any commit is extremely useful for the purposes of rewriting history. You will find out more about this when I explore the **interactive mode** of `git-rebase` in my upcoming post.

Sources
-------

*   [https://www.atlassian.com/git/tutorials/rewriting-history](https://www.atlassian.com/git/tutorials/rewriting-history)
*   [https://www.atlassian.com/git/tutorials/rewriting-history/git-rebase](https://www.atlassian.com/git/tutorials/rewriting-history/git-rebase)
GSoC Week 5-8
Tags: gsoc
Published: 2023-07-30 07:35:19

## Brief
I have worked on creating unit tests for the Lomb Scargle Cross Spectrum class, cross verifying the algorithm by comparing with the papers and fixed typos in docstrings. Apologies for the delay. Had my exams.

## Details
I have noticed a few faults in both the fast and the slow algorithms. I have gone back to the drawing board and tried to address those issues by following the papers as closely as possible. All the changes are visible in the following draft pull request.
https://github.com/StingraySoftware/stingray/pull/737

After the fixing, the fast and the slow algorithm have started giving very similar outputs. I am starting to suspect that the time lags might be broken in the algorithms themselves. It is starting to get a little suspicious when different methods are giving very similar results and they are still not what that is expected. Last time around the fast and slow algorithms have given different results. After cross verifying with the papers, The results from both have fast and slow algorithms converged.

To keep the project sailing along while I wait for confirmation that this is an issue with the implementation or the algorithm , I have decided to work on writing unit tests for the various classes and methods. Furthermore I also worked on fixing the docstrings.

{%embed https://gist.github.com/pupperemeritus/fc0567591cb65f9035f37728df84f04a %}
How can machine learning be used to solve climate change ?
Tags: machinelearning, python, opensource
Published: 2023-07-30 07:32:47

You might have heard about climate change and how it is having a significant impact on businesses around the world. The effects of climate change are varied and can be both indirect and direct. Some of the ways climate change is affecting businesses include:

1. Change in weather patterns

2. Rising sea levels

3. Change in agriculture yields

To monitor and reduce the effects of climate change, machine learning techniques can be used. Machine learning can be used to analyze large climate datasets such as weather data to identify weather patterns that may not be visible directly to humans. Machine learning can also be used to monitor the garbage in landfills and monitor the gases being released into the air that is causing global temperatures to rise. This information can then be used to assess the impact of these changes on the climate and to develop strategies for mitigating their effects. Another way of monitoring climate change is by optimizing energy systems. Energy systems can be optimized such as power grids and transportation networks. This can help reduce energy consumption. Certain organizations have taken the initiative to allocate more funds to climate change research.

The Climate Change AI initiative, a global non-profit, is using machine learning to develop new ways to monitor and predict climate change. The initiative has developed a number of tools that are being used by scientists and policymakers around the world.

Google Earth Engine is a platform that uses machine learning to analyze satellite imagery and other data to track changes in the Earth's climate and environment. The Earth Engine is used by researchers, businesses, and governments to monitor deforestation, track sea level rise, and assess the impact of climate change on different regions.

The Amazon Rainforest Project is using machine learning to monitor deforestation in the Amazon rainforest. The project uses satellite imagery and other data to identify areas of deforestation and to track the progress of deforestation over time.

Final thoughts:

These are just a few examples of how people are playing their part by using machine learning to reduce the impact of climate change. It is important to remember that machine learning is not a silver bullet. It will not solve climate change on its own. However, it can be a powerful tool that can help us to better understand the climate, to track our progress in reducing emissions, and to develop more sustainable solutions.
How can you deal with imposter syndrome ?
Tags: programming, productivity
Published: 2023-07-30 07:30:41

Imposter syndrome is a psychological phenomenon in which people doubt their abilities, talents, or accomplishments. People of any age can face imposter syndrome. A person who might have years of experience can also face impostor syndrome as well. The very first thing a person with impostor syndrome, feels is that they are not successful and that they don't deserve certain things in life.

Impostor syndrome is a common experience among many professionals in the IT industry. Impostor syndrome is more common in women than men. Women are made made to feel that they are incompetent and can't do anything other than household chores. The symptoms of imposter syndrome can vary from person to person, but they may include:

1. Self-doubt

2. Undervaluing contributions

3. Attributing success to external factors

4. Sabotaging self-success

5. Setting unrealistic expectations

6. Continuous fear of not living up to expectations

If you are facing impostor syndrome, try to focus on the positive things you achieve on a daily basis even if its not something big. If you are experiencing imposter syndrome, there are a few things you can do to cope:

1. Talk to someone you trust about how you are feeling.

2. Challenge your negative thoughts.

3. Focus on your strengths and accomplishments.

4. Set realistic goals.

5. Give yourself credit for your successes.

6. Seek professional help if needed.

Remember, you are not alone. Imposter syndrome is a common experience, and there are things you can do to cope.
Kotlin's Interoperability: Impact on Android Dev Choice?
Tags: discuss, kotlin
Published: 2023-07-30 07:00:00

How has Kotlin's interoperability with Java influenced your decision to adopt Kotlin in Android development or other projects?

Follow the DEVteam for more discussions and online camaraderie!

{% embed [https://dev.to/devteam](https://dev.to/devteam) %}
Why should you use Django?
Tags: django, python, webdev, coding
Published: 2023-07-30 06:00:24

Django is a powerful and popular web framework for building web applications in Python. There are several compelling reasons why you should consider using Django for your web development projects:

1. High-level and Batteries-included: Django follows the "batteries-included" philosophy, which means it comes with a lot of built-in functionalities and packages that make it easy to develop robust web applications without the need for external libraries. Features like authentication, database ORM (Object-Relational Mapping), admin panel, security mechanisms, and more are readily available.

2. Rapid Development: Django's design and built-in features enable developers to work quickly and efficiently. Its clean and pragmatic syntax allows you to focus on writing your application's logic rather than dealing with boilerplate code.

3. Scalability and Performance: Django is designed to handle high-traffic websites and can scale effectively. By using caching, database optimizations, and other techniques, you can build performant web applications even under heavy load.

4. Security: Django takes security seriously and comes with built-in protection against common web application vulnerabilities like CSRF (Cross-Site Request Forgery), XSS (Cross-Site Scripting), SQL injection, etc. When using Django's features properly, you can significantly reduce the risk of security breaches.

5. Community and Documentation: Django has a vast and active community, which means you can find plenty of tutorials, documentation, and third-party packages to extend the framework's capabilities.

6. Versatile and Flexible: Django can be used to build various types of web applications, from simple websites to complex, data-driven platforms. It provides the flexibility to adapt to different project requirements and scales well with growing applications.

7. Django REST framework: If you need to create APIs for your application, Django REST framework (DRF) is an excellent companion to Django. It allows you to build robust and standards-compliant APIs effortlessly.

8. Well-tested and Reliable: Django is a mature framework that has been around for many years. It is extensively tested, and numerous well-known companies and websites have been successfully built using Django.

9. Django's Admin Interface: The built-in admin interface is a significant advantage during development. It allows you to manage the data in your application without having to create a separate admin panel.

Overall, Django provides a productive and enjoyable development experience, and its popularity is a testament to its effectiveness in building web applications. If you are familiar with Python or looking for a feature-rich and secure web framework, Django is definitely worth considering.
Login/Signup
Tags: codepen
Published: 2023-07-30 06:50:39

<p>This CodePen showcases a login and signup page with smooth animated transitions. It includes CSS styles for a clean and visually appealing design, and JavaScript/jQuery for interactive login and signup buttons. Try clicking the "Log in" and "Sign up" buttons to see the animations!</p>

{% codepen https://codepen.io/Lakshanaapriyavijay/pen/vYQreWV %}
Convert your Existing React js App to Android App Using the Ionic Capacitor
Tags: android, react, ionic
Published: 2023-07-30 06:40:14

Today I will show the easiest and simple way I’ve found to convert your existing React js app to an android app using ionic capacitor.

What is Capacitor? According to documentation:

Capacitor is a cross-platform app runtime that makes it easy to build web apps that run natively on iOS, Android, Electron, and the web. We call these apps “Native Progressive Web Apps” and they represent the next evolution beyond Hybrid apps.

**Requirements:**

- Existing React App
- Ionic
- Android Studio

First, go to the root of your existing react app and create a file `capacitor.config.json` and inside that put the below code.

```
{
  "appId": "io.ionic.nameofyourapp",
  "appName": "nameofyourapp",
  "bundledWebRuntime": false,
  "npmClient": "npm",
  "webDir": "build",
  "cordova": {}
}
```
2. Now create another file name `ionic.config.json` and inside that insert the below code.

```
{
  "name": "nameofyourapp",
  "integrations": {
    "capacitor": {}
  },
  "type": "react"
}
```
Note: replace `nameofyourapp` in both files with the name of your app.

3. Now we need to build our react project. To build your react app open your terminal to the root of the project and run the below-mentioned command

```
npm run build
```
Note: this will create the build folder in your root project and the name of the folder should match the `webDir` name inside `capacitor.config.json` file.

4. Now we will install ionic globally in our machine. To install ionic globally in your machine open your terminal and run the below command.

```
npm install -g @ionic/cli
```
5. Now install the capacitor core in our project.

```
npm install @capacitor/core --save
```
6. Now install the capacitor CLI.

```
npm i -D @capacitor/cli
```
7. After that, we will first create an android app with our existing react app.

```
ionic capacitor add android
```
This will create the android folder in your root project and install all the required dependencies.

8. Now run the below command to launch your android project on Android Studio.

```
npx cap open android
```
Wait some time and then it will ask you to update the Gradle. Just update the Gradle to the latest version and run the project in the emulator. You can also connect your mobile to run the project live on your mobile phone.

9. Now open the build menu from the android studio and build your `apk` file.
Step-by-step guide on installing pgAmin from source code on windows and configuring it for development.
Published: 2023-07-30 06:34:54

**Introduction.**

pgAdmin is a management tool for PostgreSQL and EDB Postgres advanced server, in this blog post, You will install it from source code in your Windows machine. According to the official GitHub repo,

> pgAdmin 4 is written as a web application in Python, using jQuery and Bootstrap for the client side processing and UI. On the server side, Flask is being utilised.

**Pre-requisites.**

You need to install the tools below.
- [Python](www.python.org).
- [node.js](https://nodejs.org/en/download/).
- yarn through [this tutorial](https://learnbyexample.github.io/100_page_python_intro/command-line-arguments.html).


**Installation Guide.**

1. Create a directory in any terminal of choice, I will be using `gitbash` for this tutorial.

    ```
mkdir pgadmin && cd pgadmin
    ```
2. Clone the repository from GitHub by running the command below.

    ```
git clone https://github.com/pgadmin-org/pgadmin4.git

    ```
    This will successfully install it.

**Building the Runtime for the frontend.** 

1. To build the runtime for the frontend, enter into the directory **/pgadmin4/runtime**, create a new file called `dev_config.json` copy the contents of the file `dev_config.json.in` into this file. Inside the `dev_config.json `file, edit the python path to the actual path to the `python.exe` in your machine.

3. Run the command `yarn install`.

4. Execute the runtime by running this command.
    ```
node_modules/nw/nwjs/nw
    ```
    This will start the pgAdmin.

**Configuring the Python Environment for the Backend.**

1. To configure the python environment, from the `pgadmin` directory, create a virtual environment and activate this environment by running this command.
    
    ```
cd ..
python -m virtualenv penv # creates a virtual environment
    source penv/Scripts/activate #activates the virtual environment
    ```
2. Upgrade to the latest version of `pip` if you are not using one already, as `pgAdmin` requires the latest version via this command below.
    ```
pip install --upgrade pip
    ```
3. Add the part to your Postgres bin directory to your environment variables by running this command, this is necessary so `pg-config` can be found for building `psycopg3`.

    ```
export PATH="$PATH:/c/Program Files/PostgreSQL/15/bin"
    ```
    This path, is the path to the PostgreSQL 15 I installed via the Windows installer. You can replace 15 with any version that you have.


4. Install the dependencies by running this command.
    ```
pip install -r requirements.txt
    ```
5. Start the server by running the command below.
    ```
python pgAdmin.py
    ```

6. Finally, this `Starting pgAdmin 4. Please navigate to http://127.0.0.1:5050 in your browser.` will be seen on the terminal, which shows the server has started Happy coding.

**References**
https://github.com/pgadmin-org/pgadmin4
**Please do give me a like and a follow if you enjoyed this blogpost.**
C Language Mystery
Published: 2023-07-30 06:30:04

```hoge.c
int main() {
    printf("hello world\n");
    return 0;
}
```
When I run the above code, I get the following result. but the hello world result was output. Could you please tell me why?

```
hoge.c:2:5: error: call to undeclared library function 'printf' with type 'int (const char *, ...)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    printf("hello world\n");
    ^
hoge.c:2:5: note: include the header <stdio.h> or explicitly provide a declaration for 'printf'
1 error generated.
hello world
```