teleren/devto huggingface dataset:
MATLAB: Read video data
Tags: matlab, cheatsheet
Published: 2023-12-09 12:19:41

| - | - |
| --- | --- |
| [VideoReader](https://www.mathworks.com/help/matlab/ref/videoreader.html) | Create an object to read a video file |
| [read](https://www.mathworks.com/help/matlab/ref/videoreader.read.html) | Read one or more video frames |
| [readFrame](https://www.mathworks.com/help/matlab/ref/videoreader.readframe.html) | Read the next video frame |
| [hasFrame](https://www.mathworks.com/help/matlab/ref/videoreader.hasframe.html) | Determine whether there are video frames available for reading |
| [getFileFormats](https://www.mathworks.com/help/matlab/ref/videoreader.getfileformats.html) | File formats supported by `VideoReader` |
| [mmfileinfo](https://www.mathworks.com/help/matlab/ref/mmfileinfo.html) | Information about multimedia files |

> ## Useful links
> - [Create Online cheatsheet](https://simplecheatsheet.com/)
> - [MATLAB Cheatsheet](https://simplecheatsheet.com/matlab)
Why you should never use an UUID as the primary key in SQL Databases
Tags: sql
Published: 2023-12-09 11:48:14



Using a UUID (Universally Unique Identifier) as a primary key in SQL databases has both advantages and disadvantages. While UUIDs offer benefits in certain scenarios, there are reasons why they might not be the best choice for a primary key:

**Indexing and Performance:**
UUIDs are 128 bits long, compared to 32 bits for a typical integer. This larger size can result in increased storage requirements and decreased performance, especially when dealing with large datasets.

Indexes built on UUID columns may not perform as efficiently as those on smaller data types. This is because larger keys can lead to more page reads, impacting query performance.

**Readability and Debugging:**
Unlike integers, UUIDs are not human-readable, which can make debugging and manual inspection of the database more challenging. Integers or other smaller data types may be more convenient for developers and database administrators.

**Clustering:**
UUIDs are designed to be globally unique, but they are not guaranteed to be sequential. This lack of sequential ordering can result in suboptimal disk I/O patterns, affecting the performance of certain types of queries, especially those involving range-based searches.

**Fragmentation**
UUIDs are often generated using a combination of timestamp and random values. This randomness can lead to higher levels of index fragmentation, impacting database performance over time.

**Storage Overhead:**
Storing UUIDs can lead to increased storage requirements, both in terms of disk space and memory. This can be a concern in environments where storage costs are a critical factor.

**Application Complexity:**
Managing UUIDs, especially their generation and uniqueness across distributed systems, can add complexity to the application logic. This complexity may not be necessary if simpler primary key types suffice for the application's requirements.
Team Building Dilemma: Unraveling the Pitfalls of In-House Choices!
Tags: consulting, devops, aws
Published: 2023-12-09 11:05:31

Contemplating the in-house team route? Our comprehensive article is a candid exploration of the cons. Dive deep into insights on in-house team dynamics, time constraints, risk management, and technological limitations that can hinder your business growth. It's time to uncover the potential drawbacks before making crucial decisions. [Learn More](https://www.tasrieit.com/outsourcing-vs-in-house-team)
Zod - TypeScript-first schema declaration and validation library #5
Tags: programming, javascript, typescript, zod
Published: 2023-12-09 11:00:00

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

✨ **Extract a Type from a Parser Object** ✨

We have a function to print our StarWarsPeopleResults to the console:

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

Update the Logging Function:

Using [z.infer](https://zod.dev/?id=type-inference) and passing it typeof _StarWarsPeopleResults_.

This passes in the schema from Zod, and returns a type that properly represents the data.

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

Now, when you hover over the line in VS Code, you can see that data is an object that contains the results.

Making updates to the StarWarsPerson schema will update the data inside the function right away.

This is a great way to use Zod for runtime validation and then getting our type validation from it.

---

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/
I built this postgres logger
Published: 2023-12-09 10:54:59

## Postgres Logger

I used pgAudit to setup [logging](https://rocketgraph.io/logger-demo) on my AWS RDS Postgres instance.

## Disclaimer

I built (Rocketgraph)(https://rocketgraph.io/) which provides a complete backend. That includes Authentication, Hasura console for GraphQL, Postgres DB and serverless functions. So it let's you build web applications in minutes rather than in weeks.

## see it in action

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

## Try it out

### Rocketgraph hosted

You can signup on [Rocketgraph](https://rocketgraph.io) and create a project. The first project is free for 7 days and doesn't require CC.

This spins up a Postgres DB on AWS RDS instance with `pgAudit` configured.

Then, follow these steps to enable `pgAudit`:

Login to your RDS Postgres using `psql` like so:
```
psql postgresql://postgres:password@project-name.xxxxxxx.us-east-2.rds.amazonaws.com:5432/postgres
```

Provided in your [Rocketgraph dashboard](https://rocketgraph.io/)

Create a role:

```
CREATE ROLE rds_pgaudit; 
```

Then set log level:

```
ALTER DATABASE postgres set pgaudit.log="ALL"; 
```

And enable extension:

```
CREATE EXTENSION pgAudit;
```

### self-hosted

To use `pgAudit` on your own Postgres instance, I wrote a detailed article here to setup: https://blog.rocketgraph.io/posts/install-pgaudit


Rocketgraph is open-source. Don't forget to star us here: https://github.com/RocketsGraphQL/rgraph
"Optimizing Email Workflows: From Ethereal Testing to Production Perfection"
Tags: dotnet, email, webdev, testing
Published: 2023-12-09 10:52:11

Sending automated emails is a fundamental feature in modern software development. However, sharing the credentials of your official Google Account during the development phase might not be the wisest choice. Enter Ethereal Email, a game-changer in the world of test email servers.

**[Ethereal](https://ethereal.email/)** is a faux SMTP service, designed primarily for Nodemailer and EmailEngine users, though its applications are not limited to these. This free, anti-transactional email service ensures messages never reach their intended destination, making it ideal for development.

Having utilized Ethereal Email for over two years, I can attest to its flawless performance, especially in collaborative team environments. It seamlessly handles monkey testing scenarios, allowing you to use any dummy email as a receiver and view the messages sent in the Ethereal Email message section.

Now, when it comes to production, the initial inclination might be to provide actual credentials for your official Gmail account. However, thanks to positive changes from Google, this is no longer necessary. A few tweaks to the settings, and you'll receive a random password to use for your project services.

While crafting this post, I stumbled upon [this guide](https://shahedbd.medium.com/how-to-setup-gmail-smtp-in-asp-net-b79bf18afe4a), which presents a straightforward procedure for configuring your Google account as an email sender.

In summary, I employ Ethereal Email as my go-to test mail server during development. I'd love to hear about your preferences and strategies for managing development and production email systems.

That's all for now. Until next time!
Green Mandala Bedsheets with pillow covers
Tags: bedsheets, homedecor, theartboxstore, business
Published: 2023-12-09 10:46:27

Designed with uncompromising quality and attention to detail, our Mandala Cotton Bedsheets will be sure to impress even the most discerning eye. Step into a world of luxury with bedsheets that not only beautify but also inspire.

Find your perfect match today and feel the transformative power of our Mandala Cotton Bedsheets in every corner of your home. Embrace the beauty that awaits you!

Visit Now:- [**Green Mandala Bedsheets with pillow covers**](https://theartboxstore.com/products/green-mandala-bedsheets-with-pillow-covers)
Prompt Chaining with AiConfig
Tags: ai, promptengineering, opensource
Published: 2023-12-09 10:28:07

## Introduction

In this blog post, you will be guided with the prompt chaining techniques with the real-world example. AiConfig will be utilized for this purpose. First, let us try to understand what AiConfig is all about, then we can deep dive in to the prompt chaining.

AiConfig is an easy-to-use configuration driven application development framework. The beauty of AiConfig is, it's a JSON based config. There are various ways of creating the config, including the programmatic capabilities. 

I would highly recommend you to start using the [LastMileAI](https://lastmileai.dev/) workbooks for building the prompt based apps. Download the AiConfig and then start playing with it. Finetune as per your requirements and design or develop an API to serve the prompt based AI Apps.

## Prompt Chaining

Let me take you to the world of prompt chaining with a real-world example of "NYC Trip Planner". This one is an extended code sample based on the original code from AiConfig Python repo. The idea of prompt chaining is to execute a series of prompts, with the output of one prompt will be fed to the next one. 

Here's the plan. At high-level, we are going to have a two-step based prompt instruction for performing the NYC Trip Planner. We are going to plan our trip and return the response in JSON, so you could utilize this approach for building an API/Service.

1. Tell me 5 fun attractions to do in NYC.
2. Generate an itinerary and pricing information ordered by geographic location for these activities: `{{get_activities.output}}`. Return the response in JSON format.

You need to do the following steps and tweak the prompts based on your requirements.

1. Download [travel.aiconfig.json](https://github.com/lastmile-ai/aiconfig/tree/main/python)
2. Login to [LastMileAI](https://lastmileai.dev/)
3. Navigate to the Workbooks and then do the following to upload the aiconfig file.

![AiConfigCreate](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mjqxmep44hw9zop7tpt5.png) 

Once the config is loaded, you will be seeing two chained prompts or instructions. As discussed, the first one is for fetching the fun attractions to do in NYC. The workbook prompt cell is named with get_activities, we are going to use that cell as a reference in the next prompt which is basically responsible for producing the itinerary and pricing information order by the geolocation. Also, we are going to return the response in JSON.

![NYCTripPlanner](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ozrg91vlouensud0dcgq.png)

![TripPlannerResponse](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o19c3s85536k4rs5l8rp.png)

## Reference
[AiConfig Web](https://aiconfig.lastmileai.dev/)
[AiConfig Open Source](https://github.com/lastmile-ai/aiconfig/tree/main)

## Conclusion

Hope you had a lot of fun with the AiConfig, Prompt chaining and using the [LastMileAI](https://lastmileai.dev/) workbook. Creativity or imagination is the limit. You can potentially create or build any useful AI based apps or service in a matter of minutes.
Mindbel
Published: 2023-12-09 10:18:44

Mindbel Training is an innovative Edtech company dedicated to providing high-quality training programs that help individuals and organizations unlock their full potential. With a focus on developing the skills and knowledge necessary to thrive in today's rapidly changing business environment, Mindbel Training offers a wide range of courses and training programs that cater to learners of all levels and backgrounds.
[IIS 8.5 Certification Training](https://mindbel.com/)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jst3hmc1sj2twqvn9s02.png)
Open Doors to Opportunities: Attest Your Certificates for Jobs, Education & More (UAE Wide)
Tags: business, legal, services
Published: 2023-12-09 10:12:33


Prime Global Attestation is the most reliable attestation company all across the UAE. We offer Certificate Attestation and Apostille services to countries like the US, UK, Germany, and Canada India, Pakistan, and 140+ countries with a hassle-free process and a minimum document requirement. We believe in the mantra of having the best customer satisfaction and served more than 10,500 clients all across the Universe

Our services include Marriage certificate attestation, Birth certificate attestation, educational attestation, transfer certificates, medical certificates, police clearance certificates, etc.

Our experts will help you get the certificate attestation effortlessly.

For any query, call us now!
contact our support team 0569986516
our website: https://www.attestglobal.com 

Visit our head office: 105 Al Rai St., Mohamed Bin Zayed City, ME-11, Abu Dhabi, UAE

You can visit our Branch office: W-14, 15th Floor, Al Musalla office Tower, Khalid Bin Waleed Road, Bur Dubai, UAE

For more information, [Attestation services in Abu Dhabi](https://www.attestglobal.com), [Attestation services in Dubai](https://www.attestglobal.com/location/attestation-services-in-dubai),  [Certificate attestation in Dubai](https://www.attestglobal.com/location), [attestation services in Sharjah](https://www.attestglobal.com/location/attestation-services-in-sharjah), and [Certificate attestation in UAE
](https://www.attestglobaldubai.com)
What you learning about this weekend? 🧠
Tags: codenewbie, discuss, learning, beginners
Published: 2023-12-09 10:00:00

Hey hey 👋

What are you learning on this weekend?

Whether you're sharpening your [JS](https://dev.to/t/javascript) skills, making PRs to [your OSS repo of choice](https://github.com/forem/forem) 😉, sprucing up your portfolio, or [writing a new post](https://dev.to/new) here on DEV, we'd like to hear about it.

Have an awesome weekend! Learn, take breaks, and have fun.

![A clip from Schitt's Creek... a woman says "You learn something new every day" with a smug grin and then winks at whoever she is talking to.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xnk3q4huvskxebvm2f3i.gif)
Round neck tshirt for men
Tags: shopping, online, career, design
Published: 2023-12-09 09:57:44

When on the hunt for the perfect round neck t-shirt for men, look no further than [Comfimerchi](https://www.comfimerchi.com/). Renowned for its commitment to comfort and style, Comfimerchi offers a diverse range of round neck t-shirts that seamlessly blend fashion with functionality. 
Whether you're seeking a casual staple for everyday wear or a versatile piece that can be dressed up for various occasions, Comfimerc
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/99p02fmfsp83rpngnuyu.jpg)hi's collection is designed to meet your needs. Crafted with attention to detail and using high-quality materials, these t-shirts prioritize both comfort and durability. Elevate your wardrobe with Comfimerchi's round neck t-shirts, where each piece embodies a perfect synthesis of comfort, style, and enduring quality.
Advent of Code 2023 - December 9th
Tags: advent, adventofcode, python, december
Published: 2023-12-09 09:47:35

---
title: Advent of Code 2023 - December 9th
published: true
description: My progress with the 2023 version of Advent of Code
tags: advent, adventofcode, python, december
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/36qayk14ewje7rvykeg5.jpg
series: Advent of Code 2023
# published_at: 2023-12-01 17:41 +0000
---

In this series, I'll share my progress with the 2023 version of [Advent of Code](https://adventofcode.com/2023).

Check the first post for a short intro to this series.

You can also follow my progress [on GitHub](https://github.com/robvanderleek/adventofcode).

## December 9th

[The puzzle of day 9](https://adventofcode.com/2023/day/9) was a breeze (which I needed a bit, to be honest).

__My pitfall for this puzzle:__ I was afraid recursion would not cut it for this puzzle, but in the end it did and it made the code very straightforward and very concise (only 32 lines).

{% spoiler Solution here, do not click if you want to solve the puzzle first yourself %}

```python
#!/usr/bin/env python3

with open('input.txt') as infile:
    lines = infile.readlines()
 
histories = []
for line in lines:
    history = [int(n) for n in line.strip().split(' ')]
    histories.append(history)

def next_value(history):
    if len([n for n in history if n == 0]) == len(history):
        return 0
    else:
        next_history = []
        for idx, n in enumerate(history):
            if idx <= len(history) - 2:
                next_history.append(history[idx + 1] - n)
        return history[-1] + next_value(next_history)

def previous_value(history):
    if len([n for n in history if n == 0]) == len(history):
        return 0
    else:
        next_history = []
        for idx, n in enumerate(history):
            if idx <= len(history) - 2:
                next_history.append(history[idx + 1] - n)
        return history[0] - previous_value(next_history)

print(sum([next_value(h) for h in histories]))
print(sum([previous_value(h) for h in histories]))
```

{% endspoiler %}

That's it! See you again tomorrow!
Useful Javascript ES6 nuggets
Tags: webdev, javascript, programming, beginners
Published: 2023-12-09 09:34:28

Important points I noted while  revising Javascript ES6:

:> Adding external script to webpage:
```
<script type="module" src="index.js"></script>
```

:> Exporting function to Share a Code Block:
```
export const add = (x, y) => {
  return x + y;
}
```
*Export multiple things by repeating for each export.

:> Reusing JavaScript Code Using import:
```
import { add, subtract } from './math_functions.js';
```
*Here ./ tells the import to look for the math_functions.js file in the same folder as the current file.

:> Import Everything from a File and use specific functions:
```
import * as myMathModule from "./math_functions.js";
myMathModule.add(2,3);
myMathModule.subtract(5,3);
```

:> For default export functions, while importing, no need to add braces {}, and name can be anything, not compulsorily the name of the function.

:> Promise: task completes, you either fulfill your promise or fail to do so, with two parameters - resolve and reject, to determine the outcome of the promise. Syntax:
```
const myPromise = new Promise((resolve, reject) => {
  if(condition here) {
    resolve("Promise was fulfilled");
  } else {
    reject("Promise was rejected");
  }
});
```

:> When you make a server request it takes some amount of time, and after it completes you usually want to do something with the response from the server. The then method is executed immediately after your promise is fulfilled with resolve, eg:
```
myPromise.then(result => {});
```

:> Catch can be executed if after a promise's reject method is called:
```
myPromise.catch(error => {});
```
Offshore Business Setup in Dubai
Published: 2023-12-09 09:17:02

Embark on a strategic journey to initiate your [Offshore Business Setup in Dubai](https://bespokestrategysolution.com/offshore-company-setup/) with Bespoke Strategy Solutions. Our seasoned team specializes in facilitating a seamless offshore business setup process, adept at navigating regulations and optimizing efficiency for your successful venture in Dubai. From meticulous Offshore Business Setup documentation to strategic planning, trust us to pave the way for your offshore business success in Dubai. Experience personalized and expert guidance in Offshore Business Setup with Bespoke Strategy Solutions, unlocking the vast opportunities Dubai offers for your global business expansion.
Alentris Research Private Limited
Published: 2023-12-09 09:13:01

At **[Alentris Research Private Limited](https://alentris.org)**, we have been providing specialized solutions for pharmaceutical impurities since our founding in 2019. As a leading Impurity Standard Manufacturer and API Impurity Supplier and Manufacturer, we offer Pharmaceutical Reference Standards, Custom Synthesis of Pharmaceutical Standards, and Non-Pharmacopeial Reference Standards.

With expertise in Impurity Research, our scientific team specializes in the custom Synthesis of Impurity standards including Nitrosamines Impurities, Oncology Impurities, and Peptide Impurities. We are dedicated to supporting pharmaceutical companies through expert **[Impurity services](https://alentris.org/services/)** for drug development, quality control, and regulatory compliance. **[Contact us](https://alentris.org/contact/)** to learn more about our capabilities in impurity management.
From Failure to Reinvention: My Entrepreneuria Journey
Tags: learning
Published: 2023-12-09 09:08:10

Launching your first Micro SaaS means plunging into the unknown with the hope of creating something extraordinary. My dream: a tool that generates images on the fly from structured data. However, reality reminded me of a crucial lesson: proof of concept. Blinded by enthusiasm, I neglected this crucial step. The failure, although bitter, taught me the need to understand the needs of the market before building. This project is now tucked away in a drawer, but I'll always be proud of it and keep it as a [war trophy](https://content-ld.mathieu-cadu.com).

On the strength of this experience, a [new opportunity emerged](https://changelogit.com), shaped by the daily challenges of my full-time job. It was clear that there was a persistent gap between the technical and non-technical teams during release notes. All too often, communicators struggle to translate technical advances into terms that are understandable to the uninitiated. This discrepancy is detrimental to the promotion of the project and can even hinder its success. So the new entrepreneurial project was born out of the need to build a bridge between these two worlds. My ambition is to simplify release notes, to make every technical achievement accessible and understandable to everyone.

Because I firmly believe that transparency and mutual understanding are the pillars of a successful project.This journey, from initial setback to reinvention, symbolises my resilience and my commitment to continuous learning. It's an adventure where every challenge is an opportunity to evolve, create and contribute in a meaningful way. Stay tuned to follow this ever-evolving entrepreneurial story!
Branding Agency in Qatar
Published: 2023-12-09 08:49:49

Ignite your brand's identity with Aura Qatar, a leading [branding agency in Qatar](https://auraqatar.com/services/branding/
). Our creative prowess and strategic insights converge to shape distinctive brand experiences. From captivating logos to comprehensive brand strategies, we cultivate memorable narratives that resonate. Elevate your brand presence with Aura Qatar, where innovation meets identity, setting the stage for your unparalleled success in the competitive market landscape.