teleren/devto huggingface dataset:
The 16th Day of the 100 Days of Code challenge
Published: 2023-06-25 20:45:10

Hey everyone!

Today was a fun vacation day, but I still got 2 hours of coding in. I finally fixed a super small problem that was driving me crazy yesterday (honestly, super simple fix, I don't know if I should be ashamed). What I wanted to do was to emit audio chunks from my React app to my Flask API which uses SocketIO and I just couldn't do it. I'm using the React-Mic library to record the user and it generates blobs that are in webm format, and I was frustruating over converting them to WAV format so that I could create a WAV file with the audio data.

Little did I know, this wasn't too important since I could've easily converted the final blob and saved it as a WAV file in the API. I learned that I need to explore way more options, such as trying to do it in your API (which is where most things should happen) and minimize complexity in the front-end part.

Currently focusing on exploring approaches to real-time transcription, as this is what my project is about (real-time transcription with Whisper) and I'm wondering how I should approach this in terms of buffering, maintaining proper accuracy, latency and formatting.

This is something I'm approaching in a step-by-step manner, focusing on buffering first. I didn't even make a list before this, but I just made it now writing this. For me, this sort of things, even if nobody reads this, is my goal.

A big part of my project is the Whisper transcription library by OpenAI (which I love!). The possibilities are endless with such a library, and it's super fun to be able to witness its upbringing. Anyway, for those who don't know, there's a few models (enormous datasets on which its trained on) we can make use of. If I use the large one, execution times go beyond the 20-second mark. The tiny one optimized for English works great, but there's a lot of accuracy being sacrificed. I'm super curious and interested to learn about strategies that may even involve how I to approach executing the library's functions in quicker and more efficient ways.

I'm super early into my research process, so I'll be updating you (or myself) on how it goes.

That's it for today, happy coding everyone!
GO(Golang) and Big Data Solutions!
Tags: go, softwareengineering, programming, bigdata
Published: 2023-06-25 20:38:00

Hi Everyone,

Today I bring the possibility of using different data solutions for the most diverse contexts with the computational language GO.

To know more:

https://jlgjosue.medium.com/go-golang-and-big-data-solutions-64b910e51513

Thanks for reading; share this post! :)
How to fix: error: 'invalid path' When working with Git on Windows.
Tags: help, git, window
Published: 2023-06-25 20:32:28

I was trying to clone a repository from gitbucket client when I got this error on my PC

```
git -c filter.lfs.smudge= -c filter.lfs.required=false -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks clone --branch master https://JumboDaniel@bitbucket.org/fedacash-dev/fedhagap-web-ui.git C:\Users\hp\Documents\HTML\Jobs\Fedha
Cloning into 'C:\Users\hp\Documents\HTML\Jobs\Fedha\...
error: invalid path 'src/Assets/fonts/TTF/THICCCBOI-Black.ttf:Zone.Identifier'
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'
```
I tried working my way around the issues; I even tried deleting the 'THICCCBOI-Black.ttf' file from the gitbucket repo, but this didn't solve the issue.
After hours of searching through the internet, I found the cause of the error:
The Git cloning of a repository fails on Windows with an "invalid path" error because the Windows OS reserves some filenames; hence, a file name may be legal in Linux or Mac (in my case) but illegal in Windows.

**

## Solution:

**
Whilst this may workaround the issue, care should be taken as the default for a Windows client was set to core.protectNTFS=true to close a potential security issue CVE-2019-1353 as described here.

Depending on the filename, you can configure Git to ignore the NTFS naming may fix the issue.

`git config --global core.protectNTFS false
`
Turning off protectNTFS will stop Git from complaining about files that have a base name that is reserved but will not prevent an error if the filename is one of the reserved names.

The best solution is to:
1. Identify the offending file(s) mentioned in the error message, such as ('src/Assets/fonts/TTF/THICCCBOI-Black.ttf:Zone.Identifier') as in my case.
2. Rename the file(s) to something that does not conflict with any reserved names. For example, I can rename it to 'THICCCBOI-Black-Font.ttf'.
NB. Check windows file naming documentation [here](https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file)
3. Update the reference to the renamed file(s) in your code or configuration, if necessary.
4. Commit the changes to the repository.

