teleren/devto huggingface dataset:
Multidimensional array in C#
Tags: csharp, dsa, c, arrays
Published: 2023-08-30 18:52:17

---
title: Multidimensional array in C#
published: true
date: 2023-08-18 18:30:00 UTC
tags: CSharp,DSA,C,Arrays
canonical_url: http://www.codetolive.in//c%23/dsa/Multi-dimensional-array-in-C/
---

# INDEX

- What is an array?
- What is a multidimensional array?
- 2d and 3d arrays
- Examples

## 1. What is an Array?

Arrays are used to store multiple values in a single variable instead of in  separate variables. It can be single dimensional, multidimensional, or jagged.

## 2. What is a multidimensional array?

It is an array of arrays and has more than one dimension. The most common is a two-dimensional array, i.e., 2D.

## 3. What is 2D?

A 2D array is a matrix that consists of rows and columns.

### 3.1 2D array with an int data type without specifying the index

```
int[,] arrayNumbers = new int[,] { {1, 2}, {3, 4} };

```

|   | Col 0 | Col 1 |
| --- | --- | --- |
| Row 0 | 1 | 2 |
| Row 1 | 3 | 4 |

#### 3.1.1 Output:

Console.WriteLine(arrayNumbers[0][1]);  
Console.WriteLine(arrayNumbers[1][0]);  
2  
3

### 3.2 2D array with int data type and specified index

```
int[,] arrayNumbers = new int[3,2] { {1, 2}, {3, 4}, {5,6} };

```

|   | Col 0 | Col 1 |
| --- | --- | --- |
| Row 0 | 1 | 2 |
| Row 1 | 3 | 4 |
| Row 2 | 5 | 6 |

#### 3.2.1 Output:

Console.WriteLine(arrayNumbers[0][1]);  
Console.WriteLine(arrayNumbers[1][0]);  
2  
3

### 3.3 2D array with string data type

```
string[,] arrayCities = new string[2,2] { {”Chennai”, “Bangalore”}, {”Delhi”, “Pune”} };

```

|   | Col 0 | Col 1 |
| --- | --- | --- |
| Row 0 | Chennai | Bangalore |
| Row 1 | Delhi | Pune |

#### 3.3.1 Output:

Console.WriteLine(arrayNumbers[0][1]);  
Console.WriteLine(arrayNumbers[1][0]);  
Bangalore  
Delhi

## 4. What is 3D?

3D arrays are used to hold multiple 2D arrays, and they supports up to 32 dimensions. It can be declared by adding commas in the square brackets. For example, [,] - two-dimensional array  
[, ,] - three-dimensional array  
[, , ,] - four-dimensional array, and so on.

1st index: indicates the number of layers  
2nd index: number of rows  
3rd index: number of cols

### 4.1 Examples

#### 4.1.1 Single-layer

```
int[, ,] array3d1 = new int[1, 2, 2]{
                { { 1, 2}, { 3, 4} }
            };

```

#### 4.1.2 Two layers with 2 rows and 2 columns

```
int[, ,] array3d2 = new int[2, 2, 2]{
                { {1, 2}, {3, 4} },
                { {5, 6}, {7, 8} }
            };

```

#### 4.1.3 Two layers with 2 rows and 3 columns

```

int[, ,] array3d3 = new int[2, 2, 3]{
                { { 1, 2, 3}, {4, 5, 6} },
                { { 7, 8, 9}, {10, 11, 12} }
            };

```

#### 4.1.4 Output:

Console.WriteLine(array3d1[0, 0, 0]); // Output = 1   
 Console.WriteLine(array3d1[0, 0, 1]); // Output = 2   
Console.WriteLine(array3d2[0, 1, 0]); // Output = 3   
Console.WriteLine(array3d2[1, 1, 1]); // Output = 7   
Console.WriteLine(array3d3[0, 1, 2]); // Output = 6   
 Console.WriteLine(array3d4[1, 0, 2]); // Output = 9
Steganography
Published: 2023-08-18 18:24:12

In the last decade, cryptography has been rampant as the world becomes more and more with the idea of securing data. As technology advances and people keep more of their data online, highly encrypted software like Bitlocker and OpenSSL and even common messaging platforms such as Whatsapp become more prevalent. This structure enhances data security, making it highly resistant to malicious hacking. While encryption conceals the content of a message, it doesn't hide the message's presence itself. That’s exactly where steganography comes in. 

