teleren/devto huggingface dataset:
Loops in C programming
Tags: programming, loops, beginners, learning
Published: 2023-12-16 17:05:15

In C programming there are 3 types of loop and they are while loop, for loop and do while loop.

## While loop
In while loop the body is executed until the test condition become false.
Syntax:
```
while (conditiuon){
    //statement inside while.
}
```
Example:
```
#include <stdio.h>
int main() {
    int count = 1;
    
    while (count < 5){
        printf("While loop in c\n");
        count = count + 1;
    }

    return 0;
}
```

Multiplication table using while loop:
```
#include <stdio.h>

int main() {
    int number;
    printf("Enter the number: ");
    scanf("%d", &number);
    
    int count = 1;
    while(count <= 10){
        int product = number * count;
        printf("%d x %d = %d \n", count, number, product);
        count = count + 1;
    }
    return 0;
}
```
---
## do while loop
Here the body of the loop is executed and then the condition is evaluated, if the condition is true the body of the loop is executed again.
syntax:
```
do {
  //body of loop
  } while(condition);
```
Example:
```
int main(){
    
    int count = 5;
    
    do{
        printf("%d\n", count);
        count = count + 1;
    } while(count < 5);
    return 0;
}
```
---
## for loop
Syntax:
```
for(initializationExpression; testExpression; updateExpression){
//codee inside for loop.
}
```
Example:
```
int main() {
    
    for(int i=0; i<10; i++){
        printf("%d ", i);
    }
    return 0;
}
```
Sum of whole numbers from 1 to 100:
```
int main() {
    int sum=0;
    
    for(int i=1; i<=100; i++){
        sum=sum+i;
        
    }
    printf("%d", sum);
    return 0;
}
```
Sum of even numbers:
```
int main() {
    int sum=0;
    
    for(int i=2; i<=100; i=i+2){
        sum=sum+i;
    }
    
    printf("%d", sum);
    return 0;
}
```
open re: playtest! playtest! playtest!
Tags: gamedev, writing
Published: 2023-12-24 16:20:52

---
title: open re: playtest! playtest! playtest!
published: true
date: 2023-11-24 00:00:00 UTC
tags: [ 'gamedev', 'writing' ]
canonical_url: https://onwriting.games/daily/20231124-1046-open-re-playtest-playtest-playtest/
---

