teleren/devto huggingface dataset:
Always Add Argument Names - C#
Tags: csharp
Published: 2023-07-06 12:47:55

---
title: Always Add Argument Names - C#
published: true
date: 2023-04-18 00:00:00 UTC
tags: 
canonical_url: https://timwise.co.uk/2023/04/18/always-add-argument-names/
---

An argument (lol) for the use of explicit argument names in C# function calls even when they seem redundant.

1. You can assert correctness when reviewing the call site in a dumb text display (e.g. a patch in a github pull request)
2. Parameter-order refactoring won’t introduce subtle bugs and breaking changes.

This is particularly important when you have multiple arguments of the same type.

It’s also a good idea when the call doesn’t immediately make it obvious what the meaning of the parameter is. E.g. `Foo(3)` vs `Foo(sizeInMeters: 3)`.

## No argument names (bad)

Starting point:

```
void Main()
{
	Foo("Home", "Blah"); // don't do this
}

void Foo(string importantThing, string otherThing)
{
	switch (importantThing)
	{
		case "Home":
			DoSomething();
			break;
		default:
			DoSomethingElse();
			break;
	}
	Log(otherThing);
}

```

If `Foo()` is defined in a different file it’s hard to eyeball `Main()` and tell if the arguments line up properly.

If I now re-order the arguments of `Foo()` can you easily spot that the call site in `Main()` is now incorrect?

```
void Main()
{
	Foo("Home", "Blah"); // Now broken!! But can you tell?
}

void Foo(string otherThing, string importantThing) // <-- parameters flipped
{
	switch (importantThing)
	{
		case "Home":
			DoSomething();
			break;
		default:
			DoSomethingElse();
			break;
	}
	Log(otherThing);
}

```

## With argument names (good)

Starting point:

```
void Main()
{
	Foo(importantThing: "Home", otherThing: "Blah");
}

void Foo(string importantThing, string otherThing)
{
	switch (importantThing)
	{
		case "Home":
			DoSomething();
			break;
		default:
			DoSomethingElse();
			break;
	}
	Log(otherThing);
}

```

You can now easily see that `"Home"` is going to `"importantThing"`, even in a plain-text view of the file.

If I now re-order the arguments of `Foo()` again, it _doesn’t_ break because the compiler knows which string to connect to which parameter. Win.

```
void Main()
{
	Foo(importantThing: "Home", otherThing: "Blah"); // still valid!

}

void Foo(string otherThing, string importantThing) // <-- refactored
{
	switch (importantThing)
	{
		case "Home":
			DoSomething();
			break;
		default:
			DoSomethingElse();
			break;
	}
	Log(otherThing);
}

```
Day 13-17: Design Patterns and some projects
Published: 2023-04-17 23:52:18

Days 13 through 15 were dedicated to exploring Design Patterns, as presented in two chapters of the book "Python 3 Object-Oriented Programming" by Dusty Phillips. Design Patterns are abstract solutions that provide best-practice guidance for addressing commonly encountered programming problems. The book covered around 12 Design Patterns over 2 of its chapters, which were mostly familiar from my experience with Java, JavaScript, and .NET. However, due to differences in language syntax and philosophy, some of the implementations in Python can have some unique variations. Each design pattern merits its own blog post for a comprehensive discussion, so I plan to revisit them in greater depth after completing my 100 Days of Code challenge.

On Days 16 and 17, I returned to Angela Yu's 100 Days of Code Udemy course and focused on Section 27-31, which covered Tkinter for creating GUI programs. I completed three engaging projects: a Pomodoro application, a Password Manager application, and the Flashcard App Capstone project. All three utilized Tkinter for their GUIs and introduced me to the built-in json module.

Feeling a bit worn out from a busy schedule and rigorous study, I'm eager to take a break and recharge before diving into the upcoming topics, which promise to be incredibly exciting! Up next: Pandas, Numpy, and Matplotlib!
Apache AGE 1.3 Release for PostgreSQL 13
Tags: apacheage
Published: 2023-04-17 23:19:32