The main difference between steganography and encryption lies in the fact that the message’s presence remains hidden. For instance, in regions that carry rather strict privacy laws and free speech might be censored, steganography could be beneficial as the message could evade the eye of the government. An example of how censorship could be bypassed is by putting the message within an innocent image, sending it to someone, and having them encode the message later on. Despite the benefits of steganography seeming to outweigh encryption, there are some situations where the latter is better: the most obvious being data storage. 

To truly understand the true potential of steganography, it’s vital to understand just how it works. To begin, lets do a quick review of the binary number system. Below is an 8-bit number representing 123 in decimal 

```
0111 1011
```

The very first number, 0 (from left to right), is considered to be the most significant bit, in the sense that if you change that number it changes the value the most compared to the rest of the bits. On the other end, if you change the very last number, 1, you change the value the least, hence why it’s referred to as the least significant bit. Therefore, in order to not distort the picture itself by much, messages are oftentimes masked within the lowest bits or the least significant bits. In this sense, the overall picture itself will not look different to the human eye but it still hides the message within it.

All in all, steganography has been a huge deal in the past and even now. However, more machine learning algorithms have been tuned to be on the lookout for steganographic content. As a result, the future of steganography will look completely different than the past.
Creating a Simple Book API with Express.js
Tags: javascript, beginners, tutorial, codenewbie
Published: 2023-08-18 18:05:42

Hello! In this article, we'll be creating a simple book API using Express.js. This API can be the foundation for building more complex projects such as a book review site, a library catalog, or even a bookstore.

Prerequisites:
Basic knowledge of JavaScript.
Node.js installed on your pc.

Setting Up:
Start by creating a new directory for your project and initializing a Node.js application:

```
mkdir book-api && cd book-api
npm init -y

```

Next, let's install the required packages:

```
npm install express

```

The Code:
Create an index.js file. This will house our server and routes:

```
const express = require('express');
const app = express();

app.use(express.json());

let books = [];

app.get('/books', (req, res) => {
    res.json(books);
});

app.post('/books', (req, res) => {
    const { title, author } = req.body;
    const newBook = { id: Date.now(), title, author };
    books.push(newBook);
    res.status(201).json(newBook);
});

app.put('/books/:id', (req, res) => {
    const bookId = Number(req.params.id);
    const { title, author } = req.body;

    const bookIndex = books.findIndex(book => book.id === bookId);
    if (bookIndex === -1) return res.status(404).json({ message: "Book not found" });

    books[bookIndex] = { id: bookId, title, author };
    res.json(books[bookIndex]);
});

app.delete('/books/:id', (req, res) => {
    const bookId = Number(req.params.id);
    books = books.filter(book => book.id !== bookId);
    res.status(204).end();
});

app.listen(3000, () => {
    console.log('Server running on http://localhost:3000');
});

```

Testing the API:
You can test this API using tools like Postman or by integrating it into a frontend application.

Conclusion:
Building a basic API with Express.js is straightforward. This simple book API is just the beginning. You can expand it by adding more features, integrating a database, and implementing authentication and authorization.

I hope you found this basic introduction to building an Express.js API helpful! If you enjoyed this guide and would like to delve deeper, give this article some ❤️ (likes). If we get enough interest, I'll create a follow-up post where we'll integrate a database and add authentication to our book API. This way, we can further enhance its features and make it more robust.
What are Fonts ? Why should a #webdeveloper learn about it !!!
Tags: typography, advanced, webdev, programming
Published: 2023-08-18 17:54:33

This is post about my recent medium blog post on fonts for advanced web development.

