teleren/devto huggingface dataset:
I once built a open source project like Google Trends
Tags: nextjs, showdev, javascript, opensource
Published: 2023-07-27 08:06:11

{% embed https://youtu.be/r28vX4bQKks %}

## What are the features that make it unique ? How is it compared to existing products ?
There’s nothing inherently unique about this project, given that I borrowed a huge deal of inspiration from Google Trends, ProductHunt and DEV to some extent.

In detail, I’d say it’s a combination of the leaderboard from Google Trends and upvoting scheme in ProductHunt. I'd say that mods are able to filter out bad poll submissions and trending items just like in DEV.

As for how it really works, the business logic of the app is as follows: 
- Anyone can see the trending leaderboard and nomination poll for movies and games for each country but cannot cast votes
- A registered user can cast votes in the leaderboard but cannot cast vote for nomination polls unless they are from the country of the poll. 
- A moderator has all the privileges of a normal user, plus the ability to remove inappropriate content from the polls and leaderboards ( still in the works ) 

## May I know how this is built ? 
I start building this project around the onset of COVID-19 ( circa spring of 2020 ). It was built primarily in the first 4 months where I learned to fit the business logic of the project with Next.js and Tailwind CSS.

I remember myself making React polls for the first time and doing all sorts of CRUD operations with MongoDB/Mongoose.

About authentication, I record hashed passwords in the DB and compare the input password with it. Then my cookies will record the JWT token of the account info once they are signed in. 

## How did you test your site ? And are there still bugs on your site ?
As far I as know, console logs are the most reliable way to get feedback from Next.js, but I'm curious to know how e2e testing tools like Cypress makes the project better.

ATM there aren't any majors bugs and mostly visual bugs here and there. For example the carousel looks ugly before it loads completely.

The project would be more complete if I have the resource to finish the all the use cases distinct to moderator users.  

## Why you may enjoy contributing to this open source project 
I can say there are some benefits for contributing to this: 
- The problems are basic to moderate in difficulty and all of the heavy work in the project is already done. 
- You don't have to wait for days or weeks just to get replies about your PRs 
- Suitable for fellow frontend developers who are either looking for frontend projects to contribute to regularly, or wanting to do side projects but unable to find time and resources to build from scratch
Introducing AI Assistant in TinyMCE 6.6!
Published: 2023-07-27 07:57:02

## TinyMCE 6.6 Release Notes - Overview

We are thrilled to announce the release of TinyMCE AI Assistant, a groundbreaking addition to our suite of premium plugins! With TinyMCE AI Assistant, you can now supercharge content creation. Say goodbye to writer's block and hello to enhanced creativity and productivity!

## What's New and Improved:

1. **Powerful Pre-Written Prompts:** Research has shown that pre-written prompts yield more useful responses from generative AI applications, making it easier for beginners to utilize AI. You can use the default out-of-the-box prompts, create your own, or allow users to write them from scratch.
2. **Familiar UI for AI:** Our AI Assistant is seamlessly integrated into the TinyMCE content creation workflow, providing users with a familiar and intuitive experience. It's designed as a core part of your app, eliminating the need for any additional AI development efforts.
3. **Total Flexibility:** Connect to OpenAI's GPT models using your OpenAI API key. This gives you the freedom to choose the model and customize parameters, such as temperature and max tokens, to make the AI your own. You can also prime the model with specific instructions tailored to your use case.

## How AI Assistant Works:

Getting started with TinyMCE AI Assistant is a breeze:

Step 1: Add AI Assistant ("ai") configuration to your TinyMCE installation.

Step 2: Connect to OpenAI using your API key.

Step 3: Choose UI options ("ai_request, ai_shortcuts") and customize the default prompts to match your preferences.

Step 4: Ready for production? Set up a [server-side proxy](https://www.tiny.cloud/docs/tinymce/6/ai-proxy/) for secure communication with OpenAI.


## How to get access

### Existing Account?
Fill out our [form](https://www.tiny.cloud/tinymce/features/ai-integration/#contactForm) and add the AI Assistant to Your TinyMCE Account to Get Started Today!

### New Account?
Try out [TinyMCE](https://www.tiny.cloud/) for a 14day Free Trial to get get access to the AI Plugin

Explore the [documentation](https://www.tiny.cloud/docs/tinymce/6/ai/) and unlock the full potential of AI-driven writing within TinyMCE.

For more details, you can read the full [announcement](https://www.tiny.cloud/tinymce/features/ai-integration) or watch the [webinar recording](https://www.youtube.com/watch?v=JoBP4uSHKzE).

We value your feedback and suggestions. Let us know what features you would like to see next by submitting your feature requests or voting on existing features on the public [TinyMCE Roadmap](https://www.tiny.cloud/roadmap/).

## Useful Links:

[Release notes](https://www.tiny.cloud/docs/tinymce/6/6.6-release-notes/#overview)
[Documentation](https://www.tiny.cloud/docs/tinymce/6/ai/) 
[Form to Add AI Assistant](https://www.tiny.cloud/tinymce/features/ai-integration/#contactForm)

Thank you for choosing TinyMCE!

-The Tiny Team
Why Developers Should Use Preview Environments
Tags: opensource, devops, cloud, webdev
Published: 2023-07-27 07:52:00

Check out the latest episode in the Open Source Cafe podcast, where Assaf Krintza (@assafkr - Co-founder & VP Engineering at Livecycle) sits down with Kunal Kushwaha to explore the world of preview environments.

Some of the topics covered in this episode:

- An overview view of the various types of environments that developers encounter
- What are preview environments and how can developers benefit from using them in their development process
- About “[Preevy](https://github.com/livecycle/preevy)” - an open source tool that simplifies the creation of preview environments 
- Some of the the pain points and challenges faced by developers that Preevy addresses
- Preevy’s support for AWS, Azure, Google Cloud and K8s
- Common misconceptions and myths surrounding preview environments 
- Several other gems

Watch this podcast episode here:

{% embed https://www.youtube.com/watch?v=odV3UEme-WE %}
TIL (link in bio)
Published: 2023-07-27 07:30:55

I accidentally got a bit caught up in the design elements of our recent link in bio assignment - it's been really fun figuring out palettes, images, icons, and different backgrounds to use for a website. I hadn't realized it was that easy, or that there were so many resources that make it as simple as copy and paste (and messing around with that to change the color, font size, and so on, has been fun as well.)
I made my first link in bio type of website, so even though it's late, you can check it out [here](https://wild-shadow-7260.fly.dev/)! I think it turned out pretty cute.
Macros to the Rescue! Add Pagination to Non-DB Collections in Laravel
Tags: laravel, php, webdev, programming
Published: 2023-07-27 07:26:17

Laravel's powerful Collection class provides many helpful methods for working with arrays of data. However, the built-in `paginate` method only works on Eloquent query builder and database results. 

If you want to paginate a standard Laravel Collection instance, such as from an array or other custom data source, you're out of luck. Or are you?

By defining a custom macro, we can add pagination capabilities to **any** Collection instance in Laravel. Here's how it works...

## Defining the Pagination Macro

Laravel allows you to define custom macros on existing classes to augment them with new functionality. We can utilize this to create a reusable `paginate` macro on the Collection class.

Inside the `boot` method of a service provider, like `AppServiceProvider`, we'll define the macro:

```php
use Illuminate\Support\Collection;
use Illuminate\Pagination\LengthAwarePaginator;

Collection::macro('paginate', function ($perPage = 15, $pageName = 'page', $page = null, $options = []) {

  // Resolve current page from request  
  $page = $page ?: LengthAwarePaginator::resolveCurrentPage($pageName);
  
  // Paginate the Collection  
  return new LengthAwarePaginator(
      $this->forPage($page, $perPage),
      $this->count(), 
      $perPage,
      $page,
      $options
  );

});
```

The macro creates a new `LengthAwarePaginator` instance which will handle the pagination render logic and links. We just need to pass the specific page's chunk of data from the collection using `forPage`, as well as the total collection count.

## Paginating a Collection

With the macro defined, we can now paginate non-DB collections:

```php
$collection = collect(range(1, 100)); // a Collection instance

$paginated = $collection->paginate(10); // 10 items per page

var_dump($paginated->items()); // [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] on page 1
```

The macro handles all the complexity of slicing the collection into pages and generating the paginator instance.

## Custom Pagination Super Powers!

Defining custom macros provides tremendous flexibility to expand Laravel's base classes. In this case, we've given **all** collections the ability to be paginated with a simple, expressive syntax.

While less efficient for giant data sets, this approach is great for smaller arrays or collections not coming directly from a database query.

So don't limit yourself to just paginating Eloquent results. With a bit of macro magic, you can bring pagination powers to any Laravel collection!
How to Enable CORS for API Management Development Portal using Terraform
Published: 2023-07-27 07:24:28

Today I got a task to automate the Enable CORS feature in the Portal Overview of Developer Portal in Azure API Management Services.

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

This can be achived either via azure_rm or az_api according to documentations. I used azure_rm to achieve this.

We would need to create a policy file with CORS definitions and refer the file to the terraform configurations.

Policy file will look as below.
```
<policies>  
	<inbound>    
		<cors allow-credentials="true">      
			<allowed-origins>        
				<origin>https://example-apim-19899.developer.azure-api.net</origin>      
			</allowed-origins>      
			<allowed-methods preflight-result-max-age="300">        
				<method>*</method>      
			</allowed-methods>      
			<allowed-headers>        
				<header>*</header>      
			</allowed-headers>      
			<expose-headers>        
				<header>*</header>      
			</expose-headers>    
		</cors>  
	</inbound>  
	<backend>    
		<forward-request />  
	</backend>  
	<outbound />
</policies>

```

Terraform code can be created as below to use the policy.

```
resource "azurerm_resource_group" "example" {
  name     = "example-resources"
  location = "uksouth"
}

resource "azurerm_api_management" "example" {
  name                = "example-apim-19899"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  publisher_name      = "pub1"
  publisher_email     = "pub1@email.com"

  sku_name = "Developer_1"
}

resource "azurerm_api_management_policy" "example" {
  api_management_id = azurerm_api_management.example.id
  xml_content       = file("\\policy_files\\example.xml")
}
```

On running Terraform, the policies should be set and CORS should be enabled. Please make sure you give the origin in the policy file as the developer portal URL so that Azure correctly match it and it gets enabled in portal.

If you need to try using AzApi further details can be found here.
https://learn.microsoft.com/en-us/azure/templates/microsoft.apimanagement/service/policies?pivots=deployment-language-terraform
Introducing ApacheAge: Accelerating PostgreSQL Data Analytics with Apache Arrow
Published: 2023-07-27 07:17:03

##Introduction:
ApacheAge is a revolutionary extension that combines the power of Apache Arrow with PostgreSQL, providing significant performance improvements for data analytics and processing. If you're looking to enhance your PostgreSQL database's analytical capabilities, ApacheAge is the tool to explore. In this post, we'll dive into what ApacheAge is and how it can accelerate data analytics in PostgreSQL.

##Understanding Apache Arrow:
Apache Arrow is a columnar in-memory data format that enables fast and efficient data interchange between different systems. It's designed to eliminate the overhead of data serialization and deserialization, making it ideal for analytical workloads.

##Benefits of ApacheAge:
By integrating Apache Arrow with PostgreSQL, ApacheAge allows for faster data processing and analysis. The columnar storage format reduces I/O and memory overhead, leading to improved query performance and reduced latency for analytical queries.

##Installing and Setting up ApacheAge:
We'll walk through the installation process and how to set up ApacheAge with your existing PostgreSQL instance. This might involve installing the ApacheAge extension and making necessary configuration changes to enable Apache Arrow integration.

##Accelerating Data Analytics:
Showcase examples of analytical queries and compare their performance with and without ApacheAge. Demonstrate how ApacheAge accelerates query execution and improves the overall user experience, especially for large-scale analytics.

##ApacheAge and Machine Learning:
Discuss how ApacheAge can benefit machine learning workflows in PostgreSQL. With its efficient data interchange capabilities, Apache Arrow enables seamless data exchange between PostgreSQL and popular ML libraries like Python's Pandas and R's data.table.

##Compatibility and Ecosystem:
Highlight ApacheAge's compatibility with existing PostgreSQL tools and extensions, ensuring a smooth integration process. Additionally, mention the support and community around Apache Arrow, which adds to the ecosystem's strength.

##Conclusion:
ApacheAge opens up new possibilities for PostgreSQL users, empowering them with faster data analytics and streamlined machine learning workflows. By embracing the power of Apache Arrow, you can unlock the true potential of your PostgreSQL database and take your data-driven applications to the next level.
Avalonia for Visual Studio Code (Early Access)
Tags: dotnet, ui, vscode
Published: 2023-07-27 07:09:15

Two weeks ago we showed a [sneak peak](https://github.com/AvaloniaUI/Avalonia/discussions/12128) of Avalonia for Visual Studio Code. The extension will significantly enhance the Avalonia development experience in Visual Studio Code. It features our XAML code completion and integrated XAML previewer, making it easier than ever to build beautiful Avalonia apps.

Today, we are excited to invite you, the sponsors and the members of OpenCollective to try the (extremely) early build of the extension!

Please sign up for the early access [here](https://forms.gle/UUmEdEVpMpET3pvh8), we will start sending out instructions from the 27th of July.

## What’s in the extension?
The extension aims to bring the most common workflows for Avalonia developers. However, the preview will enable the two most common scenarios to kick off the support for VSCode

## Integrated XAML Previewer
The Avalonia XAML Previewer is a powerful tool that allows you to visualise XAML code in real-time. It enables you to efficiently design and fine-tune user interfaces, helping to identify potential issues and visualise the impact of changes instantly.

![Screenshot of the VSCode Extension running](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t93kbadlnukd54gzwsut.png)

## XAML Code completion
The Avalonia XAML in the VS Code is powered by the same code completion engine available for Visual Studio on Windows.

![XAML Completion in VSCode](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5sphyckhviplxmqpqra8.png)

Rich syntax highlighter and contextual code complete will make it lot easier to read and write XAML files

## Feedback
Please share your suggestions, feature requests and report issues for the extension through VS Code’s Help > Report Issue dialog

![VSCode Feedback Dialog](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x5jl0wjly1tpo3z4080d.png)

You can follow all the suggestions and issues the extension [here](https://github.com/avaloniaUI/Avalonia-vscode-extension/issues).
Datadog Alternative: When to Move Out?
Tags: datadog, monitoring, cost, opensource
Published: 2023-07-27 07:00:19

**Introduction**

As an engineer dabbling with technologies and building solutions for customers, I like Datadog. It’s one of the fastest ways to get observability setup. To add to it, their documentation and help articles are comprehensive and easy to follow making the user experience even better.

As a decision-maker, I like Datadog because I can set up observability at a relatively lower cost without having to operate and maintain my own observability system.

But there are cases where the TCO (total cost of ownership) of Datadog may not be efficient as the organization scales. We noticed this trend when speaking to our customers. Many customers after reaching a certain scale were feeling the pinch of the cost. They were looking for alternatives with hope of reducing the TCO. This led us to investigate & simulate the migration so we can prove the hypothesis and help our customers decide whether they should stay with Datadog or migrate to an alternative solution. Also, we had set up observability systems for customers based on OSS technologies, so we were already aware of the cost of setting up & operating such platforms!

Read the full post on https://www.infracloud.io/blogs/datadog-alternative-when-to-move-out/
Streamline Your SSMS Workflow: Tab Color Customization With Native Features and SQL Complete
Published: 2023-07-27 06:55:52

In the sphere of efficient database management and boosted productivity, the ability to tailor tab colors introduces a significant transformation. Either by using inherent features or employing the power of SQL Complete for SQL Server, you have an opportunity to raise your tab organization to unparalleled levels. This article examines the benefits of tab color personalization, showcasing how the fusion of SSMS's native functions and SQL Complete enables smooth navigation and a visually attractive workspace.

Through designating distinct colors to tabs, you can visually segregate your work based on different projects, database types, or priority levels. This color-based categorization assists in rapidly identifying and transitioning between tabs, particularly when handling several scripts or database connections concurrently, such as Development, Testing, and Production. Let's initiate by exploring how SSMS modifies tab colors independently and the supplementary features that SQL Complete brings to the fore: https://blog.devart.com/change-tabs-colors-in-ssms.html
Here's How To Create Your First PostgrSQL Extension Part 4
Tags: postgressql
Published: 2023-07-27 06:45:44

Continuing on [part3](https://dev.to/mghrabi/heres-how-to-create-your-first-postgrsql-extension-part-3-3456) we got into the stage where we have `.sql` file left to build the extension.

We should name the file as follows `add_two_numbers--0.0.1.sql` including the version.

The file will contain the following:

```
CREATE OR REPLACE FUNCTION
add_two_numbers(int,int) RETURNS int AS 'MODULE_PATHNAME','add_two_numbers'
LANGUAGE C STRICT;
```

Then we finally can install the extension:

```
sudo make install
```
You should get an output similar to:

```
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -O2 -fPIC -I. -I./ -I/usr/local/pgsql-13/include/server -I/usr/local/pgsql-13/include/internal  -D_GNU_SOURCE   -c -o add_two_numbers.o add_two_numbers.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -O2 -fPIC add_two_numbers.o -L/usr/local/pgsql-13/lib   -Wl,--as-needed -Wl,-rpath,'/usr/local/pgsql-13/lib',--enable-new-dtags  -shared -o add_two_numbers.so
/usr/bin/mkdir -p '/usr/local/pgsql-13/share/extension'
/usr/bin/mkdir -p '/usr/local/pgsql-13/share/extension'
/usr/bin/mkdir -p '/usr/local/pgsql-13/lib'
/usr/bin/install -c -m 644 .//add_two_numbers.control '/usr/local/pgsql-13/share/extension/'
/usr/bin/install -c -m 644 .//add_two_numbers--0.0.1.sql  '/usr/local/pgsql-13/share/extension/'
/usr/bin/install -c -m 755  add_two_numbers.so '/usr/local/pgsql-13/lib/'
```
This should mean that the extension is installed successfully. Now it's time to run a postgres instance and test the extension, start a postgres instance from the binaries directory, in my case it will be from `usr/local/pgsql-13/bin`:

```
./pg_ctl start -l logfile -D ./data
```

Then the instance:

```
./psql postgres
```

Create the extension:

```
postgres=# CREATE EXTENSION add_two_numbers;
CREATE EXTENSION
```

Run a query to test the function:

```
postgres=# SELECT add_two_numbers(1,3);
 add_two_numbers
-----------------
               4
(1 row)
```

It worked!, congratulations for building your first extension, I hope that was helpful!.
HARBOR LDAP Entegrasyonu
Tags: beginners, linux, ubuntu, tutorial
Published: 2023-07-27 06:35:24

1- Harbor arayüzüne yetkili kullanıcı ile giriş yapıyoruz.
2- COnfiguration -> Authentication sayfasına geliyoruz
3- Authentication Method alanını **LDAP** olarak düzenliyoruz.

LDAP için,

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

**LDAP Search DN:** LDAP kullanıcınızın DN bilgisi, bu örneke Administrator userını verdim, isterseniz sadece kullanıcıları listeleme yetkisi olan bir kullanıcı hesabı oluşturup verebilirsiniz.
**LDAP Search Password:** Verdiğiniz kullanıcının parolası
**LDAP Base DN:** Hangi DN üzerindeki userlar kullanılmak isteniliyorsa oranın DN bilgisi verilmeli.


LDAPS için protokol **ldaps** ve port **636** olacak şekilde seçiyoruz.
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bpx72fr78149f3zvmvrd.png)

**_Not: ldaps bağlantılarda urldeki ismi çözebildiğinize emin olun, sertifika isim ile yapıldıysa ip adresi üzerinden sertifika doğrulanamayacaktır._**

**_DNS sunucunuz sunucunuzu çözmüyorsa /etc/resolv.conf içerisine kendi DNS sunucunzu ekleyebilir veya /etc/hosts dosyaının içerisine ip domain-adı şeklinde kayıt girebilirsiniz._**

Örnek verecek olursak
```
192.168.100.53 WIN-GQ0F90LHVL3.DEREN.LAB
```