teleren/devto huggingface dataset:
Funny numbers in C#.
Tags: csharp
Published: 2023-05-10 20:42:22

Today, I would like to discuss numbers in C#. Of course, everyone knows that C# is not JS, but someone can be astonished. And so, let's begin.
Let's start with decimal type:

```C#
Console.WriteLine(0.00000m.ToString() == "0.00000"); //false
```

Why? It's simple. The decimal number was converted to a string with current culture and returned a comma instead dot. This issue resolves the following code below. It would be best if you remembered it.
```C#
Console.WriteLine(0.00000m.ToString(CultureInfo.InvariantCulture) == "0.00000"); //true
```

Let's go to the double type:
```C#
Console.WriteLine(0.00099d.ToString() == "0.00099"); //false
```

Why? The double number isn't equal to 0.00099, and it's similar to 0.00098999999999999999. So this case also needs to be remembered.
Let's consider another example:
```C#
Console.WriteLine((-0d).ToString() == "0"); //false
```

Why? Because the zero can be a negative number, it was converted with a minus. Further, it's more interesting:
```C#
Console.WriteLine(-0d == 0d); //true
```
Next we compare strings:
```C#
Console.WriteLine(0.0d.ToString(CultureInfo.InvariantCulture) == "0.0"); //false
```
In this case, the 0.0d was converted to 0 and then to "0".

And the cherry on the cake. Let's look at another example:
```C#
Console.WriteLine((double)0.1f == 0.1); //false
```

I want to explain what I do. The number 0.1 is double, and I convert float to double, and we get false. Why? Because the 0.1 is actually equal to 0.10000000000000001 and converted 0.1f equal 0.10000000149011612.

Let's make conclusions. Always control numbers with the comma and restrict digits after the comma.

<a href="https://www.buymeacoffee.com/b9z99kntvtQ" target="_blank"><img src="http://dartfordwaffler.co.uk/wp-content/uploads/2021/03/buy-me-a-beer.jpg" alt="Buy Me A Beer" style="height: 60px !important;width: 317px !important;" ></a>
Streamlining Development: A Dive into Minimalistic Browser
Tags: minbrowser, opensource, browser, minimalstic
Published: 2023-05-10 20:40:40


Min is a Open-Source, fast, minimalstic browser that protects your privacy. It includes an interface designed to minimize distractions, and features such as:

📌 Information from DuckDuckGo in the search bar.
📌 Full-text search for visited pages
📌 Ad and tracker blocking
📌 Automatic reader view
📌 Tasks (tab groups)
📌 Password manager integration
📌 Built-in Dark theme

**Installation on Linux:**
 - To install the .deb file, use 

```
sudo dpkg -i /path/to/download
```
 - To install the RPM build, use 
```
sudo rpm -i /path/to/download --ignoreos
```

But this article is dedicated to install Min Browser in Arch Linux
**Installation on Arch Linux:**

 - Step 1: You need to clone Min Browser Repository- 
```
git clone https://aur.archlinux.org/min.git
```

 - Step 2: After cloning this repository you need to install a dependency (Electron). Because Min is written entirely with JavaScript using Electron.
So you can install latest version of Electron-
```
sudo pacman -S electron22
```

 - Step 3: Then go to the min browser directory that you cloned before-
```
cd min
```
 - Step 4: Now simply run below command-

```
makepkg --install
```
🚀🚀 Now Min Browser will install in few minutes in your Machine.🚀🚀
Thanks 💗 for reading this article. I think this will help you.
Go GodSpeed!! 🚀🚀
Generative Art with Grasshopper: Moroccan Zellige Evo Series L
Tags: generative, grasshopper, art, design
Published: 2023-05-10 20:34:48

Hello, my friends! In today's latest creation, part of my "Zellige EVO" collection, I am delving into the world of generative Zellige art using Grasshopper Rhino to create captivating and endlessly evolving patterns.