🔗 Medium Blog : [https://medium.com/@sandeep-machiraju/1-understanding-fonts-fonts-for-advanced-web-dev-d273fec93fa3](https://medium.com/@sandeep-machiraju/1-understanding-fonts-fonts-for-advanced-web-dev-d273fec93fa3)

please do follow me on medium for more blog posts on advanced web development.

How many of you read blogs 📑 ? read news online 📰 ? or may be go deep in the news article in Inshorts by swiping right!

As a regular reader of blogs and online books , it feels frustrating for me especially when website takes time to load. I know many people feel same way with website loading and even sometimes i don't close other browser tabs just because i hate re-rendering and loading of everything.

In this medium blog series , i will be explaining in detail about fonts , font loading , font delivery , font rendering , in between which i will be also covering CSS properties and javascript , where ever required i will be attaching references to websites i learned them from for more clarity.

Advanced #WebDev #frontend #typography #advanced
Offsetting anchors to adjust for a fixed header.
Published: 2023-08-18 17:33:07

So, you got your nice little `sticky` header, it looks good but any `#to-my-title` or `#to-my-reference` bits are linking to areas that are covered by the header.

This is a common problem that is a bit difficult to solve but here is how I did it in my Astro project.

```css
/* Offsetting anchor to adjust for fixed header */
a[aria-describedby="footnote-label"]:target {
	padding-top: 50% !important;
}

h1[id]:before,
h2[id]:before,
h3[id]:before,
h4[id]:before,
h5[id]:before,
h6[id]:before {
	display: block;
	content: " ";
	margin-top: -75px;
	height: 75px;
	visibility: hidden;
}
```
This code might look complicated, that's because it is. 

The first rule applies to any link (a) that has an attribute `aria-described by` with the value footnote-label and is the target of the current URL (meaning it has a hash fragment that matches its id). This rule adds a 50% padding-top to the link, which means it will place it in the middle of the screen.

The second rule applies to any heading that has an id attribute. This rule adds a pseudo-element (:before) to the heading, which is an invisible element that is inserted before the heading’s content. This pseudo-element has a height of 75px and a negative margin-top of 75px, which means it will occupy the same space as the heading but will not affect its position or layout, placing the "target" of the link actually a little bit above the actual heading.
Building a Simple PHP CRUD Operation
Tags: webdev, php, crud, bootstrap
Published: 2023-08-18 17:32:48

In this tutorial, we'll walk you through the process of creating a basic PHP CRUD (Create, Read, Update, Delete) operation. By the end of this guide, you'll have a grasp of how to implement fundamental CRUD operations using PHP and MySQL.

**Prerequisites**
Before we begin, ensure you have the following set up:

- A web server (e.g., Apache)
- PHP installed on your server
- MySQL database

**Database Connection**
Create a file named database.php to establish a connection to the database:

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

**Create Operation** will provide a form to add new data:

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

**Read Operation** to display the list of data:

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


**Update Operation** to edit the selected data:

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

**Delete Operation** to delete the selected data:

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

You've successfully created a simple PHP CRUD system for managing blog content. This tutorial has covered the basics of creating, reading, and interacting with data in a MySQL database using PHP


Watch on video : https://www.youtube.com/watch?v=Us0kty-enMM

Check out the full project here on Github: https://github.com/erajamanickam/simple-crud-operation-in-php
Object Detection Using YOLO-NAS
Published: 2023-08-18 17:17:10

**🔹 What's YOLO-NAS?
YOLO-NAS (You Only Look Once - Neural Architecture Search) is a cutting-edge Object Detection model that combines the efficiency of YOLO with the power of Neural Architecture Search. This fusion results in lightning-fast and highly accurate object detection capabilities.

**🔹 Key Features:
✅ Supercharged Speed: YOLO-NAS boasts remarkable speed improvements, enabling real-time object detection in even the most demanding scenarios.
✅ Precision Redefined: With Neural Architecture Search, YOLO-NAS achieves unparalleled accuracy, ensuring minimal false positives and negatives.
✅ Adaptability: YOLO-NAS learns and adapts to a wide array of objects, making it perfect for diverse applications - from autonomous vehicles to surveillance systems.

**🔹 Why YOLO-NAS Matters?
The ability to swiftly and precisely detect objects in real-time has a profound impact across industries. From enhancing safety in self-driving cars to elevating retail analytics, YOLO-NAS opens doors to countless possibilities.

[Source Code](https://github.com/ahadrazaa/Object-Detection-Project) | [Yolo-Nas](https://github.com/Deci-AI/super-gradients/blob/master/YOLONAS.md)
Maximize the Beauty of Your Resume #1 Pro Tip
Tags: resume, frontend, job, react
Published: 2023-08-18 17:12:14

Struggling with formatting your resume using Google Docs? Are the bullets different sizes? Are you using google docs to create your resume?

Here is the #1 Pro Tip to optimizing Bullets in your resume!

#1 Pro tip is standout by using big BULLETS.



After reading these three tips you should be able to create two different sized bullets in your resume.

1. Find the formatting drop down menu for bullets.
If you are like me you usually just press enter to create a bullet or try to copy and paste another bulleted point. This works if you already have smaller bullets, but doesn't work for the larger ALPHA bullets.

2. Delete the smaller bullet and make sure the cursor is all the way to the left.
When you position the cursor at this point you are setting up the document to insert larger bullets.
*Note: If you have text already it will be left of the other bullets.

3. Use the drop down menu to choose the format that starts with bullets.

It looks like this:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/57bberk10l3e7gdo0l08.jpeg)

Just pop one of those bad boys in and you are ready to go.

What's great is that subsequent bullets will be the Alpha Big Big Bullets.

Connect with me via twitter @adamtimuraslan
How to change desktop wallpaper in Python
Tags: python, coding, programming
Published: 2023-08-18 17:09:15

## Hi 🙂🖐
Welcome everyone! In this post, I will share with you how to change the desktop wallpaper using Python.

## Step 1:
 
If you need any desktop wallpaper, you can download it from the internet.

## Step 2
import Python modules

```python

import win32con
import ctypes
import os

```

## Step 3

Create a function called **set_desktop_wallpaper**

```python
import win32con
import ctypes
import os

def set_desktop_wallpaper(image_path):
    image_path = os.path.join(os.getcwd(), image_path)
    change = win32con.SPIF_UPDATEINIFILE or win32con.SPIF_SENDCHANGE
    ctypes.windll.user32.SystemParametersInfoW(win32con.SPI_SETDESKWALLPAPER, 0, image_path, 0, change)
    
set_desktop_wallpaper('alone.jpg')
```
**SPIF_UPDATE­INI­FILE**
Writes the new system-wide parameter setting to the user profile.
**SPIF_SEND­CHANGE**
Broadcasts the WM_SETTING­CHANGE message after updating the user profile.

This info is from https://devblogs.microsoft.com/oldnewthing/20160721-00/?p=93925.



**SPI_SETDESKWALLPAPER** used to change the desktop wallpaper



**Now we're done 🤗**

**Don't forget to like and follow 🙂**

**Support me on PayPal 🤗**
https://www.paypal.com/paypalme/amr396
IAs: ¿Capaces de Generar Código?
Tags: programming, productivity, ai
Published: 2023-08-18 17:02:12

Introducción
La Inteligencia Artificial (IA) está revolucionando la forma en que interactuamos con la tecnología en diversos campos. Uno de los ámbitos que ha captado la atención es el desarrollo de software, donde las IAs están demostrando ser capaces de desafiar los límites tradicionales de la programación. En este artículo, exploraremos cómo las IAs pueden contribuir en la generación de código y su impacto en la industria.

Tabla de Contenidos
Automatización Creativa
Optimización de la Eficiencia

Automatización Creativa
Las IAs están redefiniendo la generación de código al ofrecer soluciones rápidas y creativas. Al proporcionar pautas e instrucciones, estas IAs pueden diseñar algoritmos, funciones y módulos completos, permitiendo a los desarrolladores centrarse en conceptos de alto nivel.
Optimización de la Eficiencia
Las herramientas impulsadas por IAs pueden analizar patrones y tendencias en el código existente para optimizar su rendimiento y eficiencia. Esto ayuda a los programadores a identificar áreas de mejora y a adoptar prácticas recomendadas.
Colaboración Global
Las IAs no solo pueden generar código, sino que también fomentan la colaboración entre programadores de todo el mundo. Plataformas colaborativas permiten compartir soluciones y enfoques únicos, enriqueciendo la comunidad de desarrolladores.
IAs como Herramienta
Herramientas como Blackbox se integran con IAs para ofrecer soluciones más completas en la generación de código. Con Blackbox, los desarrolladores pueden experimentar una interacción fluida entre la intuición humana y la potencia de la IA para producir resultados de alta calidad.
Conoce el Mundo de las IAs
A medida que las IAs continúan evolucionando, es esencial comprender cómo pueden transformar la forma en que programamos. Explorar y adoptar estas tecnologías puede ampliar nuestras capacidades, impulsar la innovación y acelerar el desarrollo de software. ¡Lee mis otros artículos para enterarte sobre más!
Programming with an AI
Tags: beginners, programming, ai, productivity
Published: 2023-08-18 16:57:02

Introduction
In today's rapidly evolving technological landscape, the integration of Artificial Intelligence (AI) into various domains has become a transformative force. One such domain that has been significantly impacted is programming. As programmers, we are witnessing the emergence of AI tools that can assist us in coding tasks. In this article, we will explore how programmers can leverage AI to enhance their coding experience and productivity.

Table of Contents
Enhancing Creativity and Efficiency
Optimizing Code Quality

Enhancing Creativity and Efficiency
Traditional coding often involves hours of brainstorming, designing, and debugging. With the aid of AI, programmers can now generate code snippets, algorithms, and even entire functions with a few simple instructions. This not only accelerates the development process but also frees up valuable mental space for creative problem-solving.

Optimizing Code Quality
AI-driven code analysis tools can review and provide insightful suggestions for improving code quality. From identifying potential bugs to optimizing performance, these tools act as virtual code reviewers, ensuring that your code meets best practices and standards.

Collaboration and Knowledge Sharing
AI-powered platforms facilitate collaborative coding by enabling developers to share code snippets, solutions, and insights. As a result, programmers can tap into a global community of experts and learn from diverse coding approaches.

Blackbox Integration
As a complement to AI-driven programming, tools like Blackbox provide a seamless way to generate and optimize code. With its intuitive interface and automated assistance, Blackbox empowers programmers to focus on high-level tasks while the AI handles routine coding.


Embracing AI in programming offers unprecedented opportunities for efficiency, innovation, and collaboration. By incorporating AI tools like Blackbox into your coding workflow, you can unlock new levels of productivity and enhance your programming journey. Keep learning about AI tools with my articles!
Setting Up PHP on Neovim with NvChad
Tags: neovim, php, nvchad, vim
Published: 2023-08-18 16:53:04

* Note: Tested and Worked with NvChad v2.0

## Installing PHP's Language Server: `phpactor`
* While in Neovim's command mode, execute the command `:Mason` to run Mason package manager.
* Inside Mason, search for `phpactor`, an easy way to do that is through the search command "/phpactor".
* Once you find it and the cursor is on its name, press "i" to install it. PHPActor requires [Composer](https://getcomposer.org/), make sure it's available on your system.

## Configuring `phpactor` Properly on NvChad
* After installing `phpactor` you need to edit NvChad's configuration file. The required configuration file will be found on the path `~/.config/nvim/lua/plugins/configs/lspconfig.lua`.
	* Please note that the path of Neovim's configuration directory (which is `~/.config/nvim` by default) may be different in your system, for example, if you installed Neovim through Flatpak, its path will be `~/.var/app/io.neovim.nvim/config/nvim`.
* In "lspconfig.lua" and just before the last line which is "return M" add the following lines to configure `phpactor` and make it run.

```{lang:lua}
require("lspconfig").phpactor.setup {
  root_dir = function(_)
    return vim.loop.cwd()
  end,
  init_options = { 
    ["language_server.diagnostics_on_update"] = false,
    ["language_server.diagnostics_on_open"] = false,
    ["language_server.diagnostics_on_save"] = false,
    ["language_server_phpstan.enabled"] = false,
    ["language_server_psalm.enabled"] = false,
  }
}
```

For some reason, I don't know why and I'm not sure if I'll dedicate time to find why, `phpactor` reported errors inaccurately for me, something like "The function 'foo' is not found" while 'foo' is there in the same PHP file. Due to that I've disabled PHPActor's diagnostics through setting "false" for the options "language_server.diagnostics_on_update", "language_server.diagnostics_on_open" and "language_server.diagnostics_on_save" in the code above. Feel free to enable them if you need and that's done by removing their lines or change "false" to "true" for them.
* Finally, exit Neovim and run it again, try to edit a PHP file and phpactor should run now.