Apache AGE has released a new version that is compatible with PostgreSQL version 13. This is great news for developers as they can now take advantage of Postgres' 13 features and improvements in performance. Besides, this new release has added new features and enhancements to the Apache AGE too.

Some of the key updates and fixes include the implementation of CALL ... [YIELD] for cypher functions, disallowing graph names with the empty string, and the optimization of the age_exists function. Additionally, there are fixes for various bugs related to clauses, commands, and labeling.

The CALL clause is an essential feature in database programming, which allows programmers to invoke a deployed procedure within the database. Additionally, the YIELD sub-clause enables the selection of specific result fields that are to be returned as newly-bound variables from the procedure call. This provides users with greater flexibility and control over the returned data, allowing for further processing within the remaining query.

I recommend taking a look at the full release notes for more detailed informations. Overall, this new version of Apache AGE should provide developers with improved functionality and performance.

Apache AGE website: https://age.apache.org
Apache AGE repository: https://github.com/apache/age
Release branch: https://github.com/apache/age/tree/release/PG13/1.3.0
Day 737 : Tracks
Tags: hiphop, code, coding, lifelongdev
Published: 2023-04-17 22:33:53

_liner notes_:
- Saturday : Went to the station and there was no parking at all. I had to park across the street and walk to the station. It's a good thing that I get there super early. Did the radio show. Had a good time as usual. After the show, went to my parking spot and refactor some code and went to sleep. The recording of this week's show is at https://kNOwBETTERHIPHOP.com

![Radio show episode image of a passport from the United States of America with the words April 15th 2023 Saxxy](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/538frnutavpkhi8zduvq.jpg)

- Sunday : Finished adding a new feature to a side project I made that I plan on using at an event for work and got it deployed. Did some more refactoring on my current side project. I think I may have figured out a way of reusing some code. Worked on it pretty late and went straight to bed.

- Professional : I put a message into our company Slack for people to try out the changes I added to my project and let me know if it worked. So far, people have said it worked. I had a catch up meeting with some team members and they tested it out for me also and it worked. Awesome. I spent the rest of the day refactoring some code on a current project.

- Personal : Did some refactoring on my side project and it's still working. Maybe I'm actually understanding the View Transitions API. I showed a couple of team mates and they said they liked it. Going to do some more refactoring and then start moving stuff over into my real project.

![The Engelberg, Switzerland landscape including green mountains in front of gray snow covered mountains with some cloud cover in the distance and a lake in the foreground showing the reflection ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3ovg5v6sul90jiyx2rhz.jpg)

Going to continue refactoring my code. I want to go through some tracks for the radio show this week. Since I'll be abroad for the upcoming show, I want to get as much of it completed as possible so I don't have to carry extra equipment. That's pretty much it.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube nmoa81GZd-E %}
Need tips in setting the right path.
Tags: programming, frontend
Published: 2023-04-17 22:22:10

Hi guys, so for the past few months I have been posting on dev.to frequently, and, surprisingly, I have grown my followers from 5 to 54, though I have stopped posting for like a month now. WHY?