Fellow list member Kamran Ayub (who maintains and works on [Excalibur.js](https://excaliburjs.com/) and runs [Keep Track of My Games](https://keeptrackofmygames.com/)) shared an interesting thought about yesterday's email:

> One thing it seems like narrative games would benefit from playtesting is for inclusivity. Your game could be played from all types of people from different cultures different to yours, so you may unintentionally introduce language or elements that don't land how you intended.

This.

**So. Much. This.**

Inclusion should be a **priority for us**.

It is practically impossible to have a complete view of where we are being non-inclusive.

At least not without **many years** of experience in the subject.

Clearly, playtesting is a good tool to **identify inclusivity issues**.

I'm not going to delve into the ramble of cultural Marxism, what matters to me is making the world accessible and inclusive, which is why I was excited about the response.

Although Kamran is focusing on content issues (e.g., whether a word or another might be offensive, etc.), I believe this is also true in **matters of form**.

For instance, a children's book has less text than a book for adults.

This is true in video games as well, **the length of the texts is greatly reduced** , we will talk about this in an upcoming email.

And not to mention those of us with ADHD.

There are games I cannot play because of the amount of information that needs to be managed at the same time without getting distracted.

This speaks to the importance of playtesting with a **variety of players**.

It's clear that this extends to all types of playtesting, not just narrative, but it's good to emphasize it.

Thank you, Kamran, for your comment!

Question:

Do you know any games that would have benefited from having done narrative playtesting on something in particular? Why do you think that?
frustrating results
Tags: gamedev, writing
Published: 2023-12-24 16:21:19

---
title: frustrating results
published: true
date: 2023-12-01 00:00:00 UTC
tags: [ 'gamedev', 'writing' ]
canonical_url: https://onwriting.games/daily/20231201-2349-frustrating-results/
---

Something's been on my mind lately, summarizing some of the things we've been talking about:

When writing narrative games, we have a unique opportunity to **explore the intricacies of the real world**.

We can work complex moral and ethical dilemmas into our stories, we can create experiences that are thought-provoking and reflective of the nuanced world we live in. Or not.

For instance, think about the tough choices some people face in resource allocation in real life, like in healthcare or during a natural disaster.

That's something we don't experience daily, unless we work on those areas, and many people might find that interesting.

Many video games default to violence as the primary conflict.

It's the easiest thing to do, obviously.

Two opposing sides, war, and that's enough.

Many of us are tired of this and are looking for different ways of interpreting conflict.

The selection of options opens the possibility of generating a type of conflict that does not exist in linear media, but is very strong in human experience.

And I'm not referring so much to **moral dilemmas** , which are great to explore.

I'm referring more to the conflict that arises between making a decision and the outcome that follows.

This is slightly related to Brian Upton's concept of the horizon of intention and horizon of action.

The intention that the player has when choosing an option, and the action (or result) can be different, and a great source of conflict.

Obviously, we need to be careful and subtle with this, it's not about removing the player's agency, but about exploring the frustration that things turn out to be more complex than one imagines as a design goal.

Have you played any games that perform this? I think I have not, but I'd love to...
Eager loading vs lazy loading
Tags: javascript, node, programming, webdev
Published: 2023-12-18 03:39:56

Basically, do you know when you need to study for a test? You don't have much time: eager loading. Whatever you see in your sight is pretty much enough for you to have. But if you need to study a specific thing: lazy loading. That's when you have time to study specific concepts. Therefore, specific results.

Let's have another example with other things like our solar system.

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

Inquiring one about our solar system will get us a general answer. Let's name this concept as macroquery. We have informations about other planets (enough to know what they're made of, for example).

Let's say we want now to get more information on mars. Let's call this inquiry microquery. Mars has its specific details such as earth.

When we want to get from a query nothing in particular: eager loading (macroquery). When we want specifics: lazy loading (microquery).

Think about atoms and how they were discovered pretty much after stars. In terms of mass, both are completely different however, they share the same matter.

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

Doesn't it look like a planet with its moons?

Let's talk a bit more about space and get the difference between being on a planet, watch it through a telescope and look up to the sky.

We have more informations now in Mars than before, due to exploration technologies. We can call this action towards knowledge from mankind as microquery. We want to know now details of mars.

Image you wake up in a remote period of ancient time, where all you can do to know about space is to look up. To see little stars with different colors or constellations will give you coordinates or some kind of information such as: the north star, if you're on a western or eastern part of earth, etc. We'll call it macroquery. We have little to work on, and much to do if we want specifics.

Now imagine you woke up with Copernicus looking to the stars through a telescope. You could see with your own eyes his studies to get to our general answer today: the sun does not rotate around earth.

Is this micro or macroquery? The answer for us is: _it depends._

If you need specific data from your database: lazy loading. Remember microquery. Else, use eager loading and remember macroquery.
Modern GL + Google Colab = triangle animation
Tags: moderngl, colab, python
Published: 2023-12-18 16:54:50

Rendered not in my PC image:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/du0g30ahrv2x5vgqizo1.gif)
*i mean not this gif here in your browser but in colab cloud?

Link to colab: 
https://colab.research.google.com/drive/10Ig1Nqbwqd1lF7HAF0rJuxpZpThgjHcB?usp=sharing

This notebook restored from old(2018) google notebook, with some changes in code. Links to references in comments of the notebook.

```
!pip install moderngl
!pip install moviepy
import moderngl as gl
import numpy as np
from PIL import Image
import moviepy.editor as mpy

ctx = gl.create_context(standalone=True, backend='egl')
print(ctx.info)
```
```
prog = ctx.program(
    vertex_shader="""
        #version 330
        in vec2 in_vert;
        in vec3 in_color;
        out vec3 v_color;
        void main() {
            v_color = in_color;
            gl_Position = vec4(in_vert, 0.0, 1.0);
        }
    """,
    fragment_shader="""
        #version 330
        in vec3 v_color;
        out vec3 f_color;
        void main() {
            f_color = v_color;
        }
    """,
)

vertices = np.asarray([

    -0.75, -0.75,  1, 0, 0,
    0.75, -0.75,  0, 1, 0,
    0.0, 0.649,  0, 0, 1

], dtype='f4')
```
```
def render_frame(time):
  vbo = ctx.buffer(vertices.tobytes())
  vao = ctx.vertex_array(prog, vbo, "in_vert", "in_color")

  fbo = ctx.framebuffer(
    color_attachments=[ctx.texture((512, 512), 3)]
  )
  fbo.use()
  fbo.clear(0.0+time, 0.0+time, 0.0+time, 1.0)
  vao.render()

  return np.array(Image.frombytes(
    "RGB", fbo.size, fbo.color_attachments[0].read(),
    "raw", "RGB", 0, -1
  ))
```
```
clip = mpy.VideoClip(render_frame, duration=2) # 2 seconds
clip.write_gif("anim.gif",fps=15)
#now in files anim.gif
```
---

