teleren/devto huggingface dataset:
New Features with Git Remotes
Tags: opensource, python, beginners, git
Published: 2023-10-06 23:37:11

I decided to add a new feature to another open source project in the form of a TOML config functionality for a CLI app found [here](https://github.com/Pasqua101/txt-to-HTML-converter)

## How did coding the feature go?
After filing my [issue](https://github.com/Pasqua101/txt-to-HTML-converter/issues/18) I got to work. Adding such a functionality, especially in Python, was much easier than I had initially anticipated. I decided to use the [tomllib](https://docs.python.org/3/library/tomllib.html) library to help me parse TOML files instead of building a parser myself. However, because I was initially using Python 3.8.8, this meant that I had to upgrade my version to utilize the built-in version of tomllib in Python 3.11 or later. After updating everything I took a look at the codebase and eventually stumbled upon the perfect place to implement the functionality. The final solution to the issue was a very simple addition to what was already there. Simply checking for the `-c` or `--config` arg was enough to meet one requirement, which was to ignore all other args when this is used. After parsing everything, it could easily be sent through a function which would convert any text or md files to HTML files. The final implementation looked like this in the [PR](https://github.com/Pasqua101/txt-to-HTML-converter/pull/19):
```python 
    if(args.config):
        with open(args.config, "rb") as f:
            try:
                config = tomllib.load(f)
            except tomllib.TOMLDecodeError as e: # If the TOML file is not formatted correctly, it will exit the program
                print(f"Error decoding TOML file: {e}")
                exit(-1)
            try:
                stylesheet = config["stylesheet"] or "https://cdn.jsdelivr.net/npm/water.css@2/out/water.css"
                output_dir = config["output"] or "./til"
                lang = config["lang"] or "en-CA"
            except KeyError as e: # If any of the keys are not found in the TOML file, it will exit the program
                print(f"Error: {e} not found in TOML file.")
                exit(-1)
            text_to_html(input_path, stylesheet, output_dir, lang)
```

## How was it using Git?
It wasn't too bad considering I've worked within a structure like this previously on a major capstone project where each member of my team had their own branch/fork to work off of. It was really nice learning about draft PRs though, I've never used them previously but they seriously are the best. 

Someone ended up wanting to add the functionality to my repo, which was nice because it allowed me to have some experience testing remotes in order to make sure the functionality is up to spec, without committing everything to my repo. 

## What was learned?
I learned a lot more about the PR system as a whole, how useful remotes are, and how to easily test PRs through git remotes.
Day 827 : The Approach
Tags: hiphop, code, coding, lifelongdev
Published: 2023-10-06 22:37:31

_liner notes_:
- Professional : So, today was pretty chill. Just tying up some loose ends for the weekend. Got some clarity on some questions I posted yesterday so that I could finish up some code for a tutorial using a new Client SDK. Got that tutorial to a good place and took a look at some other ones. Got to focus all day to get some work done.

- Personal : Last night I put together what I would buy on Bandcamp so I could create the social media posts to post during lunch today. Finished that watched the new Loki episode. Pretty good.


![A dense forest in Garibaldi Lake, BC, Canada with a dirt path and sunlight shining through the trees.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0xv3nnrbftplwljkp5t9.jpg)

Right after work, I ate dinner and started putting together the radio show. Totally forgot to do this blog post. haha. I packed up some vinyl to send to a listener. Almost done prepping for the show. After that I want catch up on some anime and work on the front page of my new side project. I think I have an idea of want I want to do. Going to do a quick proof of concept to see if it's really the approach I want to take.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube -St2q7-ARI4 %}
Arrumando o erro dyld
Tags: php, programming, tutorial, macos
Published: 2023-10-06 22:07:28

Hoje pela manhã estava trabalhando em um projeto, e precisei confirmar a versão do PHP, e me deparei com o erro:

```
php -v
dyld[8614]: Library not loaded: /opt/homebrew/opt/libavif/lib/libavif.15.dylib
  Referenced from: <87C1A268-34E4-396F-8BBC-D5591064E333> /opt/homebrew/Cellar/gd/2.3.3_5/lib/libgd.3.dylib
  Reason: tried: '/opt/homebrew/opt/libavif/lib/libavif.15.dylib' ....
```

Tentei trocar de versão, ou até mesmo dando um `php -v ` ele gerava esse erro e investigando um pouco mais descobri que este erro ocorre devido à falta da biblioteca GD (Graphics Draw). Felizmente, a solução é simples:


## Passo 1 - Verifique se consegue ver a versão do PHP

```
php -v
```
> Nesta etapa, é provável que você encontre um erro semelhante a este:



![Error Command](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kvsxf1sqykmc896hyhjp.png)




![Error Command](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vsddy4wnvdjlfl74aiie.png)




## Passo 2 - Instalando o a biblioteca GD 
Provavelmente o passo anterior deu um erro, semelhante à imagem acima, para resolver esse problema basta instalar a biblioteca GD.

```
brew install gd
```

### Caso já tenha instalado use esse comando 

```
brew reinstall gd
```

## Passo 3 - Conferindo se deu tudo certo

```
php -v
```

![Success Command](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m7m7zz7wo2dc70c9ctjr.png)



Prontinho está funcionando
The modern way of checking radio groups
Tags: javascript, es6
Published: 2023-10-06 21:34:32

Checking radio groups in JavaScript has always been a bit tricky because you can only check if a particular radio button is selected, not the whole group at once.

```html
<input type="radio" name="fruits" id="banana" checked="checked" />Banana
<input type="radio" name="fruits" id="apple" />Apple
<input type="radio" name="fruits" id="cherry" />Cherry
```

Wow, that looks archaic. There must be a better way using the new ES6 features, and there is! As of ES2015, `NodeList` contains a `forEach` method(). This makes things much easier:

```js
var fruits = document.getElementsByName('fruits');
let selectedFruit = '';
fruits.forEach((fruit) => {
  if (fruit.checked) {
    selectedFruit = fruit.id;
  }
});
```
Still a lot of lines. We can make the code much tighter, but also much more unreadable:

```js
[…document.getElementsByName('fruits')].some(
  (fruit) => (let selectedFruit = fruit.id) && fruit.checked
);
```

This requires a bit of explanation, because in order to achieve it we have to dig deep into our bag of tricks.

First we convert the `NodeList` to an array using the spread operator to have all the funky `Array()` methods available.
The `Array()` method we use is `some()`. This method loops over an array until the callback function returns true. In our case we exit the loop by checking for “`fruit.checked`” which is true if the radio button is checked.

The second trick is to include the assignment of the loop variable fruit to the upper scope variable `selectedFruit`. This assignment always returns true, and therefore does not affect the result of the whole statement when it’s linked with `&&` operator to the other comparison.

BTW, we don’t need to declare an upper scope variable any more here because we don’t enter a new scope in the callback function. New scopes require curly braces which we don’t need here because the callback function only contains a single statement.
You can be picky and point our that `selectedFruit` is undeclared, but the code works nevertheless. So what?

**Conclusion**
We reduced the code from six lines to three and from 193 to 115 characters. Not bad and your code will look much cooler on GitHub!
Experienced Web Developer in NYC - Seeking Advice?
Tags: discuss, webdev, react, career
Published: 2023-10-06 21:25:20

Hello, I moved to NYC a few months ago, and I'm an experienced web developer. I've worked with technologies like Next.js, React.js, Vue.js, Typescript, and Node.js, and I've completed numerous professional and personal projects. Since relocating here, I've been actively applying for jobs on various platforms such as wellfound, workatstartup, and LinkedIn, but I haven't yet achieved the results I'm aiming for. My resume is ATS-friendly, my GitHub profile is quite active, and I have approximately 2-3 years of professional experience in the industry. Additionally, I have experience in product and business aspects, and I was even a co-founder at a SaaS start-up in the past. I'm genuinely curious about where I might be making a mistake.

Github= https://github.com/drokbers
C++ is not easy
Tags: programming, cpp
Published: 2023-10-06 21:04:08

To be honest, I was so focus on HACKTOBERFEST I forgot my labs, so for this lab I worked on [ctil](https://github.com/rjwignar/ctil/) and again I came to realize that C++ is not easy. it actually takes a while to implement or even install dependencies. In this lab I need to create a -c or --config flag in order to show the configuration file for TOML. The coding was straight forwards since we are passing file configuration but when it comes to actually installing the dependencies it  became harder that I expected 

Additionally, I added the -v or --version flag to the same project. Users may quickly check the programme version with the help of this flag,. Although it seemed straightforward, incorporating this feature required careful development and comprehensive testing to make sure it actually works

All I can say is if It was a choice between C++ or any languages in the world. i will choose Python, it's just the dependencies are all there and pretty much accessible. These past few weeks it seemed that testing and installing is becoming more difficult.

I really need to learn to test better .. this was a huge eye opener.
Building and Querying Knowledge Graphs With Apache Age
Tags: apacheage, database, graphdatabase, analytics
Published: 2023-10-06 21:00:00

This is a continuation to the introductory article on Building and Querying Knowledge graphs with Apache Age.As we concluded in the last article we learnt that we can be able to create complex knowledge graph on Apache AGE .in this article we will continue where we left from and discuss more about  semantic searches in Apache AGE and what it entails

**What are semantic searches in graphs?**
Semantic search refers to a search technique that aims to retrieve information from a graph database or knowledge graph based on the meaning or context of the query rather than just relying on exact matches of keywords. It involves understanding the relationships and connections between nodes (entities) in the graph to provide more accurate and relevant search results.

Practical examples of semantics searches in knowledge graphs include:

1. Traversing Relationships.
2. Pattern matching.
3. Discovering patterns.

Sample implementation of semantic searches in Apache AGE

**1.Traversing Relationships**
In traversing relationships we can traverse relationships in  graph queries to find related entities.

example traversing relationship in AGE can be:

```
SELECT * FROM cypher('purchases', $$
MATCH (:store {name: 'Platform'})-[r]->(products)
RETURN type(r)
$$) as (products agtype);

```
The following query is to be able to understand the relationship between A shoe store and the products they sell.

**2.Pattern Matching**
In pattern matching we can discover complex relationships by finding paths between entities involving multiple intermediate nodes 

example of pattern matching Apache AGE can be:

```
SELECT *
FROM cypher('purchases', $$
    MATCH (a {name: 'store'})-[r]->(brands)
    WHERE n.store = 'Platform'
    RETURN r
$$) as (r agtype);

```
The following query will find store that have relationship with various products and brands.

**Discovering patterns.**
Discovering patterns helps in identifying recurring patterns  in particular use case to help understand what are the best options from the use case.

sample example  in Apache AGE can be:

In case of a shoe store we can check which are the frequently most bought brand by customers in a particular and this can be done like so in Apache AGE:

```
SELECT *
FROM cypher('purchases', $$
    MATCH (n)
    WITH n.store as store, n.products as products
    ORDER BY n.brand, 
    RETURN name, brands
$$) as (name agtype, products agtype);


```

The following query will discover patterns of various properties and output results of brands that are most frequently sold by a particular store.


In conclusion to be able to represent complex relationships and facilitate semantic searches empowers us to navigate and understand in depth and intricate domains of information and help disseminate reliable information and insights that will be helpful for serious decision making
Parsing non-Latin based Twitch usernames in Kotlin
Tags: kotlin, mobile, android, tristan
Published: 2023-10-06 20:34:20

### Table of contents
1. [Introduction](#intro)
2. [The Problem](#prob)
3. [The Solution](#sol)


### The code
- [GitHub](https://github.com/thePlebDev/Clicker)

### My app on the Google play store
- [The app](https://play.google.com/store/apps/details?id=elliott.software.clicker)

### Introduction <a name="intro"></a>
- here is just a quick little reminder that if you are ever parsing usernames and or user based content, think if you can parse non-Latin based text

### The Problem <a name="prob"></a>
- Recently I have ran into an issue where the regex for my parsing code, simply does not work on non-Latin based alphabets. For example, if I wanted to parse the display-name from this string: `display-name=CoalTheTroll;emotes=;flags=;id=3ceab6bd-de3f-4d05-8038-5cebdb2af1c7; :tmi.twitch.tv USERNOTICE #cohhcarnage`
- The typical code would look like this:
```
fun userNoticeParsing(text: String):String{
  val displaynamePattern = "display-name=([a-zA-Z0-9_]+)".toRegex()
   val displayNameMatch = displayNamePattern.find(text)
   return displayNameMatch?.groupValues?.get(1)!!
    }

```
- The code above works. However, there is a problem when the display name is non-latin based. For example, a Mandarin display name will not be parsed. So a display-name of `不橋小結` will cause the code to crash

### The solution <a name="sol"></a>
- A simple solution (some might say lazy) is to not worry about ASCII character sets. With regex, we simply say, match all characters after display-name. The code would look like this:
```
fun userNoticeParsing(text: String):String{
        val displayNamePattern = "display-name=([^;]+)".toRegex()
        val displayNameMatch = displayNamePattern.find(text)
        return displayNameMatch?.groupValues?.get(1) ?: "username"
    }
```
- with the regex code above, `display-name=([^;]+)`, we are stating. Match display-name= and any characters that follow one or more times, stop matching once you find a `;`. The `()`brackets allow us to break the regex expression into groups allowing for a easier match and quick retrieval of what we actually want. Lasty we us the `?:` operator to say, if not match is found return "username"
- Now, even with character based display names, such as Mandarin our code will work:
```
val text ="display-name=不橋小結;emotes=;flags=;id=3ceab6bd-de3f-4d05-8038-5cebdb2af1c7; :tmi.twitch.tv USERNOTICE #cohhcarnage"

fun userNoticeParsing(text: String):String{
        val displayNamePattern = "display-name=([^;]+)".toRegex()
        val displayNameMatch = displayNamePattern.find(text)
        return displayNameMatch?.groupValues?.get(1) ?: "username"
    }
val expectedUsername = "不橋小結"
val actualUsername = userNoticeParsing(text)
expectedUsername == actualUsername 

```


### Conclusion
- Thank you for taking the time out of your day to read this blog post of mine. If you have any questions or concerns please comment below or reach out to me on [Twitter](https://twitter.com/AndroidTristan).
#6 Subgrid, Threads, Clouds Aren't Real, and Intl.Segmenter
Tags: podcast, subgrid, threads, segmenter
Published: 2023-10-06 20:06:33

---
title: #6 Subgrid, Threads, Clouds Aren't Real, and Intl.Segmenter
published: true
description: 
tags: podcast, subgrid, threads, segmenter
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-10-06 19:58 +0000
---
In today’s episode we take a look at css subgrid, why the BBC is leaving Threads, how there is no such thing as the cloud; it’s just someone else’s computer, and then we talk a little bit about the segmenter API.

[Substack](https://open.substack.com/pub/consolewarren/p/6-subgrid-threads-clouds-arent-real?r=jmepn&utm_campaign=post&utm_medium=web)
[Spotify](https://open.spotify.com/episode/405ucmDGtlexLzCcjAufbF?si=f6c9a7ccb67344b2)

**Show notes:**

[Subgrid](https://web.dev/css-subgrid/)

[BBC dropping Threads](https://darnell.day/bbc-gives-up-on-threads-by-instagram-sticks-with-mastodon)

[Clouds aren’t real](https://www.wired.com/story/the-cloud-is-a-prison-can-the-local-first-software-movement-set-us-free/)

[Segmenter API](https://polypane.app/blog/using-the-intl-segmenter-api/)

**Tech tweet of the week**

![funny tweet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cc1z113vnxd6peaps8f2.png)

**Non-tech**

[Motoball](https://www.youtube.com/watch?v=2uZwHVSGBbQ) - soccer on motorbikes in Europe. I watched a match live once and it was one of the wildest sports I’ve ever witnessed.
My First Pull Request in Hacktoberfest23
Tags: opensource, python, hacktoberfest23, hacktoberfest
Published: 2023-10-06 19:54:32

This is my first time to take part in the [Hacktoberfest](https://hacktoberfest.com/), and this week I finished my first [Hacktoberfest PR](https://github.com/mfranzon/mojo-is-awesome/pull/11) in open source.

First I use this [link](https://github.com/search?l=&o=desc&q=label%3Ahacktoberfest+state%3Aopen&s=updated&type=Issues) to search the issues, after a long time search, I found a pretty easy [one]( https://github.com/mfranzon/mojo-is-awesome/issues/1) as my first issue and asked if I could be assigned to this issue. The author assigned me very quick and told me "If you have any questions, leave a comment😁" which is a great encourage to my.

After I was assigned the issue, I stayed with my family during the weekend, but I found another guy created the PR and said "could you assign this issue to me?", I felted confused but created the PR as soon as possible on Monday. Luckily, the author merged both.

[Mojo]([https://www.modular.com/mojo) is a programming language for AI which combines the usability of Python with the performance of C, unlocking unparalleled programmability of AI hardware and extensibility of AI models. I found many cool videos on web which talk about the new features and updated them in my PR.

This is my first Hacktoberfest pr, I believe I can do a more harder one next time.
How to set dynamic logo in nextra based on theme mode.
Published: 2023-10-06 19:52:45

If you're using [nextra](https://nextra.site/) to setup your documentation pages and you want to set a different logo for each theme mode (dark & light). You can simply do it by getting the `resolvedTheme` from `useTheme` hook provided by `nextra-theme-docs` and use it to show a different logo conditionally in your logo jsx component inside `theme.config.tsx`

This is how your `theme.config.tsx` would look like:
```tsx
import React from "react";
import { DocsThemeConfig, useTheme } from "nextra-theme-docs";
import Image from "next/image";

const config: DocsThemeConfig = {
  logo: () => {
    const { resolvedTheme } = useTheme();
    return (
      <Image
        alt="My Logo"
        height={100}
        width={150}
        src={resolvedTheme === "dark" ? "path/to/white/logo" : "path/to/black/logo"}
      />
    );
  },

//... the rest of your nextra theme config
};

export default config;

```

That's it.
Hacktoberfest Pledge 2023
Tags: hacktoberfest23, hacktoberfest
Published: 2023-10-06 19:52:44

---
title: Hacktoberfest Pledge 2023
published: true
tags: hacktoberfest23, hacktoberfest
series: Hacktoberfest Journey
---
<!-- ✨This template is only meant to get your ideas going, so please feel free to write your own title, structure, and words! ✨ -->


### Intro
<!-- If you are new to the DEV community, introduce yourself and share a bit about why you joined DEV and your motivation to participate in Hacktoberfest this year. -->
Hi, I'm excited to do the 10th Hacktoberfest this year!


### Background
<!-- Are you brand new to Hacktoberfest? What about coding in general? Tell us about how you got here -->
I did the past two years of Hacktoberfest but have been doing mostly low code/no code contributions.


### Pledge
<!-- Share with us a bit about your goals during your Hacktoberfest journey this month. Are you a contributor looking to hone your skills or a maintainer looking for some help on a new project? Let us know!  -->
I think it's time for me to try tackling some issues that require more coding competencies. Let me know of any fun code bases to work on!
Discussion of the Week - v5
Tags: bestofdev, discuss
Published: 2023-10-06 19:32:28

In this weekly roundup, we highlight what we believe to be the most thoughtful, helpful, and/or interesting discussion over the past week! Though we are strong believers in healthy and respectful debate, we typically try to choose discussions that are positive in nature and avoid those that are overly contentious.

Any folks whose articles we feature here will be rewarded with our Discussion of the Week badge. ✨

![The Discussion of the Week badge. It includes a roll of thread inside a speech bubble. The thread is a reference to comment threads.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yvizv31dpchucxic2lxc.png)

Now that y'all understand the flow, let's go! 🏃💨

## The Discussion of the Week

For this week, I'd like to highlight Juanda's (@juandadev) post ["How I Got Fired From my Dream Job"](https://dev.to/juandadev/how-i-got-fired-from-my-dream-job-56hf):

{% embed https://dev.to/juandadev/how-i-got-fired-from-my-dream-job-56hf %}

In this candid and relatable post, Juanda recounts his recent experience of being laid off, walking us through the surrounding events and his reaction to it all. Despite the shock and disappointment that comes with losing his "dream job", Juanda's resilience and positivity really shine through in this post. He talks about the importance of continuously learning & honing skills, mentioning his own plans to start up **#30DaysOfCode** with Node.js.

But, one of the coolest things about this post is how awesome folks have been in the comments section! So many of you hopped in with words of wisdom, encouragement, and sympathy.

One of my favorite bits of advice comes from @donetmathew here:

{% embed https://dev.to/donetmathew/comment/29k28 %}

Also, gotta shout out @syxaxis for this kind and insightful response:

{% embed https://dev.to/syxaxis/comment/29kld %}

Head on over to the comments and just take a look through them for a bit. There is so much supportiveness and kindness here. Thank y'all for bringing the love! 💚

## What are your picks?

The DEV Community is particularly special because of the kind, thoughtful, helpful, and entertaining discussions happening between community members. As such, we want to encourage folks to participate in discussions and reward those who are initiating or taking part in conversations across the community. After all, a community is made possible by the people interacting inside it.

There are loads of great discussions floating about in this community. This is just the one we chose to highlight. 🙂

I urge you all to share your favorite discussion of the past week below in the comments. And if you're up for it, give the author an @mention — it'll probably make 'em feel good. 💚