When it comes to [generative art](https://jawharkodadi.com/generative-art-avec-grasshopper-zellige-evo-serie-l/), I love exploring new paths and approaches. I had previously shared a Zellige pattern generator coded in P5.js on my blog. Creating generative art with JavaScript, Processing, or Python requires some knowledge of these programming languages. But fear not, it's not overly complicated! However, if you're not a fan of coding, there are several tools with visual interfaces to make the task easier. Grasshopper is one such tool.

## Why did I choose Grasshopper?

As I mentioned earlier, one of the main advantages of Grasshopper is its visual interface. Unlike other programming languages such as JavaScript, Processing, or Python, Grasshopper does not require you to type lines of code. Instead, you can create algorithms visually by connecting graphical components to one another. This makes generative art creation much more accessible and, above all, much more intuitive.

Personally, I find that Grasshopper provides an incredible level of flexibility. With its numerous components and parameters, you can explore and experiment with various techniques and approaches to create generative art.

## How I did it:

I started by creating a grid with vertical and horizontal lines, onto which I placed an 8-pointed star. Then, I used the 16 points of this star to warp the grid lines, thus creating parametric curves that change based on their distance from the star's points.


![Design steps for the lines in Grasshopper](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4cxuadt64llfxdtr9t2j.jpg)

One of the most interesting aspects of this artwork is that I integrated several sliders in Grasshopper to adjust different parameters, such as the distance between points, the amplitude of the deformation, and the scale of the curves. This allows me to generate an infinite number of shapes and create unique variations each time.


![Grasshopper definition file](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ezutd4int0kjjdqzlql.jpg)


## Some examples:


![Grasshopper Zellige lines example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bi08iln982e7rho6bej2.jpg)


As part of my "[Zellige EVO](https://jawharkodadi.com/zellige-evo-exploration-de-lart-generatif-et-des-motifs-de-zellige-marocains/)" collection, this creation falls within my exploration of generative Zellige art, where I enjoy playing with shapes and parameters to create dynamic and evolving artworks.

Feel free to lose yourself in the twists and turns of the curves and appreciate the countless variations that emanate from this unique combination of constraints and freedoms. It's truly a fascinating experience, and I'm thrilled to share it with you!
Build a Frontend Web Framework (From Scratch) Book
Tags: webdev, javascript, beginners, podcast
Published: 2023-05-10 20:25:04


Original: https://codingcat.dev/podcast/3-11-build-a-frontend-web-framework-from-scratch-book

{% youtube https://youtu.be/pETjOZCP6UE %}

## Questions

1. Can you tell us more about yourself?
2. Why did you decide to write the book?
3. Can a person still write a complete framework, or is the idea of the book to teach them all the concepts that it would take in order to create one?

## Links

* [https://www.manning.com/books/build-a-frontend-web-framework-from-scratch](https://www.manning.com/books/build-a-frontend-web-framework-from-scratch)
GRIFFIN: Secure Containers for Humans & Robots
Tags: showdev, news, security, webdev
Published: 2023-05-10 19:47:43

Hi! I would like to present you my pet project for those who are interested in storing secret information in portable secure containers.

Neither usernames, nor credentials, nor hashes are stored in the container, saved by the browser, or transmitted over the network.

The project is still at a very early stage of development, but you can try examples or create your own secure container.

I look forward to your feedback!

{% embed https://github.com/griffin-container/griffin %}
Revolutionize Your Web Apps: Discover the Game-Changing Features in Vue.js 3
Tags: vue, javascript, web3, webdev
Published: 2023-05-10 19:26:38

Vue.js latest version, and it's changing the game for web developers. With powerful new features like the Composition API, Teleport, and Fragments, Vue.js 3 is making it easier than ever to build dynamic, scalable user interfaces that keep users engaged and coming back for more.

The Composition API is a game-changer, allowing developers to organize their code logic in a more intuitive and modular way. With the ability to share common logic across different components, developers can build more complex applications with less code and less hassle.

Teleport is another exciting addition to Vue.js 3, making it possible to render components in different locations in the DOM. This feature opens up new possibilities for dynamic transitions and animations, making web apps more engaging and interactive than ever before.

And with Fragments, developers can now group multiple elements together without having to wrap them in a container element, resulting in cleaner markup and more flexibility in component composition.

But that's not all - Vue.js 3 also offers improved TypeScript integration, better error handling, and faster rendering performance, making it easier and more efficient to build cutting-edge web applications.

So what are you waiting for? Revolutionize your web apps with Vue.js 3's game-changing features and take your development skills to the next level.
Boost Your Repository Insights with GitHub Actions 🚀, Codespace 💻 and Mergestat 🔎📙
Tags: githubhack23, mergestat, opensource, github
Published: 2023-05-10 19:15:32

## What I built 
I have developed a solution that enables easy integration of the [Mergestat](https://www.mergestat.com/) within GitHub Codespace. With this integration, users can now seamlessly utilize Mergestat to analyze and track GitHub repositories using SQL queries, without needing to install any tools.
Furthermore, by leveraging GitHub Actions workflows, all the needed data can be collected automatically using scheduled workflows, thereby reducing information gathering times.

### Category Submission: 
__Maintainer Must-Haves:__ Make the lives of Open Source maintainers easier.
> _Guidance:_ Developers can use Codespaces to set up an environment to triage issues and review pull requests. Actions can also be used to build tools and resources to help developers create better documentation.

### App Link / Link to Source Code
https://github.com/salem84/repo-mergestat-codespace

### Permissive License 
[MIT License](https://github.com/salem84/repo-mergestat-codespace/blob/main/LICENSE)

## Background (What made you decide to build this particular app? What inspired you?) 
My objective in developing these extensions was to create a simple and efficient system for analyzing repositories, which can be easily implemented within one's own GitHub organization. By doing so, users can benefit from quick and accurate insights into their repositories, streamlining their development process and improving overall productivity using open-source tools.

### How I built it (How did you utilize GitHub Actions or GitHub Codespaces? Did you learn something new along the way? Pick up a new skill?) 

To build this solution, I utilized both GitHub Actions and GitHub Codespaces. Specifically, I created a custom GitHub Actions workflow for data collection, and I configured a GitHub Codespace to execute queries. Along the way, I learned a lot about both tools and discovered new ways to use GitHub Actions in contexts outside of traditional CI/CD pipelines. Moreover, diving into the world of GitHub Codespaces was an eye-opening experience that allowed me to gain a deeper understanding of the platform's capabilities. In my upcoming detailed post, I'll share screenshots and code to describe each step of the process in more detail.

### What is MergeStat
MergeStat is a powerful tool that allows developers to track and analyze data in git repositories and related sources (such as the GitHub API). 
Using MergeStat, users can gain valuable insights into their codebase and monitor key metrics using SQL queries to extract relevant data from GitHub repositories, and presents the information also in a user-friendly dashboard, making it easy for developers to identify and address issues in their code.
How to manage Slack Notifications during core hours?
Tags: programming, react, frontend, devops
Published: 2023-05-10 19:01:10

Here are some tips to manage Slack notifications during core working hours:



Turn on "Do Not Disturb" mode in Slack. This will mute all notifications except direct mentions and keywords you choose.

Toggle notifications off for specific channels that are more noisy. You can do this by clicking the "..." menu in a channel and clicking "Mute notifications".

Use Slack statuses to indicate when you are unavailable. You can set a "Do Not Disturb" status during core hours to notify your team.

Install a Slack scheduler app like "Timing". This lets you automatically mute notifications during certain time ranges.

Install a browser extension to mute Slack notifications during specific websites. This can help you focus when working on other tasks.

Set activity and availability preferences to "Show as away" during core hours. This will indicate to your team that you may not respond immediately.

Directly message your teammates to let them know when notifications are muted and when you will be available next. This helps set expectations.

Turn off general notifications and only get notified for direct messages. This will limit interruptions while still allowing your teammates to reach you.

The main goal is to set clear expectations and boundaries with your team around when you are available and when you need focus time. Using some of the above methods during core hours can help strike that balance.

Hope this helps! Let me know if you have any other questions.
What to note first when learning Python??
Tags: programming, python, react, reactnative
Published: 2023-05-10 18:57:05

Here are some key things to note when learning Python:

Indentation is important: Python uses indentation (spaces) to define scope, instead of braces {}. So proper indentation is required for your code to work.

Python is dynamically typed: You don't need to declare variables with a type, and types can change. For example, you can do:


```
x = 5     # x is an int
x = "John" # now x is a string
```
Python uses new lines to end statements: No need for semicolons ; at the end of each statement. New lines imply the end of a statement.

Python has a simple syntax: Python code is very clean and readable. It has a simple and consistent syntax.

Python has a rich set of libraries: Python comes with a vast set of libraries (collections of pre-written code) that can be used for various tasks like scientific computing, web development, software engineering, etc.

Python supports multiple programming paradigms: Python supports OOP (with classes and inheritance), procedural programming (with functions), and functional programming (with lambda). So you have flexibility in how you want to solve a problem.

Python has an interactive shell: The Python REPL (Read-Eval-Print-Loop) allows you to quickly test snippets of code. It's a great way to explore the language.

Python uses whitespace for scope: The scope of variables is defined by indentation (whitespace) rather than brackets. So no variable declarations needed!

Python has simple data types: The main data types in Python are lists, tuples, sets, dictionaries, strings, numbers, and Booleans.

Python is interpreted: Python code is compiled into bytecode, then executed by the Python interpreter. So no need to compile your code before executing it.
Common Errors in React Native and Solutions
Tags: javascript, beginners, devops, react
Published: 2023-05-10 18:48:57

Here are some common errors that you might encounter when developing with React Native, along with their solutions:

"Invariant Violation: 'setState' can only be called on mounted or mounting components."
This error occurs when you try to call setState on a component that has already been unmounted. To fix this error, you should check if the component is still mounted before calling setState. You can do this by using a flag like this._isMounted or by using the useEffect hook with a cleanup function to cancel any ongoing requests or subscriptions when the component unmounts.

"TypeError: undefined is not an object (evaluating 'someObject.someProperty')"
This error occurs when you try to access a property of an object that is undefined. To fix this error, you should check if the object exists before accessing its properties. You can do this using the optional chaining operator ?., like someObject?.someProperty.

"ReferenceError: Can't find variable: SomeComponent"
This error occurs when you try to use a component that has not been imported or is not defined in the current scope. To fix this error, you should import the component or define it in the current scope.

"TypeError: null is not an object (evaluating 'someVariable.someProperty')"
This error occurs when you try to access a property of a variable that is null or undefined. To fix this error, you should check if the variable exists before accessing its properties. You can do this using the optional chaining operator ?., like someVariable?.someProperty.

"SyntaxError: Unexpected token < in JSON at position 0"
This error occurs when you try to parse JSON that is not properly formatted. To fix this error, you should check the JSON to ensure that it is properly formatted and that there are no syntax errors.

"Network Error"
This error occurs when there is a problem with the network connection. To fix this error, you should check the network connection and ensure that it is working properly. You can also use a library like axios or fetch to handle network errors more gracefully.

These are just a few of the many errors that you might encounter when developing with React Native. By understanding these errors and their solutions, you can save time and avoid frustration when developing your React Native applications.
Which is better to use between React JS and React Native when creating Apps?
Published: 2023-05-10 18:46:30

The choice between React JS and React Native depends on the type of application you want to create and the platforms you want to target.

React JS is a JavaScript library for building web applications, while React Native is a framework for building mobile applications that can be deployed to both iOS and Android platforms. React JS is great for building complex user interfaces for web applications, while React Native is great for building native mobile applications with a high degree of performance and responsiveness.

If you are building a web application, you should use React JS. React JS is optimized for the web and provides a rich set of tools and libraries for building complex web applications. React JS is also great for building single-page applications (SPAs) that provide a seamless user experience without the need for page reloads.

If you are building a mobile application for iOS and Android platforms, you should use React Native. React Native allows you to build native mobile applications with a high degree of performance and responsiveness. React Native also provides a rich set of components and APIs for building mobile applications, making it easy to create a consistent user experience across iOS and Android platforms.

In summary, if you are building a web application, React JS is the way to go. If you are building a mobile application for iOS and Android platforms, React Native is the way to go. However, if you need to build both a web application and a mobile application, you can use both React JS and React Native to share code and resources between the two platforms.
React Native Hooks
Tags: react, programming, reactnative, beginners
Published: 2023-05-10 18:43:27

React Native Hooks are similar to React Hooks, but they are specifically designed for use in React Native components. React Native Hooks allow you to use state and other React features in functional components, just like in React.

Here are some commonly used React Native Hooks:

1. useState: This hook allows you to add state to your functional components. It takes an initial state value and returns an array with two elements: the current state value and a function to update that state value.

2. useEffect: This hook allows you to perform side effects in your components, like fetching data or subscribing to events. It is called after every render of the component and takes a function as its argument.

3. useContext: This hook allows you to consume a context that you have created using the `React.createContext` function.

4. useRef: This hook allows you to create a reference to a component or a value that persists between renders.

5. useCallback: This hook allows you to memoize a function so that it is only re-created when its dependencies change.

6. useMemo: This hook allows you to memoize a value so that it is only re-calculated when its dependencies change.

7. useReducer: This hook allows you to manage state in more complex scenarios, where you need to update state based on previous state or perform actions based on state changes.

8. useNavigation: This hook allows you to access the navigation prop from a screen component.

9. useRoute: This hook allows you to access the route prop from a screen component.

10. useFocusEffect: This hook allows you to perform side effects when a screen comes into focus, and clean them up when the screen goes out of focus.

These are just a few of the many hooks available in React Native. By using hooks, you can create more powerful and reusable components in your React Native applications.
How does the useCallback hook differ from the useMemo hook?
Tags: webdev, react, javascript, programming
Published: 2023-05-10 18:41:06

useCallback and useMemo are both hooks in React that are used to optimize performance by memoizing values, but they differ in their use cases.

The useCallback hook is used to memoize functions. When you use useCallback, you create a memoized version of a function that is only recreated when one of its dependencies changes. This is useful when you want to pass a function as a prop to a child component, but don't want that child component to re-render every time the parent component re-renders. By memoizing the function, you can ensure that the child component only re-renders when necessary.

Here's an example of using useCallback to memoize a function:


```
const MyComponent = () => {
  const [count, setCount] = useState(0);

  const handleClick = useCallback(() => {
    setCount(count + 1);
  }, [count]);

  return (
    <button onClick={handleClick}>Clicked {count} times</button>
  );
};
```
In the example above, the handleClick function is only recreated when the count state changes.

The useMemo hook, on the other hand, is used to memoize values that are expensive to compute. When you use useMemo, you create a memoized version of a value that is only recomputed when one of its dependencies changes. This is useful when you have a value that takes a long time to compute, and you don't want to recompute it every time the component re-renders.

Here's an example of using useMemo to memoize a value:


```
const MyComponent = () => {
  const [count, setCount] = useState(0);

  const expensiveValue = useMemo(() => {
    return computeExpensiveValue(count);
  }, [count]);

  return (
    <div>{expensiveValue}</div>
  );
};
```
In the example above, the expensiveValue is only recomputed when the count state changes.

In summary, useCallback is used to memoize functions, while useMemo is used to memoize values.