teleren/devto huggingface dataset:
Drupal: OpenAI Module
Tags: drupal, beginners
Published: 2024-01-03 22:58:48

AI, or more specifically large language models (LMMs) are all the rage these days, so it shouldn't come as too much of a surprise that there is now [a Drupal module that integrates OpenAI](https://www.drupal.org/project/openai).

It is only an alpha release but includes several submodules to leverage OpenAI tools within a Drupal site in various ways:

- Generate content for you in any content type
- Speech to text
- Interaction with the ChatGPT prompt endpoint
- A button in CKEditor to send a prompt to OpenAI and get text back
- Assistance in the content editing process, such as adjusting your tone and summarizing body text
- Analyzes logs to summarize likely problems

I haven't given it a try yet, mainly because I do not have a paid OpenAI API key and I assume I cannot use this without one, but it definitely could be worthwhile in certain Drupal site contexts.
How To Change Default Python On A Linux Machine
Tags: python, linux, bash, tutorial
Published: 2024-01-03 22:57:42

Let's say you have installed Python into the following folder

`/home/ubuntu/Python-3.10.13`

To set it default python version open a terminal

Execute the following commands

`echo 'export PATH="/home/ubuntu/Python-3.10.13:$PATH"' >> ~/.bashrc`

`source ~/.bashrc`

Then with the following command you should see 3.10.13 as default

`python --version`

This above will make it only temporarily for that terminal session

Execute below ones for permanent on all terminals

```
echo 'export PATH=/home/ubuntu/Python-3.10.13:$PATH' >> ~/.bash_profile
echo 'export PATH=/home/ubuntu/Python-3.10.13:$PATH' >> ~/.profile
echo 'export PATH=/home/ubuntu/Python-3.10.13:$PATH' | sudo tee -a /etc/environment
echo 'export PATH=/home/ubuntu/Python-3.10.13:$PATH' | sudo tee -a /etc/profile.d/custom.sh
```



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8f9e6n2g1pbndeunj5ld.png)
Drupal: Include Default View in Module
Tags: drupal, php
Published: 2024-01-03 22:54:42

You may be working on a Drupal module and want to include a default view.

## Install

This is actually quite simple: put the configuration file in the config/install folder within the module, with the proper configuration name, and it will install.

This would be the full configuration file, the same as you would generate using the configuration sync tools.
You can write this file from scratch, especially if they're hidden options. If it is something that has a user interface, you can do what I tend to do: determine all your preferred settings and test it out within the interface, then export the configuration from either the UI (/admin/config/development/configuration/single/export) or drush (`drush config-export` but that does all configuration, not only the specific one you want).

## Uninstall

What about uninstalling the configuration you've installed with the module? This will depend on the context of your module, but you may want to also uninstall this configuration when the module is uninstalled. The configuration might no longer make sense without the module, or you might create conflicts if you installed it once, uninstalled the module but left the configuration, then tried to install it again.

To do that, add a few lines like this to the uninstall hook of the .module file, for example with a config file named webform.webform.event_registration:

```php
/**
 * Implements hook_uninstall
 * */
function module_name_uninstall() {
  if (!empty(\Drupal::configFactory()->getEditable('webform.webform.event_registration'))) {
    \Drupal::configFactory()->getEditable('webform.webform.event_registration')->delete();
  }
}
```
Choosing Ionic for Your Mobile App: A Developer’s Take
Published: 2024-01-03 22:42:47

Hey there! As someone who has experience with Ionic, I wanted to share why I think it’s a better choice for mobile app development compared to React Native and other frameworks. Let’s keep it simple and dive into why I prefer Ionic.

## **1**. Easy to Use and Familiar:
If you’ve worked with Angular, React, or Vue before, jumping into Ionic is a breeze. It keeps things familiar, and although there’s a bit of a learning curve with Ionic’s own life cycle methods, it’s nothing major. Plus, you get to stick with the skills you already have.

## **2. Development Speed:**
The speed at which you can build stuff on Ionic is impressive. In my experience, it’s 2–3 times faster than using React Native. With Ionic, you don’t need to spend ages on basic setups because it comes with default settings that just work. Unlike my friend using React Native, I’ve found Ionic to be less dependent on specific platform details, making development smoother.

## **3. Application Speed:**
Some say there’s a speed difference between Ionic and React Native, but honestly, as a regular user and developer, I can’t really notice it. Both perform well, and any tiny speed advantages React Native might have are usually only visible in tests, not in everyday use.

## **4. Development Cost:**
Saving money is always a win, right? Ionic makes that happen. Faster development means spending less. Also, because you can get developers familiar with Vue, React, or Angular quite easily, you save even more. And here’s a bonus — you can work on a web app at the same time. Double win!