_May the new year bless you with health, wealth, and happiness._
from "65 Happy New Year Wishes for Friends and Family 2024" countryliving article
Schedule regular Security Audits
Tags: development, scheduledtasks, security, v433
Published: 2023-12-19 10:21:00

---
title: Schedule regular Security Audits
published: true
date: 2023-04-17 19:23:39 UTC
tags: Development,scheduledtasks,security,v433
canonical_url: https://mid.as/blog/schedule-regular-security-audits/
---

You may not know, but MIDAS includes a built-in “Security Audit” tool.

This allows you to perform a quick and on-demand security analysis of your MIDAS system.

![Perform a detailed Security Audit of your MIDAS room booking system](https://mid.as/blog/wp-content/uploads/2023/04/midas-security-audit.png)
_Perform a detailed Security Audit of your MIDAS room booking system_

[First introduced with the release of MIDAS v4.13 in 2016](https://mid.as/blog/security-enhancements-in-v4-13/), the “Security Audit” tool tests a number of key metrics of your MIDAS booking system.

The audit checks your MySQL / MariaDB setup, MIDAS files, and recommended MIDAS security settings.

It provides a detailed report with appropriate advisories for hardening the security of your MIDAS system.

When the Security Audit was first introduced, it analyzed 15 metrics. Today, that number has increased to over 20.

For MIDAS v4.33, the audit now additionally also…

- Indicates the number of recently failed login attempts to your MIDAS system.
- Checks whether [Geofenced logins](https://mid.as/blog/geolocation-and-geofencing/) have been enabled.

But the biggest improvement to Security Audits for MIDAS v4.33 is the ability to schedule regular automated security audits.

Until now, a Security Audit could only be manually initiated (via MIDAS Admin Options → Manage MIDAS → Security → Perform a Security Audit)

From MIDAS v4.33, you can now use [Scheduled Tasks](https://mid.as/help/manage-scheduled-tasks) to automatically run a Security Audit and email you the results. Audits can be configured to run every 7, 14, 30, 60, or 90 days.

![Schedule automated security audits of your MIDAS booking system](https://mid.as/blog/wp-content/uploads/2023/04/scheduled-security-audit.png)
_Schedule automated security audits of your MIDAS booking system_

The post [Schedule regular Security Audits](https://mid.as/blog/schedule-regular-security-audits/) appeared first on [MIDAS - Room Booking System | Blog](https://mid.as/blog).
Blackjack Terminal Game
Tags: codecademy, beginners, codenewbie
Published: 2023-12-19 22:00:46

#### This is my game for a portfolio project on a Computer Science course at Codecademy. I would be very grateful if you reviewed the it and left a feedback on what I could improve :D

#### https://github.com/mat-pluta99/Blackjack

### What were the goals of the project?
The first goal of the project was create a simple basic program for me and friends or family to play with. I decided to create a Blackjack game, since I'd spend too much time on the Strip in Fallout: New Vegas.

The last goal was to create a blog post about the project. So here I am, creating a first blog post on DEV :D

### Lady Luck
I've managed to create a Blackjack game for 1-5 players. You can play alone or gather friends and try your luck in this classic card game. If you earn enough chips and quit before your luck runs out, your score will be saved in the Top 10 leaderboard.
The 'Serendipity Effect' of Brainstory
Tags: psychology, questioning, culture
Published: 2023-12-20 00:14:46

---
title: The 'Serendipity Effect' of Brainstory
published: true
date: 2023-12-19 00:00:00 UTC
tags: psychology, questioning, culture
canonical_url: https://blog.brainstory.ai/blog/brainstory-serendipity-effect/
---

A first time Brainstory user shared this story in our [community Discord](https://brainstory.ai/discord).

> I originally was going in the direction of trying to give myself criteria to make my movie ratings more objective, but it turned into me [talking] about what makes a movie important to me and helped me visualize that for my ratings instead. First time using Brainstory, I like how it pulled me from my first line of thinking (making an objective scale) to a different train of thought (Making me defend and elaborate on my categories of subjective ranking) very seamlessly, very cool!

Let’s talk about what this experience is and why!

## What does Brainstory _do_?

Brainstory asks you **questions**. It does not give advice or suggestions. While you’re talking, it may seem like Brainstory is “pulling” you into a different train of thought, but that’s actually _you_ pulling yourself into a different direction. All Brainstory does is ask you questions about your thinking.

## Why did we make Brainstory ask questions?

Asking questions is good, but there’s a lot of reasons humans don’t want to ask other humans questions. Maybe you feel like you’re wasting someone’s time, or you think the question is too sensitive. [Research](https://www.sciencedirect.com/science/article/abs/pii/S0749597820304003) has shown that the benefits of asking questions outweighs the perceived consequences, but tell that to your emotions!

That’s why we made Brainstory— to be a safe place where you can always have your best thoughts.

## Are you reading this in December of 2023?

Join our [giveaway](https://brainstory.ai/giveaway) and win awesome cash prizes! See you in the Discord!
Beginner's TypeScript #6
Tags: programming, beginners, javascript, typescript
Published: 2023-12-23 15:00:00

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

⭐ **Constraining Value Types** ⭐

We have a **User** interface below:

```ts
interface User {
  id: number;
  firstName: string;
  lastName: string;
  role: string;
}
```

We would not want to use a **freeform string**, because a User could have only a set number of roles: **admin**, **user**, or **super-admin**.

Consider this **defaultUser**:

```ts
export const defaultUser: User = {
  id: 1,
  firstName: "Uri",
  lastName: "Pilot",
  role: "I_SHOULD_NOT_BE_ALLOWED",
}
```

It is being defined with a role that is not one of our options.

We will update the **User interface** to restrict the role property to one of the set options.

The **I_SHOULD_NOT_BE_ALLOWED** role should cause an error.

👉 **Solution:**

The solution is to update **role** to be a [Union type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types).

The syntax uses **|** to delineate the options for which values a key can be:

```ts
interface User {
  id: number;
  firstName: string;
  lastName: string;
  role: "admin" | "user" | "super-admin";
}
```

✍️ **About Union Types:**

Anything can be added to a union type. For example, we can make a new **SuperAdmin** type and add it to the role:

```ts
type SuperAdmin = "super-admin"

interface User {
  // ...other stuff
  role: "admin" | "user" | SuperAdmin;
}
```

Union types are everywhere within TypeScript. They give our code safety and allow us to be really sure of the types of data flowing through our app.

---

I hope you found it useful. Thanks for reading. 🙏
Let's get connected! You can find me on:
- **Medium:** https://medium.com/@nhannguyendevjs/
- **Dev**: https://dev.to/nhannguyendevjs/
- **Hashnode**: [https://nhannguyen.hashnode.dev](https://nhannguyen.hashnode.dev/)/
- **Linkedin:** https://www.linkedin.com/in/nhannguyendevjs/
- **X (formerly Twitter)**: https://twitter.com/nhannguyendevjs/
Wednesday Links - Edition 2023-12-20
Tags: java, jvm, cloud, architecture
Published: 2023-12-20 11:50:08

The Big Cloud Exit FAQ (10 min)☁️
https://world.hey.com/dhh/the-big-cloud-exit-faq-20274010

Compact Java Bean validation (30 sec)🫘
https://twitter.com/NiestrojRobert/status/1736662080231727346

Tracking Java Native Memory With JDK Flight Recorder (6 min)✈️
https://www.morling.dev/blog/tracking-java-native-memory-with-jdk-flight-recorder/

Announcing jox: Fast and Scalable Channels in Java (5 min)🎚️
https://softwaremill.com/announcing-jox-fast-and-scalable-channels-in-java/

archUnit Spring 0.2.0 released (1 min)🏛️
https://github.com/rweisleder/archunit-spring/releases/tag/v0.2.0
Day 6 - The 12 Days of DEV: June 2023
Tags: bestofdev, devimpact2023
Published: 2023-12-25 08:00:00

_Greetings on Day 6 of "The 12 Days of DEV"! 🎄🎉  As we approach the year's end, let's journey through the top two articles of June 2023._

_This compilation showcases the community's favorites, determined by a mix of comments, reactions, and page views (with just a very subtle touch of editorial curation). And while these articles shine as the most popular, it's worth noting that they vary from the DEV team's chosen Weekly Top 7 (though there might be some shared gems.) 🌟_

---

{% embed https://dev.to/aralroca/say-goodbye-to-spread-operator-use-default-composer-3c2j %}
A game-changer in JavaScript object manipulation. [@aralroca](https://dev.to/aralroca) instructs how the "default-composer" library, at just ~300B, simplifies setting default values for nested objects. Say goodbye to the complexity of spread operators and Object.assign(). Dive into cleaner, more maintainable code and explore the possibilities

---

{% embed https://dev.to/shnai0/how-i-build-my-first-open-source-project-with-chatgpt-and-nextjs-10k-users-in-24-hours-2m7n %}
[@shnai0](https://dev.to/shnai0) conquered coding challenges in their debut Open Source project using ChatGPT and Next.js. With 10k users in just 24 hours, the LinkedIn Post Generator became a viral sensation. Revisit the details of their process, from initial setup to navigating open source projects, and learn more about code comprehension with ChatGPT.

---

_Stay tuned for the next installment of "The 12 Days of DEV" as we continue to unwrap the community's favorite articles. Happy reading, and we look forward to sharing more highlights with you! 📚🎁_
PRmovies APK 2023 Latest v2.5 (NO ADs) For Android Free
Tags: webdev
Published: 2023-12-21 19:39:29

Introduction to PRmovies APK
PRmovies APK
There are many movie downloading options on the market. But the majority of them have some sort of security or content restriction. This completely ruins the experience. However, it would be completely safe to say that PRMovies Apk is a solution to all your content problems.

This application allows you to enjoy endless content on one platform. It was developed by WPRMovies for all Android setups 4.0 or above. The good thing about this application is that it gives you unlimited access to the latest movies, TV channels, shows, and series in multiple national and regional languages.

In addition, it allows you to download your favorite content, even when there is no internet connection. Similarly, the application is tested for malware and viruses, so there is no danger to your security. And you are not bothered by unnecessary ads and glitches.

Finally, I want to know more about this fun application. Give this guide a quick read and check out how you can download it on your mobile phone. So, let’s get in.https://apkmolo.com/prmovies-apk/


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p97ssw84z8ejdw6ysve9.png)
Best PostgreSQL Tool - pgAdmin or dbForge Studio for PostgreSQL?
Tags: postgres, database
Published: 2023-12-22 08:30:47

Explore dbForge Studio for PostgreSQL: A Superior Alternative to pgAdmin.

In this detailed tutorial, we dive into the advanced features of dbForge Studio for PostgreSQL, showcasing its enhanced capabilities in SQL coding, query optimization, data editing, database comparison, and more. Discover how it stands out against pgAdmin and learn about unique tools like Data Generator. Perfect for both beginners and professionals in database management.

Tap the link to watch in full: https://youtu.be/V7mYZJOexRQ?si=NzTLdT1i6BW3tIUb
Run MySQL and phpMyAdmin with Docker for Database Management!
Published: 2023-12-23 12:46:24

To run MySQL and phpMyAdmin containers with Docker and connect them, you can follow these steps:

## Step 1- Install Docker

Make sure you have Docker installed on your machine. You can download and install Docker from the official website: https://www.docker.com/. 

## Step 2- Create a Docker Network

Create a Docker network to allow the containers to communicate with each other. This step is optional but helps in connecting containers easily.

``` bash
docker network create mynetwork
```


## Step 3- Run MySQL Container

Run a MySQL container with the desired configuration. Replace `<password>` with your preferred MySQL password.


```
docker run -d - name mysql-container - network=mynetwork -e MYSQL_ROOT_PASSWORD=<password> -p 3306:3306 mysql:latest
```




## Step 4- Run phpMyAdmin Container

Run a phpMyAdmin container and link it to the MySQL container. Replace `<password>` with the MySQL password you set in **Step 3**.

``` bash
docker run -d - name phpmyadmin-container - network=mynetwork -e PMA_HOST=mysql-container -e PMA_PORT=3306 -p 8080:80 phpmyadmin/phpmyadmin:latest

```

## Step 5- Access phpMyAdmin

Open your browser and navigate to http://localhost:8080. Log in with the MySQL credentials you provided earlier.

Notes:
- Make sure to replace <password> with a secure password of your choice.
- You can choose different ports for MySQL and phpMyAdmin if needed.
- The — network flag is used to connect containers to the same network, enabling them to communicate with each other using container names.
- Ensure that the MySQL container is running before starting the phpMyAdmin container.

By following these steps, you should have a running MySQL container and a phpMyAdmin container connected to it. You can manage your MySQL databases using phpMyAdmin through the web interface.