Reference:[Link](https://confluence.atlassian.com/bitbucketserverkb/error-invalid-path-during-git-clone-to-windows-client-1085186345.html)
Reusable Header component for React Native
Tags: reactnative, tutorial, typescript
Published: 2023-06-25 20:07:03

Hola hola,

A Header should be consistent across your React Native application - both look and feel.

Therefore, it makes sense to have a reusable `<Header />` component to use throughout your applications.

We can create a Header easily with React Native and TypeScript.

Here's the component:

```
import React from 'react';
import { View, Text, TouchableOpacity } from 'react-native';
import { StyleSheet } from 'react-native';

type HeaderButton = {
  child: JSX.Element;
  onPress?: () => void;
};

type Props = {
  leftButton?: HeaderButton;
  rightButton?: HeaderButton;
};

export const Header = (props: Props) => {
  const {leftButton, rightButton} = props;

  return (
    <View style={styles.container}>
      <View style={styles.leftContainer}>
        {leftButton && (
          <TouchableOpacity onPress={leftButton.onPress}>
            {leftButton.child}
          </TouchableOpacity>
        )}
      </View>
      <View style={styles.middleContainer}>
        {/* Logo/Title/etc goes here */}
      </View>
      <View style={styles.rightContainer}>
        {rightButton && (
          <TouchableOpacity onPress={rightButton.onPress}>
            {rightButton.child}
          </TouchableOpacity>
        )}
      </View>
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flexDirection: 'row',
    alignItems: 'center',
    justifyContent: 'space-between',
    paddingVertical: 16,
    paddingHorizontal: 20,
    backgroundColor: 'white',
  },
  leftContainer: {
    flex: 1,
    alignItems: 'flex-start',
  },
  rightContainer: {
    flex: 1,
    alignItems: 'flex-end',
  },
  middleContainer: {
    flex: 1,
    alignItems: 'center',
  },
});
```

Here's an example of the `<Header />` component being used:

```
import React from 'react';
import { View, Text } from 'react-native';
import Header from './components/Header';

const App = () => {
  return (
    <View>
      <Header
        leftButton={{
          child: <Text>Back</Text>,
          onPress: () => {},
        }}
        rightButton={{
          child: <MenuSVG />,
          onPress: () => {},
        }}
      />
      <View>
        {/* Rest of your scren content goes here */}
      </View>
    </View>
  );
};

export default App;
```

We pass in the leftButton and rightButton props to customize the buttons inside the header. You can replace the child elements with your own custom icons or text and provide onPress event handlers to handle button clicks.

Feel free to experiment with different styles and configurations to make it suit your app's design as needed.

I've been working with React Native for the last 4 years and will continue documenting common React Native errors that we come across at TroutHouseTech.

-Matt
How to install eggdrop on vsp
Tags: irc, bot, ubuntu, eggdrop
Published: 2023-06-25 20:06:49

Eggdrop is the most advanced, most popular and best supported IRC bot. If you've never used a bot before, you'll find that Eggdrop provides a staggering range of channel management options and can easily be expanded further to provide even more features. The Eggdrop code is free to download and use by anyone. Some of Eggdrop's key features include:

 

``wget http://ftp.eggheads.org/pub/eggdrop/source/1.8/eggdrop-1.8.4.tar.gz

tar zxvf eggdrop-1.8.4.tar.gz

rm -rf eggdrop-1.8.4.tar.gz

cd eggdrop-1.8.4

./configure

make config

make

make install`
`
CD

cd eggdrop

`pico eggdrop.conf `(or use your favorite file editor eg nano)

 

If your setup doesn't work as it should and you see something like this:

Tcl cannot be found on this system.

Eggdrop requires Tcl to be compiled. If you already have Tcl installed on

this system, and I wasn't looking in the right place for it, re-run:

 

`./configure` using the -con-tcllib = '/path/to/libtcl.so' and

-with -tclinc = "/path/to/tcl.h" options.

`./configure –with-tclinc = / usr / include / tcl8.6 / tcl.h –with-tcllib = / usr / lib / x86_64-linux-gnu / libtcl8.6.so`

`gcc -v

make -v

make config

make`

More detailed for beginners click on: [install eggdrop beginner's guide.
](https://www.ircwebnet.com/eggdrop-irc-bot/)
Python Chronicles: Unveiling the Magic and Laughter of Data Science!
Tags: moringaschool, datascience, new, python
Published: 2023-06-25 19:29:55

Greetings, fellow adventurers! Get ready for a fun-filled and entertaining expedition through the fascinating world of Python and data science! As I journey through this unique course, Python has shown itself to be a playful jester, blending humor with important lessons.

Python, the mischievous trickster, presents itself as a magician's hat overflowing with powerful tools for manipulating data. With pandas, I discovered that organizing and analyzing data is like solving a giant puzzle. But beware of the notorious typos! A simple mistake can turn your code into a hilarious comedy of errors.

Enter NumPy, the eccentric wizard of arrays. It takes ordinary lists and transforms them into magical matrices, performing mind-bending mathematical tricks. And let's not forget matplotlib, the artistic sorceress! With her enchanting powers, I've turned dull data into vibrant visuals that rival the works of famous artists.

But wait! Python's greatest prank lies in its love affair with machine learning. Scikit-learn, the wizard's apprentice, offers a bag of tricks to build predictive models. From decision trees that grow like a forest to support vector machines that categorize like a flock of sheep, Python's machine learning tools are a riot of powerful resources.

Ah, but we can't forget the comedy of errors! Have you ever spent hours trying to fix a bug, only to discover it was caused by a simple indentation mistake? Python loves turning programmers into amateur detectives, deciphering cryptic error messages and hunting down elusive bugs.

But fear not, for Python's humor knows no bounds. It rewards your persistence with amusing surprises, like the Zen of Python—a lighthearted guide that reminds us there should be a straightforward way to do things. And who could resist the playful nods to Monty Python sprinkled throughout the language? A tribute to the comedic brilliance of the famous comedy troupe.

So, my fellow adventurers of data science, fasten your laughter belts and embark on this uproarious Python journey. May you find joy in unraveling the mysterious code, embracing the quirks, and unleashing your creativity with a touch of humor. Remember, laughter is the secret ingredient that makes the learning journey all the more enchanting!

Now, grab your keyboard—err, magic wand—and let's conjure some Python magic together. Who knows? Maybe we'll uncover a hidden recipe to turn code into a comedy masterpiece, all in the name of data science!
Postgres SQL for Dummies: Database Cluster, Databases, and Tables (Part 1)
Tags: database, apache, apacheage, postgres
Published: 2023-06-25 19:23:07

Hi there, I'm Sheroz and by profession I'm a Software Engineer who likes to explore complex engineering topics such as the internals of Postgres and likes to make them simpler to understand for myself and others too. In this series we'll try to explore the workings of Postgres on a simplistic level. The aim of this first in a series article would be to serve as a notes for understanding how Postgres works in order for making the most of it. 

There's 4 basic things we need to cover straight up:
1. The physical structure of Postgres
2. The logical structure of Postgres
3. Heap table structure and its use in Postgres

##1. The physical structure of Postgres
A PostgreSQL server runs on a single host and manages a single database cluster. A database itself is a collection of object each which can be referred by OIDs(Object IDs). These objects include: Indexes, Heap Tables, and so on. Each Table also has an OID. Cluster contains multiple databases. 

##2. The logical structure of Postgres
Logically Postgres can be thought of as a file structure wherein you have a base directory and sub directories. A table for instance is itself a sub directory under a base directory. Postgres also has the concept of tablespaces where you can have a 'space' exist outside of the base directory and it can contain its own sub directory structure. The files essentially tables and indexes can be identified by a *relfilenode* which may or may not be the same as the OID depending of whether the the file has been altered or not. Files also contains associated *free space maps* and *visibility maps*.

##3. Heap table structure in Postgres
Tables are stored as Heap Table Files divided into fixed pages(block) of fixed size, numbered sequentially and cane be assessed dynamically. The size also increases dynamically. Each block contains heap tuples (record data), line pointers (pointers to tuples), and other metadata. The data is read and written using this structure.
Singleton Design Pattern in TypeScript with Decorator
Tags: singleton, typescript, designpattern, programming
Published: 2023-06-25 19:14:42

In this article [Strategy Design Pattern in Java with Enum](https://dev.to/pablocavalcanteh/strategy-design-pattern-in-java-with-enum-nc7) I have said that Design Patterns could be implemented in different ways. Well, today I’m going to introduce a way to implement the Singleton Design Pattern, a simple Design Pattern, but very useful in the programming’s world.

First of all, what is this Design Pattern for? So, Singleton Design Pattern is meant to ensure that a class has only an instance and to provide an access global point for that same instance. That 's it.

Here is the Design Patterns’ generic structure.


![Singleton Class Diagram](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1tgo12avpqhdm6jyo1al.png)

**Participants**

- **Singleton class**

  - defines an Instance operation that allows the clients access to its unique instance.

  - Instance is a class operation.
may be responsible for creating your own single instance.

It's worth mentioning that Decorator is a design pattern too, but it isn't the focus of this article. However, it’ss understood that in TypeScript a Decorator is a special kind of declaration that can be attached to a class declaration, method, accessor, property, or parameter. Decorators use the form @expression (This’ how Singleton will be applied), where expression must evaluate to a function that will be called at runtime with information about the decorated declaration.

The following images show two different ways to implement this pattern using Decorators.


![Singleton Design Pattern in TypeScript with Decorator](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f7bglf5dtdzxaep3exg8.png)

As you can see, the TypeScript Generics feature has been used - common in other languages that support Object Orientation such as Java. It's worth knowing this resource, because it's very useful.


![Singleton Design Pattern in TypeScript with Decorator](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9zkjzb3fu86rehl1yyr0.png)

As I said in other articles, there are so many other Design Patterns and I think we must know about them. Well, that's it. See you guys! 👋👨‍💻
Streaming binary and base64 files
Tags: node, nestjs, streaming
Published: 2023-06-25 18:59:24

---
title: Streaming binary and base64 files
published: true
tags: ['node', 'nestjs', 'streaming']
canonical_url: https://sevic.dev/notes/streaming-files/
---

Streaming is useful when dealing with big files in web apps. Instead of loading the entire file into memory before sending it to the client, streaming allows you to send it in small chunks, improving memory efficiency and reducing response time.

The code snippet below shows streaming the binary CSV and base64-encoded PDF files with NestJS. Use the same approach for other types of files, like JSON files.

Set content type and filename headers so files are streamed and downloaded correctly. Base64 file is converted to a buffer and streamed afterward. Read files from a file system or by API calls.

```ts
import { Controller, Get, Param, Res } from '@nestjs/common';
import { Response } from 'express';
import { createReadStream } from 'fs';
import { readFile } from 'fs/promises';
import { join } from 'path';
import { Readable } from 'stream';

@Controller('templates')
export class TemplatesController {
  @Get('csv')
  getCsvTemplate(@Res() res: Response): void {
    const file = createReadStream(join(process.cwd(), 'template.csv'));

    res.set({
      'Content-Type': 'text/csv',
      'Content-Disposition': 'attachment; filename="template.csv"'
    });
    file.pipe(res);
  }

  @Get('pdf/:id')
  async getPdfTemplate(
    @Param('id') id: string,
    @Res() res: Response
  ): Promise<void> {
    const fileBase64 = await readFile(
      join(process.cwd(), 'template.pdf'),
      'base64'
    );
    // const fileBase64 = await apiCall();
    const fileBuffer = Buffer.from(fileBase64, 'base64');
    const fileStream = Readable.from(fileBuffer);

    res.set({
      'Content-Type': 'application/pdf',
      'Content-Disposition': `attachment; filename="template_${id}.pdf"`
    });
    fileStream.pipe(res);
  }
}
```

### Boilerplate

Here is the [link](https://sevic.dev/nestjs-starter?ref=devto-streaming) to the boilerplate I use for the development.
Hello World!
Published: 2023-06-25 11:28:47

---
canonical_url: https://miguelpimentel.do/hello-world/
---

This must be the fourth time I have started a blog. I haven't been very successful at being a consistent content producer. That changes today. I made a promise I can't break. I have made a real commitment to someone in my life who I rather not disappoint.

The past few years have been difficult for me. I am privileged enough to have access to the resources I do. It is a scary thought; wondering where I would be without therapy and all the other resources I'm able to use.

Since June 2022, I have been pushing myself to journal more often. Note-taking has changed the way I digest information. I've experienced the "productivity app rodeo". Jumping from productivity app to productivity app. Never settling, never producing content, just focused on the "workflow". I think I'm past that. It's time I sit down and type.

I can't go on without mentioning some inspiring people I have had the pleasure of coming across. When it comes to blogging and just being great overall, I highly recommend following the likes of:
- [Andy Bell](https://andy-bell.co.uk/)
- [Derek Sivers](https://sive.rs/)
- [Drew DeVault](https://drewdevault.com/)
- [Eric Bower](https://erock.prose.sh/)
- [Herman Martinus](https://herman.bearblog.dev/)

Hope you found reading this worthwhile. If you take anything from this post, let it be:

> “Better done than perfect.”

Take care, and I'll see you in the next post.
Part 1 of 3 TypeScript Tricks I wish I knew when I started learning TypeScript
Tags: typescript, javascript, react, angular
Published: 2023-06-25 18:57:40

#Trick 1:

I noticed the message 'unexpected any' when using eslint with TypeScript. It made me wonder why 'any' is considered bad. How should I declare a variable that can hold any possible value? Let's examine an example.

```
const someArray: Array<any> = [];

// add some values
someArray.push(1);
someArray.push("Hello");
someArray.push({ age: 42 });
someArray.push(null);
```

We're constructing an array capable of containing all possible types. Although it may not be the most optimal code, let's proceed with it. We're including a number, a string, and an object. Now, let's examine the following code and check its outcome.

```
const someArray: Array<any> = [];

// ... adding the values
someArray.forEach(entry => {
  console.log(entry.age);
})
```

This code is considered valid TypeScript and compiles successfully. However, it will encounter a runtime failure. The reason being, when we iterate over an entry that is `null `or `undefined`, and subsequently attempt to access the `.age` property, it will result in an error being thrown, as exemplified by the following message:

`Uncaught TypeError: Cannot read properties of null.
`

I think this is some kind of false security because you expect things to just work. After all the TS compiler told you the code is fine.

But we can fix this! And the change is actually super simple. Instead of typing the array as Array<any>we can just use Array<unknown> if we now use the same code but with that change it will look like this.

```
const someArray: Array<unknown> = [];

// ... adding the values

someArray.forEach(entry => {
  console.log(entry.age);
})
```

and this code will not compile! Instead, TypeScript shows the following error when we try to access `entry.age`

using `unknown` enforces us to check the type (or explicitly casting the value) before we do something with a value with is `unknown`. Let's look at an example:

```
// ... other code

type Human = { name: string, age: number };

someArray.forEach(entry => {
  // if it's an object, we know it's a Human
  if(typeof entry === 'object'){
    console.log((entry as Human).age);
  }
})
```

In this case we checked whether the value is an object and then access the .age property. And because this is such a abstract topic, here is a little wrap-up:

> `any` is basically saying the TypeScript compiler to not check that bit of code. Avoid using any whenever you can! It's better to use `unknown` instead because it enforces you to check the type of the value before using it or else it won't compile!

#For more interesting content visit below website
https://fullstackindepth.com/