## **Challenges:**
No tech is perfect, and with Ionic, the main hiccup I faced was with styling. They use something called shadow DOM, which made styling a bit tricky at first. But don’t worry, they’re working on making it friendlier for us, and it’s getting better.

## **Conclusion:**
Even though big companies push their own tech (looking at you, React Native and Flutter), I’m sticking with Ionic. It just makes things easier for developers like me and makes good business sense. Sure, it’s not flawless, but the combo of ease, speed, performance, and cost-effectiveness makes Ionic my go-to for mobile app projects.
Introduction to React and How to Start a Project
Tags: programming, javascript, react, beginners
Published: 2024-01-03 22:41:37

## What is React?
React is a JavaScript library developed by Facebook for building user interfaces. It stands out for its focus on reusable components, making it easier to develop interactive and efficient web applications.

## Key Concepts
1. **Components**: The basic building blocks of React applications, allowing you to divide the UI into independent, reusable parts.
2. **JSX**: A JavaScript extension that makes it easy to write UI structures in code, similar to HTML.
3. **State**: An object that manages dynamic information in components, updating in response to events.
4. **Props**: Arguments passed to components for customization and dynamism.
5. **Virtual DOM**: A simplified representation of the DOM, enabling React to optimize UI updates.

## Starting a Project with React
1. **Installation**: Install Node.js, then use `create-react-app` to set up a new React project.
2. **Project Creation**: Run `npx create-react-app your-project` to generate a base structure.
3. **Development**: Work on `App.js` to create your initial UI.
4. **Execution**: Use `npm start` to launch a development server and view your project in a browser.

React is ideal for developing complex and reactive user interfaces. Its component-based system, along with an active community and extensive resources, make it an excellent starting point for web developers.
Math in computer science: Binary
Tags: learning, computerscience
Published: 2024-01-03 18:14:59

Binary is fundamental in the study of computer science and is the basis for all digital computing. It is the system that computer use to represent data in which each digit can only have one of two possible digits: 1 or 0. 

One reason that computers use binary is because of the fact that transistors are used in commuter processors, and these can have two states, ON or OFF. So the 1 in binary is for ON and the 0 is for OFF, but what does binary actually represent and how do 1 and 0's become what we see on our screens.

## How binary works

A binary number is a series of 8 binary digits (bits), and these are called bytes. These are what are used for the computer to process and hold data. In a byte the bit position is the power of 2 that that position represents. This means that the 5th bit will represent either a decimal value of0 if the binary is 0, or a decimal value of 2^5 if the binary value is 1. Like this you can represent 256 numbers from just one byte.

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

## What makes binary different to decimal

Binary is a Base-2 system, meaning that each bit can only take two values. On the other hand the decimal system, which is the one we use in daily life uses a base-10 system, so each digit can take 10 different values, ranging from 0 to 9. 

## How is binary used

Different decimal numbers are used to represent different things in our computers, such as numbers, letters and even color's. So for example the ASCII decimal value for the letter "A" is 65, and so when we type "A", we actually give the processor the byte 01000001, and it then converts this into the letter "A", and we see it on our screen. This is the same for numbers and color's.

I hope you now see how fundamental binary is and how is allows our computers to display and store multitudes of data.
Introducción a React y Cómo Iniciar un Proyecto
Tags: programming, javascript, react, spanish
Published: 2024-01-03 22:36:06

## ¿Qué es React?
React es una biblioteca de JavaScript, creada por Facebook, para construir interfaces de usuario. Se destaca por su enfoque en componentes reutilizables, lo que facilita el desarrollo de aplicaciones web interactivas y eficientes.

## Conceptos Claves

1. **Componentes**: Bloques básicos de las aplicaciones React, permiten dividir la UI en partes independientes y reutilizables.
2. **JSX**: Extensión de JavaScript que facilita escribir estructuras de UI en código, similar a HTML.
3. **Estado (State)**: Objeto que gestiona la información dinámica de los componentes, actualizándose en respuesta a eventos.
4. **Props**: Argumentos pasados a los componentes para personalizarlos y hacerlos dinámicos.
5. **Virtual DOM**: Representación simplificada del DOM, permite a React optimizar las actualizaciones de la UI.

## Iniciar un Proyecto con React

1. **Instalación**: Instala Node.js y luego usa `create-react-app` para configurar un nuevo proyecto de React.
2. **Creación del Proyecto**: Ejecuta `npx create-react-app tu-proyecto` para generar una estructura base.
3. **Desarrollo**: Trabaja en `App.js` para crear tu UI inicial.
4. **Ejecución**: Usa `npm start` para lanzar un servidor de desarrollo y ver tu proyecto en un navegador.

