teleren/devto huggingface dataset:
Mojo 🔥 — a new programming language, is this the Python killer?
Tags: mojo
Published: 2023-05-04 15:01:31

AI infrastructure company, Modular AI, recently unveiled [Mojo](https://www.modular.com/mojo), a new programming language for AI developers that combines the syntax of Python with the portability and speed of C, making it ideal for both research and production. The creators of Mojo claim that it is up to **35,000** times faster than Python and unlocks unparalleled programmability of AI hardware and extensibility of AI models.

Today the most basic of the computers are multi threaded but when Python was invented by Guido van Rossum in 1991 back then single-threaded computers were prevalent. Today despite advances in multi-threading technology, Python's Global Interpreter Lock (GIL) still restricts it to single-threaded execution by default. This might be the con in python that Mojo will be tackling.

**What Mojo Offers**

- Mojo has a high-level syntax and semantics that are comparable to Python. This makes it easy for developers who are familiar with Python to learn and use Mojo.

- Writing efficient, parallel code is made easier with Mojo's automatic parallelization feature. 

- Mojo also offers a _type inference_ and checking system that can catch compile-time errors and reduce the likelihood of runtime errors.

- Mojo is statically compiled, which means that it is compiled before execution. This results in faster execution times and better optimization of code.



Mojo aims to replace Python in AI model building by overcoming the limitations of Python in systems programming and offering the computational ability of C and C++. However, some are still skeptical about the performance improvement promised by the creators of Mojo.

Mojo is still in development, but it is available to try today in  [Mojo Playground](https://www.modular.com/get-started). By bringing superpowers to AI developers, Mojo aims to defragment AI software development and unlock Python performance.


**Conclusion**
While Mojo is an exciting new programming language for AI developers, it is still too early to determine if it will truly replace Python. It offers many promising features, such as high-level syntax, access to the Python ecosystem, and significant performance improvements. However, the programming language landscape is constantly evolving, and only time will tell if Mojo will become the new standard in AI development.

If you are a beginner to python or want to learn it from scratch, Checkout [this course](https://www.udemy.com/course/python-weekend-bootcamp/) which gets you the hang of python in just a weekend
Jedi Training Challenge
Tags: challenge
Published: 2023-05-04 15:00:00

Greetings, Jedi Padawans, fellow coders, and esteemed Jedi Knights. 

In the Star Wars universe, Jedi Knights are skilled in the use of the Force, a mystical energy that they can manipulate to achieve various abilities. In this coding challenge, we'll be simulating Jedi training by creating a program that generates a sequence of numbers and applies various transformations to them using...the power of code!

Instructions:

Write a program that generates a sequence of 10 random numbers between 1 and 10.
Use the Force (code) to apply the following transformations to the sequence:

1. Multiply every even number by 2
2. Add 5 to every odd number
3. Replace any number greater than 10 with 1
4. Print the final sequence to the console.

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



Hints:

- You can use the rand method in Ruby or the random module in Python to generate random numbers.
- You can use an if statement to check whether a number is even or odd.
- You can use a for loop to iterate over the sequence and apply the transformations.

The challenge begins. May the fourth be with you!
Python Worksheets in Snowsight
Tags: python, data, snowflakedatacloud, snowflake
Published: 2024-04-03 19:28:20

---
title: Python Worksheets in Snowsight
published: true
date: 2023-05-04 14:47:15 UTC
tags: python,data,snowflakedatacloud,snowflake
canonical_url: 
---

[![](https://cdn-images-1.medium.com/max/1508/1*_tpMcOjHsYJ-gVxn9qdTvA.png)](https://blog.infostrux.com/python-worksheets-in-snowsight-c6cdf1952f11?source=rss-fab031e08990------2)

Early Look at Snowflake Python Worksheets

[Continue reading on Infostrux Engineering Blog »](https://blog.infostrux.com/python-worksheets-in-snowsight-c6cdf1952f11?source=rss-fab031e08990------2)
Almithal - a comprehensive study buddy
Published: 2023-05-04 14:39:05

A study tool that can help you easily learn from videos, PDFs and lectures.

This is available right now through Hugging Face — [Almithal](https://huggingface.co/spaces/lordvader31/almithal)


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


## How do I use this ?

You have 3 options for a data source —
* YouTube Link — type in a YouTube video in the box and click 
* PDF — drop a PDF in the file 
* Audio — drop an MP3 or a WAV file in the audio box.

Then click ‘Start Analysis’. This will begin the process of generating notes.

In about 1–3 minutes, your video should be done. 💯

## CAVEATS

The transcription is a bit slow right now. The approximate formula for calculating how much time will be required is ~ 8% of the original video’s length.

    I am currently working on making it go much faster.
    I am adding more and more features and improving the quality of the existing transcriptions.
    This will be converted to an Obsidian extension soon. Stay tuned for it.

## What’s next ?

Please help support the project by suggesting any improvements through the Community board on Hugging Face.
Community Board for Almithal

![Community Board for Almithal](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i3v4oc8boj2cublhr63s.png)

Also stay tuned for the updates and the Obsidian extension release via [Twitter](https://twitter.com/lordvader_31).
The universal CSS * selector isn't actually universal
Tags: css, beginners, webdev
Published: 2023-05-04 14:38:54

I learned this week that for my ENTIRE professional career I have been living with an enormous misconception: the universal CSS selector doesn't *actually* select EVERYTHING.

___

Whenever I start a new web project, I begin by writing a very small "CSS reset", which uses [the universal selector (*)](https://developer.mozilla.org/en-US/docs/Web/CSS/Universal_selectors) to apply desired styles to every single element. My CSS reset usually looks something like this:

```css
* {
  box-sizing: border-box;
  margin: 0;
}
```

This little block of code sets all elements to use a box-sizing value I like best (see [my talk on the CSS box model](https://whitep4nth3r.com/talks/this-box-will-change-your-life/) for more information), and removes all default margins from everything — just because I like it that way. I haven't encountered any issues with this method, and you probably haven't and you probably won't — but here's a little nugget of knowledge that might save you hours of debugging in the future.

## The CSS universal selector doesn't apply to pseudo elements

First off, if you're unfamiliar with pseudo elements, read this post:

{% embed https://dev.to/whitep4nth3r/whats-the-difference-between-and-in-css-23p4 %}

Any properties declared using the CSS * selector don't apply to pseudo elements. In the case of my CSS reset, whilst you don't _need_ to remove margins from pseudo elements (because there is no margin set by default), if you wanted to do something bolder using the CSS universal selector, such as adding a red border to all elements and pseudo elements, you'll have to set the value explicitly on the element itself.

I'm not sure why you'd want to do this, but you _could_, right?

## But a pseudo element isn't a real element, obvs

Of course. You could also argue that a pseudo element isn't an actual element to be selected using the * selector, since it's not. It's a pseudo element; it's fake! This is _obviously_ **technically** correct. But I felt like writing about it anyway. Here's a demo on CodePen for you to mess with.

{% codepen https://codepen.io/whitep4nth3r/pen/qBJVzOG %}
Por que o React JS é uma tecnologia essencial para o desenvolvimento web moderno?
Tags: javascript, react, typescript, webdev
Published: 2023-05-04 14:30:55

O React JS se tornou uma das tecnologias mais populares para o desenvolvimento web moderno, sendo amplamente adotado por empresas de todos os tamanhos para criar aplicativos web complexos e escaláveis. Ele permite que os desenvolvedores criem interfaces de usuário altamente responsivas para aplicativos web, tornando a experiência do usuário mais agradável e interativa.

Algumas das empresas mais conhecidas que usam o React JS incluem Facebook, Instagram, Airbnb e Netflix. O Facebook, em particular, é o criador do React JS e continua a ser um dos principais contribuintes para o projeto de código aberto.

O React JS é uma tecnologia versátil que pode ser usada em diferentes tipos de aplicativos web, desde aplicativos de comércio eletrônico até aplicativos de gerenciamento de projetos e muito mais. Ele permite que os desenvolvedores criem interfaces de usuário altamente personalizáveis e escaláveis ​​com componentes reutilizáveis, o que economiza tempo e esforço.

Se você é um desenvolvedor que está procurando aprender ou aprimorar suas habilidades em React JS, existem muitos recursos disponíveis online, desde tutoriais em vídeo até documentação detalhada. Além disso, é uma boa ideia participar da comunidade React JS, seja por meio de fóruns online ou eventos presenciais. O compartilhamento de conhecimento e a colaboração com outros desenvolvedores podem ajudá-lo a aprimorar suas habilidades e mantê-lo atualizado com as últimas novidades da tecnologia.

No mundo em constante mudança do desenvolvimento web, é essencial permanecer atualizado e informado sobre as últimas tecnologias. O React JS é uma dessas tecnologias que vale a pena explorar para impulsionar sua carreira em desenvolvimento web. Com sua curva de aprendizado razoavelmente acessível e sua capacidade de criar interfaces de usuário expansivas e responsivas, o React JS pode ser um trunfo valioso para os desenvolvedores web que buscam melhorar suas habilidades e avançar em suas carreiras.
The more I hear from the experts, the more worried I get about AI
Tags: ai, chatgpt
Published: 2023-05-04 14:16:14

I watched a presentation over YouTube yesterday that got me pretty freaked about the potential issues that may arise with the creation of AI. 

You can check it out here:

{% embed https://www.youtube.com/watch?v=xoVJKj8lcNQ&ab_channel=CenterforHumaneTechnology %} 

A data point that they continuously return to is: 

> 50% of AI researchers believe there's a 10% or greater chance that humans go extinct from our inability to control AI

They site the [2022 Expert Survey on Progress in AI](https://aiimpacts.org/2022-expert-survey-on-progress-in-ai/) as the source for this info, specifically answers to the question:

> What probability do you put on human inability to control future advanced AI systems causing human extinction or similarly permanent and severe disempowerment of the human species?

When AI experts feel that there is a 1/10 chance of us going extinct from AI, it's cause for concern in my book.

I highly recommend checking out the video. They do a great job explaining how the field of AI has changed over the past 5 years and how/why it's progress is rapidly accelerating. They give specific examples of AI being used nefariously today and talk about the potential harm that may come. They also talk about how it can be so difficult to foresee these issues, comparing this point time to the advent of social media — how [we didn't realize that this tech would bring about new problems or amplify existing ones](https://youtu.be/xoVJKj8lcNQ?t=467), things like: information overload, addiction, doomscrolling, influencer culture, sexualization of kids, Qanon, and more. These things weren't the intended outcome, but they were very real effects that we're still contending with today.

I really hope that we take more time thinking about the negative effects that AI may cause before deploying these things into the world. We know that this is highly impactful tech with a lot of potential for good, but [if we move too fast and don't think about the potential consequences, we may end up with a whole slew of AI-driven issues that we're not prepared to contend with](https://youtu.be/xoVJKj8lcNQ?t=2589).
how to fix ifconfig: command not found in Linux
Tags: linux, beginners, tutorial
Published: 2023-05-04 14:03:41


When the “ifconfig: command not found” error appears in Linux, it typically means that the ifconfig binary is not installed or the path of the binary file is not under the $PATH.

So we can use the following 3 ways to fix this issue.

1. install ifconfig command through net-tools  package
2. run ifconfig command with full path
3. add the directory path of the ifconfig command to the $PATH

we dived into this issue and explored a few ways to fix the “[ifconfig command not found](https://www.howtouselinux.com/post/ifconfig-not-found-in-linux)” error.

reference:

The ifconfig command is a powerful tool used in Linux to check and configure network interfaces.

It can be used to check IP addresses, check connectivity, configure IP addresses, check packet network loss, and much more.

If you have any questions, please leave your comments. Thanks.
Conditional Rendering and Rendering List in React
Tags: react, frontend, webdev, javascript
Published: 2023-05-04 14:02:48

## Introduction
Sometimes we want to show a React component when a condition yields true. It is called **Conditional Rendering**. Also, rendering through a list of values to display a Component multiple times is very common in React. In this blog, we are discussing these two topics.

## Conditional Rendering in Action
In React, we can use any valid JavaScript code inside JSX. So, we can conditionally render a Component with these two operators in React:
1. Using Logical And Operator (&&).
1. Using Ternary Operator (?:).

### 1. Using Logical And Operator (&&):
**Logical And Operator** is used if you want to render a component only when a condition yields true. We can compare it with the if condition. But it can’t handle the else case. Below is a simple example of **Logical And Operator**:

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

const App = () => {
  const [isActive, setIsActive] = useState(true);
  return (
  	<div>
      <h1>Active User</h1>
      {
        isActive && <p>User is Active Now.....</p>
      }
    </div>
  )
}

export default App;
```
### 2. Using Ternary Operator (?:):
**Ternary Operator** is used if you want to render one component only when a condition yields true and another Component if yields false. Below is a simple example of a **Ternary Operator**:
```javascript
import { useState } from 'react';

const App = () => {
  const [isActive, setIsActive] = useState(true);
  return (
  	<div>
      <h1>Active User</h1>
      {
        isActive? 
          <p>User is Active Now.....</p> 
          :
          <p>User is Offline Now...</p>
      }
    </div>
  )
}

export default App;
```
## Rendering List
In React, we use the `map` function to render a list of components. We can loop through arrays or an array of objects with this method. Here we need to pass a `key` attribute for all the returned elements from the `map` function. This `key` should be a unique identifier. Below is an example of a Rendering List in React:
```javascript
const App = () => {
  const todos = [
    {
      id: 0,
      title: "Go to Gym",
    },
    {
      id: 1,
      title: "Make Tea",
    },
  ];

  return (
    <ul>
      {todos.map((todo) => (
        <li key={todo.id}>{todo.title}</li>
      ))}
    </ul>
  );
};

export default App;
```
## Why should indexes not be used as keys?
In React, we use the index of an element as a `key` attribute. But this is an anti-pattern. We shouldn’t do this. For elements, having `key` as an index, every time we add a new element or delete an existing element from the list, other element keys may change. This results re-rendering of the whole list. And we always need to avoid unnecessary re-renders in our front end. So, always use a unique id field as the `key`, not the index. 

## Summary
In this blog, We have discussed **Conditional Rendering**, **Logical And Operator**, **Ternary Operator**, **Rendering Lists** and **why should indexes not be used as keys**. Follow me to learn more about **React** and other **Frontend Development skills**.
Enhancing PostgreSQL Performance with SP-GiST
Tags: apacheage, agedb, postgres
Published: 2023-05-04 13:54:29

## Introduction
PostgreSQL is a powerful open-source relational database management system that provides many advanced features to developers. One of the features that make PostgreSQL stand out from other database systems is its support for custom index types. These index types allow developers to create indexes tailored to specific data types, leading to better query performance. In this article, we will explore SP-GiST, a custom index type that can significantly enhance the performance of PostgreSQL.

## What is SP-GiST?
SP-GiST stands for Space-Partitioned Generalized Search Tree. It is a custom index type that can efficiently handle complex data types, such as geometric shapes, network addresses, and full-text documents. SP-GiST is a generalization of the GiST (Generalized Search Tree) index type, which is a popular custom index type in PostgreSQL.

## How SP-GiST works
SP-GiST is based on the concept of space partitioning. It divides the search space into non-overlapping regions and assigns each region a label. These labels are then used to traverse the search tree efficiently. SP-GiST also uses a split algorithm that ensures that each partition is split optimally to minimize the search time. The split algorithm takes into account the distribution of data and the size of the partitions.

## Benefits of using SP-GiST
There are several benefits to using SP-GiST over other index types. Firstly, SP-GiST can handle complex data types, which makes it suitable for a wide range of applications. Secondly, SP-GiST is highly customizable, allowing developers to fine-tune it to their specific needs. Finally, SP-GiST is more efficient than other index types when dealing with high-dimensional data.

## Use cases for SP-GiST
SP-GiST is particularly useful for applications that deal with complex data types. Some examples of such applications include:

Geographic information systems (GIS) that deal with spatial data
Full-text search engines that deal with text documents
Network management systems that deal with IP addresses and network topologies
Image and video processing applications that deal with multimedia data

## Conclusion
SP-GiST is a powerful custom index type that can significantly enhance the performance of PostgreSQL when dealing with complex data types. Its space partitioning approach and split algorithm make it efficient and highly customizable. Developers can use SP-GiST to fine-tune their PostgreSQL databases for optimal performance in a wide range of applications.
30 Days of Rust - Day 11
Tags: rust, learning, beginners
Published: 2023-05-04 13:43:57

Hi folks, today's blog will be short as I have have a game of Padel planned this evening as well as walk through Berlin's Mauerpark to see the Sakura trees 🎾 🌸

## Yesterday's questions answered
- What does the `?` operator do?
- Why would I use the `to_owner` method?

## Today's open questions
- I was able to set up the debugger following the [vs code docs](https://code.visualstudio.com/docs/languages/rust). But I don't seem to get any useful output from the terminal. I'll have to investigate this further
- Like a language learner too nervous to speak due to fear of making mistakes, perhaps I don't want to write Rust code because I know deep down that it will be *bad* Rust code. That shouldn't be a reason not to do my own project. In fact, what would make sense would be to compare my own design to those show in tutorials and see where I can improve. 
- On the one hand, tutorials are a fun way to write code and feel good about it. On the other hand, in outsourcing system design to the tutorial righter, you're not going to be making design decisions. Getting used to doing this in Rust will be important for my development, so I'll continue with my own project regardless of how long it takes me.
- In your rustdoc strings, you may want to include a code example. `doctest` will [test these code snippets](https://doc.rust-lang.org/rustdoc/write-documentation/documentation-tests.html) to ensure your examples are up-to-date.
- Return types for unit tests enable you to test using the `?` operator. What exactly this does I am not sure, but it looks similar to JavaScript's conditional chain operator.
- As with an `if` statement, you can assign the result of a `match` statement to a variable.

## Adding the timing component
This morning I added a rudimentary generic timer function. This introduced the `SystemTime` module from the `time`  crate. Creating a delta is easy and the `Duration` struct provides a bunch of helpful methods to get a duration in different time formats.

## What's next?
Now that we have a simple way to run tests, I need to start thinking about the CLI module. The CLI will serve not only as a possible entry point into the program. It will also help me understand what kind of data interface I'll need to get back from my timer and subprocess functions. Right now I'm really struggling to visualise how these will be used upstream. 

Similarly, within the scope of a function, questions of ownership don't seem particularly relevant. But as soon as you have functions interacting with other functions via some higher level function, or perhaps structs, then who owns what and when can become tricky.

## Scope and ownership
Having battled with the compiler to get very simple functions to work, I realise that scope and ownership are concepts that are still very vague to me. In the next few days, I'll take time to read up on those areas in the rust book.