Well, I am trying to focus on one aspect of programming, as software development has a variety of paths, and I have chosen the path of a front-end software engineer (I am serious, I don't need anything backend).

So I decided to learn all this stack below.

Stacks I know and plan on learning:
---
- HTML5 (just so simple)
- CSS3 (Hmmmmmmm)
- Javascript (for web)
- Typescript (because JS sucks sometimes)
- ReactJs (NextJs) (for web)
- Vue (NuxtJs) (for web)
- Flutter and Dart (for cross-platform)
- React Native (for cross-platform)
- C# (for native Windows platforms using winUI3 or WPF)
- Swift (for native macOS and iOS)
- UI/UX (but just a little bit)

**I have chosen the above stack because:**
- I can find a job easily with that (at least, that is what I believe).
- That is what will make me a full-fledged software (front-end) engineer.
- learning all that successfully will make me so happy as I really find lots of joy in programming (it gives a sense of power).

**My Question**
Even though I have some experience in these tech things, I don't really know if I am making the right choice, so this is where I need your guys advice for me (it can also help others on the same path).

You can add or remove what you think does not feel right in that least, but note that I only want to focus on front-end and become a guru in it.

Your input on this will really be appreciated, and here is a list of stacks I know and have used in production.

Know Stack:
---
- HTML5 (My Portfolio: https://emeka212.github.io/my-portfolio)
- CSS3
- SCSS (I haven't touched it in 2 years:))
- Javascript
- Typescript (just stated learning it)
- React (NextJs) [build a blog with it: https://axxellanceblog.com]
- Flutter and Dart (almost a pro)
- C# (just started learning this too)
- UI / UX (a little, though not that little)

Except from all this, I know some other things that are not really into programming, like git, github, and the likes of it.

> Note: My portfolio has some of my personal and non-personal projects.

Please do not skip this; a word or less will be gladly appreciated.

Thanks in advance!
Self-Reg and Spotify: How I automated my music listening experience 🎵
Tags: automation, music, work, wellbeing
Published: 2023-04-17 22:07:12

**Are you tired of spending too much time searching for the perfect Spotify playlist for your current mood? I have found a solution that has saved me time and frustration.**

## The struggle
As someone who enjoys music, I have over 100 Spotify playlists in my favorites list. However, when it comes to choosing the right playlist for my current level of alertness, I often found myself struggling to find the perfect one. Sometimes the music was too soft, other times it was too loud. I needed a way to instantly search and find a playlist that would match my current level of alertness, so it would help me in my activity rather than irritate me.

## The solution

My solution was to create a database in Notion of all my playlists and classify them based on their level of alertness: **low**, **attentive**, **reactive**, or **active**. Whenever I wanted to listen to music, I would ask myself a quick question about my current level of alertness, and then I would open my database, filter by the chosen alertness type, and pick a random playlist.

But why stop there? I wanted to make this process even more efficient. So, I created an iOS shortcut that would ask me to choose one of the four given alertness types. The shortcut would then connect in the background to my Notion database, get one random playlist from the chosen alertness type, and open Spotify to play it.

Now, with just a few clicks, I can listen to the perfect Spotify playlist that matches my current level of alertness. No more wasting time searching for the right music, and no more frustration with mismatched playlists. This solution has made listening to music a more enjoyable and efficient experience. 

I'm aware my solution is very specific. But it's a nice example of optimizing your life. And I hope it will inspire you.

## Levels of alertness by Dr. Stuart Shanker

Dr. Stuart Shanker's book ["Self-Reg"](https://www.goodreads.com/en/book/show/27774752) discusses the importance of recognizing and responding to different levels of alertness in order to effectively self-regulate and manage stress. Shanker emphasizes the significance of understanding our own levels of alertness and recognizing when we are becoming dysregulated. By doing so, we can take steps to restore balance and promote well-being.

In Shanker's model, there are five levels of arousal or alertness, which include **low** arousal, **attentive** arousal, **reactive** arousal, **active** arousal, and **hyper**-arousal. By classifying my playlists according to the first 4 levels, I am more aware of my current level of alertness and can quickly find the perfect playlist that matches my mood.

## Summary

This process has been a game-changer in my daily routine, and I hope it inspires you to create your own system that matches your needs and preferences. Happy listening! 🎧
How to use MapLibre GL JS with 3D Tiles (pnts)
Tags: javascript, smartmaps, maplibre
Published: 2023-04-17 21:02:57

- [Demo](https://optgeo.github.io/free-nagasaki-maplibre/?tileset=https://smb.optgeo.org/ipfs/QmVqPr8p3TjgcQxVbqEuJ9kCvcMvZR3T91zyyu11VFp44G/tileset.json#17.52/32.733403/129.865636/43.6/60)
- [Repository](https://github.com/optgeo/free-nagasaki-maplibre/blob/main/docs/index.html)

Here is the code. 

```html
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://unpkg.com/maplibre-gl@2.4.0/dist/maplibre-gl.js"></script>
<script src="https://unpkg.com/deck.gl@latest/dist.min.js"></script>
<script src="https://unpkg.com/@loaders.gl/3d-tiles@^2.3.0/dist/dist.min.js"></script>
<link href="https://unpkg.com/maplibre-gl@2.4.0/dist/maplibre-gl.css" rel="stylesheet"></link>
<style>
#cesiumContainer { position: absolute; top: 0; left: 0; height: 100%; width: 100%; margin: 0; 
  overflow: hidden; padding: 0; font-family: sans-serif; }
html { height: 100%; }
body { padding: 0; margin: 0; overflow: hidden; height: 100%; }
</style>
</head>
<body>
<div id="map"></div>
<script>
const map = new maplibregl.Map({
  container: document.body,
  style: 'https://optgeo.github.io/optbv-intl/optbv-intl-dev.json',
  hash: true,
  attributionControl: false
})

const searchParams = new URLSearchParams(window.location.search)
let url = searchParams.get('tileset') || 'https://d21pj9gigeop84.cloudfront.net/data/point-cloud/lp-2022/22302_kawazu-cho/tileset.json'

map.on('load', () => {
  const { MapboxLayer, Tile3DLayer } = deck

  const layer = new MapboxLayer({
    id: '3d',
    type: Tile3DLayer,
    pointSize: 1.6,
    data: url,
    loader: Tiles3DLoader
  })
  map.addLayer(layer)
})
</script>
</body>
</html>
```
AI. Copyright?
Published: 2023-06-12 17:17:01

---
title: AI. Copyright?
published: true
date: 2023-04-17 16:54:51 UTC
tags: 
canonical_url: 
---

As technology continues to advance at an incredible speed, we are faced with a myriad of ethical questions that were once unimaginable. One such question that is increasingly prevalent in the tech world today is the issue of **AI and copyright**.

_Can AI systems create truly original content?_ The answer is a resounding yes. AI can be programmed to analyze vast amounts of data and generate new content based on that information. From music to art and even literature, AI systems can create all sorts of original works.

However, the real question is whether this content **can truly be considered original or not**. Can a machine really create something that is entirely unique and not simply a rehash of existing content? Plus, <mark>some studies reveal that sometimes AI gives you content used in training.</mark>

This question leads us to the issue of copyright law and AI. Under current copyright law, _any original work of authorship is automatically protected by copyright from the moment it is created_. This includes basically any creative work.

But, as with many legal issues related to AI, it is unclear how copyright law should apply to content created by a machine. Who owns the rights to AI-generated content? The person who programmed the AI system, the company that owns the system, the persons who made the training text, or the machine itself? 🤔

This ethical dilemma poses a serious challenge to society. If an AI system can create original content, should it be allowed to profit from it? Is it ethical for a machine to create something that a human could have created and profited from it?

On the other hand, if we do not allow AI systems to create and profit from their content, are we limiting the potential of this technology? Could we be missing out on groundbreaking discoveries and works of art if we do not let AI systems create?

As AI technology continues to advance, the issue of AI and copyright will only become more pressing. It is likely that we will see changes to copyright law in the future to address this issue.

Maybe we can create a new category of copyright protection specifically for AI-generated content? This could involve giving ownership rights to the person or company that owns the AI system, while also ensuring that the original creator of the content is properly attributed.

Give your thoughts on the comments.
Program In Data Science And Analytics
Tags: analytics
Published: 2023-04-17 20:44:40

Learn the real-world application of data science and build analytical models that enhance business outcomes. This job-guarantee program is ideal for recent graduates and professionals who want to develop a successful [data science and analytics career](https://blog.imarticus.org/data-science-and-analytics-career-trends-for-2021/). You will gain practical knowledge about the implications of data science and analytics in real-world businesses and prepare to work as a data science professional in an emerging field of data science and analytics.
Change Port Apache2
Tags: beginners, tutorial, devops, apache2
Published: 2023-04-17 20:43:53

You can change apache2 port with add the new port to `/etc/apache2/ports.conf`. Use nano or vim to edit file. This is my example, I want to change http port from 80 to 3000.
```
nano /etc/apache2/ports.conf
```
Add the new port
```
Listen 3000
```
Restart apache2
```
sudo service apache2 restart
```
Open in browser `http://localhost:3000`
Tailwind CSS
Tags: webdev, beginners
Published: 2023-04-17 20:29:53

Tailwind CSS is a popular utility-first CSS framework that can be used to create beautiful and responsive user interfaces quickly. React.js is a widely-used JavaScript library for building user interfaces. Together, they make a powerful combination for building complex web applications. In this blog post, we will explore how to use Tailwind CSS in React.js and the benefits of doing so.

Getting Started with Tailwind CSS

Before we dive into using Tailwind CSS with React.js, we need to install Tailwind CSS in our project. We can do this using npm, by running the following command in our terminal:

```
npm install tailwindcss

```

Once Tailwind CSS is installed, we need to create a configuration file for it. We can do this by running the following command in our terminal:

```
npx tailwindcss init

```


This will create a tailwind.config.js file in our project's root directory. This file will contain all of the configuration options for Tailwind CSS.

Using Tailwind CSS in React.js

Once Tailwind CSS is installed and configured, we can start using it in our React.js application. The easiest way to do this is by adding Tailwind CSS classes to our HTML elements. For example, we can add the bg-red-500 class to a div element to give it a red background color:

```
<div class="bg-red-500">
  This is a red div.
</div>

```

In React.js, we can add Tailwind CSS classes to our elements using the className attribute instead of the class attribute:

```
<div className="bg-red-500">
  This is a red div.
</div>

```

We can also use Tailwind CSS in our React.js components by importing it into our JavaScript files:

```
import React from 'react';
import 'tailwindcss/tailwind.css';

function App() {
  return (
    <div className="bg-red-500">
      This is a red div.
    </div>
  );
}

export default App;

```
Introducing AI-generated Anki flashcards
Tags: anki, learning, chatgpt
Published: 2023-04-17 20:16:09

> _**Disclaimer:** This shows a way how to import AI-generated flashcards into Anki. This is neither about the model's performance regarding the creation of flashcards nor about the suitability of the cards for learning. All the results were created using the free tier of OpenAI's "ChatGPT March 23" version._

While preparing my Anki flashcards for learning I was wondering if ChatGPT would be able to create flashcards from given texts, so I took a paragraph from the book I was studying and pasted it - along with some context information - into the prompt. The result - being  genuinely acceptable - surprised me so I continued with fine-tuning the query. Below, you can see the cards that ChatGPT wrote for me. For demonstration, I used a article from Wikipedia about Deep learning:

![Screenshot. ChatGPT UI showing generated Anki flashcards about Deep Learning](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yn8mw5izs9cpyphb11hq.png)

My Query consisted of this phrase: 

> The following is a wikipedia article about Deep Learning. Create flashcards for use by Anki. Prefix each question with "Q:" and shorten the answers to two sentences.

following the article's content.

After some experiments in German language, I thought about integration of this feature with Anki itself. In Order to not lock in with OpenAI's models I came up with an update of an addon that was developed some months ago. The Smart Insert addon was originally intended to simplify copy+paste from presentations where inappropriate line breaks and enumerations are carried over to your decks. 

As it works with regular expressions internally, the new AI mode could easily be added by filtering question and answer based on the "Q:"/"A:" prefix defined in the prompt. To download the addon go to https://ankiweb.net/shared/info/1303065007 and follow the basic installation instructions. Smart Insert means, that you will be able to copy the note paragraph by paragraph and insert it in one of the fields in the basic card style. The editor will divide the text and paste question and answer into the respective fields. For more information visit https://github.com/swssl/anki-smart-insert.