React es ideal para desarrollar interfaces de usuario complejas y reactivas. Su sistema basado en componentes, junto con una comunidad activa y recursos extensos, lo hacen un punto de partida excelente para desarrolladores web.
Unleash the Power of JSON Schemas with docusaurus-json-schema-plugin
Tags: javascript, react, opensource, documentation
Published: 2024-01-03 22:33:12

## Introduction

In the dynamic world of data-driven development, JSON Schemas have emerged as indispensable tools for defining and validating structured data. Whether you're crafting APIs, designing data formats, or creating comprehensive documentation, JSON Schemas play a pivotal role in ensuring data consistency, compatibility, and interoperability across systems.

However, showcasing and exploring JSON Schemas can be a daunting task, often involving manual formatting and error-prone explanations. This is where docusaurus-json-schema-plugin steps in, transforming your documentation into a visual representation for interactive schema exploration.

## Key Features

- Human-friendly exploration : Delve into the intricacies of each data type such as minimum and maximum values, allowed formats, and pattern matches ...

- Compatibility : It works seamlessly with JSON Schema Draft-07, Draft 2019–09, and Draft 2020–12.

- Swizzling : Customize behavior beyond the original implementation. This enables you to tailor the plugin to match your unique documentation style and preferences, creating a truly personalized schema exploration experience.

## Tell me more

Visit the comprehensive documentation with example and interactive playground to learn more about it : https://jy95.github.io/docusaurus-json-schema-plugin/
🎙️Future of the Internet, Technology, and AI.
Tags: softwaredevelopment, ai, career
Published: 2024-01-03 21:59:52

I was watching the Lex Fridman Podcast with Marc Andreessen: Future of the Internet, Technology, and AI.

They discussed several topics, and the interesting point in the discussion was that Andreessen was optimistic about the future of AI, but he also acknowledged the risks. He believes that AI has the potential to solve some of the world's biggest problems, but it is important to use AI responsibly and ethically.

Here are some of the key points from the podcast:
• AI has the potential to solve some of the world's biggest problems, such as climate change, poverty, and disease.
• Large language models (LLMs) are powerful tools that can be used to generate text, translate languages, and answer questions. However, they are also prone to errors and biases.
• The future of search engines will be shaped by AI. LLMs will be able to understand natural language queries and return more relevant results.

Overall, the podcast was really interesting and it provides a thoughtful and thought-provoking discussion of the future of the internet, technology, and AI.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wx0tcpmpq9ow95gdihj8.jpeg)
Let's learn typescript: 001 - The basics
Tags: typescript, learning, webdev, tutorial
Published: 2024-01-03 21:43:39

### Why bother?

Typescript provides static type checking. What this means is that it's capable of predicting the errors based on the data type before running the code. 

Even if the code appears to be valid javascript, typescript would decide to throw some error if it makes no sense or has a lack of constraints. For example, the famous value assignment to a property that doesn’t exist on a given object. 

```tsx
const item = { 
	id: 123,
	name: 'toaster'
}

item.price = 15; 
```

> Error: Property 'price' does not exist on type '{ id: number; name: string; }'.


Also, typescript is useful to catch other unhandled bugs by javascript, like typos, uncalled functions, or even basic logic errors, like unreachable code. See the example below.

```tsx
const value:string = Math.random() < 0.5 ? "yes" : "no";
if (value !== "yes") {
  // ...
} else if (value === "no") {
  // Oops, unreachable
}
```

> Error: This comparison appears to be unintentional because the types '"yes"' and '"no"' have no overlap.
> 

Typescript also will enable some very useful tooling, like code completion on the IDE.

### The compiler

Typescript comes with a compiler to transform the useful, understandable, human-coherent type-safe code, into...well, plain javascript. To do this first install the compiler.

```tsx
npm install -g typescript
```

And just type tsc filename.ts.The compiler by default will transform it to ES3 (extremely old javascript), but we could change this by passing the flag:  — target es2015. You should see a new file with the same name but with a .js extension in your working directory. This is the output of the compiler.

In the next chapters, we will go through the core concepts and other “fun” kinds of stuff.
Unreasonable Requirements for Audio Producer Jobs (Yes, Even At Tech Companies)
Tags: hiring, jobs, podcast, career
Published: 2024-01-03 21:17:02

Hi all,

Is it just me, or is the proliferation of job postings requiring audio producers to also be video producers a bit disappointing to say the least?

I remember a little less than a decade ago when people in the industry were upset when so many jobs started requiring audio producers to also be audio editors or "preditors." And throughout my career I have now become proficient in most aspects of audio production (producing, scriptwriting, audio editing, sound design, and mixing) to keep up with the "needs" of the industry.

I didn't necessarily agree with the direction the audio industry went, requiring all of us to become audio Swiss Army Knives to make a decent living. But, I am at least happy to now have a well rounded skill set in the medium of audio.

**However, I find these new job postings requiring audio producers (now all required to be 'preditors,' mind you) to also be skilled in the whole other medium of video to be excessive.**

I also got my graduate degree from the Craig Newmark Graduate School of Journalism, a multimedia program which teaches each of its students the fundamentals of audio, video, print, and photo; so, I am well capable of doing both audio and video producing.

**But, having an employee capable of producing in multiple mediums should be a bonus (a well compensated one), not a requirement.**

It wasn't so long ago when audio producers weren't required to be an army of one, and if a podcast had a video component, that was handled by separate video producers. We don't have to live in this new exploitative future where the audio industry is headed. Companies will constantly demand more and more, making you do the job of multiple people to cut costs. The least we can do is collectively try and push back against them trying to force us do the jobs of multiple people now in different mediums.

Remember, just because something _is_ doesn't mean it _ought_ to be.

If you are at a company doing this, please stand up for your fellow future employees. If you see something, say something.

I am interested in hearing your thoughts.

All the best,
Levi
Exponential Elegance: Rounding Numbers in JS
Tags: javascript, number
Published: 2024-01-03 20:33:39

As you may be aware, JavaScript and numbers have unique properties that developers originating from other programming languages should be aware of. You can observe this for yourself: just sum `0.1 + 0.2`, and you will see what I mean.

Another common scenario is when developers explicitly define numbers as `const rate = 2.0`. This was common in Java to avoid integer divisions. In JavaScript, you can still definitely use this convention for readability, but it's not required at all given that all numbers are decimals already.

The point of this post is to introduce another particularity of numbers in JS that may not be well-known, which is the use of the exponential operator.

Let's say you are tasked with implementing a rounding function in JS. As you know, `Math.round` does not provide precision. So a common pattern is, let's say we want a rounding of 2, we could do:

- `Math.round(1000.230499 * 100)` which rounds to `100023`
- Then you divide it by `100` and you get `1000.23`

You could easily come up with a generic algorithm that mimics this. But what if I told you that function only takes 5 seconds to write?

- `Number('1000.230499e2') = 100023.0499`
- `Number(100023.0499 + 'e-2') = 1000.230499`

So a simple rounding function could be:

```js
export const round = (value: number, decimals = 2) => {
  return Number(Math.round(Number(`${value}e${decimals}`)) + `e-${decimals}`);
};
```

I thought I would share this as it's quite a powerful way to play around with the "comma" in decimals without having to deal with divisions.

Even though AI will do this for you these days, it's always good to know the basics. 👊

[#stayhard] [#keephacking]
API-FIRST APPROACH
Tags: postman, webdev, api, programming
Published: 2024-01-03 20:07:56

The whole concept of **API first approach** stands at the pinnacle of Postman as an organization. It's engraved in the postman student expert course and subsequently the postman student leader program. Both of which i had the chance to be part of.

This methodology, which prioritizes **the design and development of APIs** at the beginning of a project, underscores the importance of APIs in today's digital ecosystem.It is more than just a strategy; it's a mindset that places the design and development of APIs at the forefront of project planning. This paradigm shift acknowledges the critical role that APIs play in the interconnected mesh of today's digital ecosystem, where seamless integration and communication between services are paramount.

Recently, Postman released a game called "**API-First Journey**," designed to further educate and engage users in the API-first world. While I haven't had the opportunity to play this game personally – as it's currently available only on iPad and iPhone – its concept fascinates me.
Check out the game:[](https://lnkd.in/eAgkJEPd)
Migrating from Eclipse to VS Code? Master These Java Developer Shortcuts
Tags: java, vscode, productivity, development
Published: 2024-01-03 19:44:46

In my last post, I explained why switching from Eclipse to VS Code can boost your Java development productivity and provided step by step guide to modernizing the Java development environment using VS Code and WSL2.

I’ve been thrilled with the positive feedback, especially how you’ve reported increased efficiency and not facing memory issues! However, some of you, Eclipse veterans, asked about how to use Eclipse shortcuts in VS Code.

While an Eclipse key binding plugin exists, it won’t truly unlock the full potential of VS Code’s native shortcuts. These shortcuts are specially designed to enhance your coding speed, and mastering them will offer long-term benefits, including portability to your colleagues’ IDEs.

Based on my experience, I’ve compiled a list of essential Java shortcuts in Eclipse and their equivalent VS Code counterparts. Read the full article to get the full list of shortcuts here:[Migrating from Eclipse to VS Code? Master These Java Developer Shortcuts](https://medium.com/@pravinpreneur/migrating-from-eclipse-to-vs-code-master-these-java-developer-shortcuts-f1f220f98f68)