teleren/devto huggingface dataset:
Apache AGE starting guide
Tags: postgres, database, age, apacheage
Published: 2023-05-20 16:17:57

To get started with Apache AGE in the real world, you can follow these steps:

- Understand the basics: Apache AGE is a PostgreSQL extension that provides graph database functionality. It enables users to perform graph data processing and analytics using SQL. AGE stands for "A Graph Extension" and its main objective is to create a unified storage solution that can handle both relational and graph model data, enabling users to manage and extract insights from complex graph data sets.

- Install Apache AGE: To get started with Apache AGE, you need to install PostgreSQL and then install the AGE extension on top of it. You can find installation instructions on the Apache AGE website or in various tutorials available online.

- Learn the Cypher Query Language: Cypher is a query language used by Apache AGE to interact with graph data. It is similar to SQL but is designed specifically for graph databases. You can find tutorials and documentation on the Cypher Query Language on the Apache AGE website or in various online resources.

- Explore examples and use cases: To get a better understanding of how Apache AGE works in the real world, it's helpful to explore examples and use cases. You can find examples and use cases on the Apache AGE website, in tutorials, or by searching online.

- Join the community: The Apache AGE community is open to everyone, not just developers. You can learn more about Apache AGE by working with other developers, asking questions, and contributing to the project. The community is continuously developing solutions thanks to a progressive community.

- Practice writing queries: Once you have a basic understanding of Apache AGE and Cypher, you can start practicing writing queries for your own database applications. There are many resources available online that provide sample databases and queries to help you get started.

In conclusion, getting started with Apache AGE in the real world requires understanding the basics, installing the extension, learning the Cypher Query Language, exploring examples and use cases, joining the community, and practicing writing queries for your own database applications. With these steps, you can start using Apache AGE to manage and extract insights from complex graph data sets in your own projects.

### Resources
- https://age.apache.org/
- https://sorrell.github.io/2020/12/10/Postgres-and-Apache-AGE.html
- https://bitnine.net/blog-postgresql/apache-age-journey-top-level/
Using ULID in Laravel Framework
Tags: laravel, mysql, php
Published: 2023-05-20 16:10:06

In a previous [post](https://dev.to/muhamadhhassan/using-unique-identifiers-as-primary-key-in-mysql-5h1k), we talked about how ULID can be a better choice for primary keys in MySQL than UUIDs. In this tutorial, we will go over how to use ULID in Laravel Framework.

ULID has been supported in Laravel since [v9.30.1](https://github.com/laravel/framework/releases/tag/v9.30.1) and has received some improvements in later releases So no third-party packages are needed to use it.

### Eloquent Models
Let's take an `Article` model as an example. First, we create the article's model and migration file as we normally do

```bash
php artisan make:model Article
```
In the `up` method inside the migration file, the table's primary key will be defined using the `ulid` method followed by the primary method.

```php
public function up(): void
{
    Schema::create('articles', function (Blueprint $table) {
        $table->ulid('id')->primary();
        $table->string('title');
        $table->text('body');
        $table->timestamps();
    });
}
```
What the `[ulid](https://github.com/laravel/framework/blob/9.x/src/Illuminate/Database/Schema/Blueprint.php#L1288)` method does is create a column of type `CHAR` and set its length to 26 bytes instead of the 36 bytes needed for UUIDs.

Then in the `Article` eloquent model, the `Illuminate\Database\Eloquent\Concerns\HasUlids` trait will be added

```php
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Concerns\HasUlids;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Article extends Model
{
    use HasFactory, HasUlids;
}
```
Laravel also has a method in the `Illuminate\Database\Schema\Blueprint` class for creating foreign keys that references a table with ULID primary key.

In our example, we can add a `Comment` model and each comment belongs to one `Article`. The foreign key of the articles table is defined using the `foreignUlid` method

```php
public function up(): void
{
    Schema::create('comments', function (Blueprint $table) {
        $table->uuid('id')->primary();
        $table->string('body');
        $table->foreignUlid('article_id')->constrained();
        $table->timestamps();
    });
}
```
And the last method is `ulidMorphs` that create the columns needed for a polymorphic relation. Let's add another `Tag` model that can be linked to many models not just `Article`. The `taggables` table can be defined like this:

```php
public function up(): void
{
    Schema::create('taggables', function (Blueprint $table) {
        $table->foreignUlid('tag_id')->constrained();
        $table->ulidMorphs('taggable');
    });
}
```
### Str Facade
ULID can be created anywhere in your app using the `ulid` method in the `Illuminate\Support\Str` facade.

```php
Str::ulid()->toBase32()
```
The above statement returns the ULID and it will look something like this `01H0WXWP3XGAX0ZJVG7Q2E70FC`.

Finally, if you are interested in the implementation being used to generate ULID, check out the [Symfony UID](https://github.com/symfony/uid) component that Laravel uses.
What is DragGAN and how is it revolutionizing photo editing?
Tags: discuss, ai, photoshop, draggan
Published: 2023-05-20 16:06:22

While it's currently a cutting-edge research paper, it showcases an incredible innovation that allows users to effortlessly modify the appearance of a picture by simply dragging its points to edit and morph photos. 

I'm particularly intrigued by the simplicity of the user experience. The tool would let users quickly adjust the positions, stances, expressions and sizes of photo subjects. 

On the surface, this doesn’t sound too interesting, but take a look at the examples below to get an idea of what this system can do.

Research Paper:
https://arxiv.org/pdf/2305.10973.pdf

Demo videos: 🎥🔥
https://vcai.mpi-inf.mpg.de/projects/DragGAN/
DEV Showcase #2 - Shine a Spotlight on Your Work 💡
Tags: codenewbie, beginners
Published: 2023-05-20 16:00:00

---
title: DEV Showcase #2 - Shine a Spotlight on Your Work 💡
published: true
description:Weekly thread where you can share what you've been working on and get feedback and encouragement from the DEV community.
tags: codenewbie, beginner
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
published_at: 2023-05-20 16:00 +0000
---
Welcome back to the DEV Showcase - a weekly thread where you can share what you've been working on and get feedback and encouragement from the DEV community.

This is your chance to show off your latest project, share a cool hack or technique you've learned, or ask for advice and feedback from other developers. Whether you're a seasoned developer or just starting out, this is the place to connect with others and get inspired.

Here are a few questions to think about if you're stuck:
- What has captured your attention recently in terms of projects?
- Which tools or resources have you found useful in your work?
- Have you acquired any fresh skills or techniques lately?
- What obstacles have you encountered, and how can the community assist you in overcoming them?
- What are your aspirations for your project or career moving forward?

Remember, this isn't a competition or a challenge - it's just a space to share and connect with others. So don't be shy! Share your work and get feedback and encouragement from the DEV community.

We're excited to see what you've been working on, and to support you as you continue to grow and develop your skills.
Query Native Compilation
Tags: opengauss
Published: 2023-04-19 04:04:15

An additional feature of MOT is the ability to prepare and parse pre-compiled full queries in a native format (using a PREPARE statement) before they are needed for execution.

This native format can later be executed (using an EXECUTE command) more efficiently. This type of execution is much quicker because the native format bypasses multiple database processing layers during execution and thus enables better performance.

This division of labor avoids repetitive parse analysis operations. In this way, queries and transaction statements are executed in an interactive manner. This feature is sometimes called Just-In-Time (JIT) query compilation.

**Query Compilation – PREPARE Statement**
To use MOT’s native query compilation, call the PREPARE client statement before the query is executed. This instructs MOT to pre-compile the query and/or to pre-load previously pre-compiled code from a cache.

The following is an example of PREPARE syntax in SQL –

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

PREPARE creates a prepared statement in the database server, which is a server-side object that can be used to optimize performance.

**Execute Command**
When an EXECUTE command is subsequently issued, the prepared statement is parsed, analyzed, rewritten and executed. This division of labor avoids repetitive parse analysis operations, while enabling the execution plan to depend on specific provided setting values.

The following is an example of how to invoke a PREPARE and then an EXECUTE statement in a Java application.

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

The following describes the supported and unsupported features of MOT compilation.

**Supported Queries for Lite Execution**
The following query types are suitable for lite execution –

**·** Simple point queries –

**·** SELECT (including SELECT for UPDATE)
**·** UPDATE
**·** DELETE
**·** INSERT query

**·** Range UPDATE queries that refer to a full prefix of the primary key

**·** Range SELECT queries that refer to a full prefix of the primary key

**·** JOIN queries where one or both parts collapse to a point query

**·** JOIN queries that refer to a full prefix of the primary key in each joined table

**Unsupported Queries for Lite Execution**
Any special query attribute disqualifies it for Lite Execution. In particular, if any of the following conditions apply, then the query is declared as unsuitable for Lite Execution. You may refer to the Unsupported Queries for Native Compilation and Lite Execution section for more information.

It is important to emphasize that in case a query statement does not fit

native compilation and lite execution, no error is reported to the client and the query will still be executed in a normal and standard manner.

For more information about MOT native compilation capabilities, see either the section about Query Native Compilation or a more detailed information in the Query Native Compilation (JIT) section.
Install Docker on WSL2
Tags: windows, linux, wsl2
Published: 2023-05-20 15:49:02

## 1. install curl
```shell
sudo apt install -y curl
```

## 2. install docker via shell script

```shell
$ curl -s https://raw.githubusercontent.com/karaage0703/ubuntu-setup/master/install-docker.sh | /bin/bash
```

```shell
#!/bin/bash
# Reference sites
# https://qiita.com/gen10nal/items/1e7fe8a1b2e9ad1e7919
# https://docs.docker.com/engine/install/ubuntu/

sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get -y install docker-ce docker-ce-cli containerd.io
sudo apt-get -y install docker-compose-plugin
sudo gpasswd -a $USER docker
```

## 3 start docker on WSL2
```shell
sudo service docker start
```
Web Scraping on Google Scholar
Tags: python, webscraping, datamining
Published: 2023-05-20 15:36:26

Web scraping Google Scholar is feasible, but it's important to keep in mind that doing so might be against the terms of service and unlawful.


Having said that, there are a number of tools and frameworks, such as BeautifulSoup, Scrapy, and Selenium, that can help you if you decide to proceed with online scraping Google Scholar.

Before you start scraping data, be sure you are completely aware of the information you want to get as well as any possible legal repercussions. Additionally, it is suggested that you keep your scraping activity to a reasonable speed in order to avoid overtaxing the servers and potentially getting blocked.

One method for web scraping Google Scholar is to combine URL searches with automation tools to extract the necessary data. For instance, a tool like BeautifulSoup can be used to extract particular data fields from a Google Scholar search result page, and a tool like Scrapy can be used to quickly crawl through several pages of search results.

The fact that Google Scholar offers an API through which developers can obtain its data is significant. It is advised to use the API rather than web scraping if your aim is to extract data from Google Scholar in order to comply with the terms of service and stay out of trouble with the law.
Emoji Issue Classifier
Tags: githubhack23
Published: 2023-05-20 15:28:24

## What I built 

I built an Emoji Issue Classifier, a machine learning-based solution that automatically adds relevant labels to GitHub issues based on their content. The classifier analyses the text of an issue and predicts appropriate emoji labels, such as ":bug:", ":sparkles:", ":chart_with_upwards_trend:", and more, to help categorise and prioritise issues.

### Category Submission:

Maintainer Must-Haves

### App Link

https://github.com/marketplace/actions/emoji-issue-classifier

### Screenshots 

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

More examples here: https://github.com/plopcas/gh-actions-test/issues

### Description 

The Emoji Issue Classifier is designed to improve the issue management process by automating the labeling of GitHub issues. It utilizes natural language processing and machine learning techniques to analyze the issue's title and description, perform sentiment analysis, and extract keywords. Based on this analysis, it adds appropriate emoji labels that represent the sentiment and topic of the issue.

This solution saves time and effort for both issue submitters and project maintainers by accurately categorising and prioritising issues. It ensures that issues are properly labeled, enabling efficient issue tracking, organisation, and decision-making.

### Link to Source Code 

https://github.com/plopcas/emoji-issue-classifier

### Permissive License 

MIT license

## Background (What made you decide to build this particular app? What inspired you?) 

The inspiration for this project came from my own experience with managing GitHub repositories and the challenges faced in efficiently processing and categorising a large number of issues. I wanted to automate the process of labelling issues, allowing project maintainers to focus more on issue resolution and providing a better experience for issue submitters. I also wanted to do this with a twist, hence the emojis.

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

To build the Emoji Issue Classifier, I used GitHub Actions and GitHub Codespaces. GitHub Actions allowed me to automate the process of applying labels to issues based on the classifier's predictions. I integrated the classifier into a GitHub Action workflow, which runs whenever a new issue is opened or edited.

GitHub Codespaces provided a convenient development environment. It allowed me to work on the project seamlessly in the browser without worrying about the setup or compatibility of development environments.

Throughout the development process, I learned and applied various natural language processing techniques, including sentiment analysis, keyword extraction, and data augmentation. I trained a machine learning model using scikit-learn and employed the TextBlob library for sentiment analysis. I also used the NLTK library for data augmentation and synonym replacement to enhance the training data.
My Makefile for Elixir/Phoenix
Tags: webdev, elixir, phoenix, makefile
Published: 2023-05-20 15:01:06

Following my last post about [GNU Make](https://www.gnu.org/software/make/) and [Makefiles](https://en.wikipedia.org/wiki/Make_(software)#Makefiles), I thought I could share the `Makefile` I'm using in my Elixir/Phoenix projects to have a standard CLI interface to manipulate all of them.

I designed this `Makefile` to be easily adapted to be used in other projects (I've been coding with some uncommon tools – Bash, Hy, Janet, Python, SQLite, etc., so remembering the commands specific to each of these is hard. So a standard `Makefile` helps a lot. I also copy-paste it in new projects, edit its tasks, possibly delete some (eg.: delete database-related commands if they're not needed), and I'm good to go.

> _If you're not familiar with Makefiles, check this [quick introduction to Makefiles](https://dev.to/joeljuca/makefiles-a-standard-for-project-tasks-31b) I wrote last week. It might give you good insights about what GNU Make is and how it can be used for._

With no ceremony, here's my "standard" Elixir/Phoenix `Makefile`:

```makefile
.PHONY: setup build run lint fmt test test.watch db.setup db.create db.migrate db.seed db.drop db.reset repl repl.run repl.test

# Project-wide

setup:
	make build \
	&& make db.setup

build:
	mix do deps.get + compile

run:
	mix phx.server

# Code quality

lint:
	mix format --check-formatted

fmt:
	mix format

test:
	mix test

test.watch:
	mix test.watch

# Database

db.setup:
	make db.create \
	&& make db.migrate \
	&& make db.seed

db.create:
	mix ecto.create

db.migrate:
	mix ecto.migrate

db.seed:
	mix run priv/repo/seeds.exs

db.drop:
	mix ecto.drop

db.reset:
	make db.drop \
	&& make db.setup

# REPL

repl:
	iex -S mix

repl.run:
	iex -S mix phx.server

repl.test:
	iex -S mix test.watch
```

Most of these Mix subcommands are provided by Phoenix, so they work for any Phoenix project you adopt it, with two exceptions: `test.watch` and `repl.test`. Both assume that you're using [mix_test_watch](https://hex.pm/packages/mix_test_watch) to run tests every time a change in the source code is made. Everything else is pretty much bare Phoenix subcommands.

That's it. An autocompletion-powered CLI wrapper to work with Phoenix. Now you can type `make`, hit `Tab` (once or twice, depending on how your shell is configured), and get autocompletions for the most important tasks of your project.
3 Things I Learned From "ChatGPT Prompt Engineering for Developers"
Tags: chatgpt, python, beginners
Published: 2023-05-20 14:40:10

After seeing it on Twitter and mentions by a few co-workers, I burned a couple of evenings and took the "[ChatGPT Prompt Engineering for Developers](https://www.deeplearning.ai/short-courses/chatgpt-prompt-engineering-for-developers/)" mini-course taught by ([Andrew Ng - Coursera](https://twitter.com/AndrewYNg) and [Isabella Fulford - OpenAI](https://twitter.com/isafulf)).

As with any deeplearning.ai course: the instructors  incorporated a simple, Pythonic approach in Jupyter notebooks with informative lectures to utilizing ChatGPT (currently Turbo 3.5) programmatically. The course ended with a build of a functioning chatbot to handle pizza orders that was surprisingly robust and easy-to-build.

I'd recommend anyone wanting to understand ChatGPT more to take this free course.

Here are 3 things that stood out to me:

**1. Hallucinations are a thing and they don't go away easily**
 
A short section delivered a hard lesson: you can't trust ChatGPT. Asking ChatGPT about a product name that was very similar to a real product had it generate a description for a product that didn't exist, but - even after putting in checks into follow-up prompts - the result suggested it did.

Every professional I know whose used ChatGPT for something serious ran into this problem. I wouldn't go as far as "trust but verify", but rather I wouldn't expect ChatGPT to share insights that I didn't feed it.

**2. Building context and developing prompts to give the model "time to think"**

I've seen a bit about prompt engineering, but very little on how to get it to deliver more detailed answers. The lesson they gave on Iteration showed how not just to "engineer" a prompt like you see on those annoying Twitter threads, but to programmatically incorporate feedback to better build context towards more useful results.

**3. Utilizing parameters**

My biggest takeaway is that not only you can adjust the "creativity" of the model through temperature, but approaching ChatGPT programmatically allows for a host of options. You can find a complete list of the parameters in the API spec, but it shows we have a long way to go with this model and with generative AI

If you're still not convinced to take a few evenings to go through this free course, @shanshaji is [writing a series and diving a little deeper into some examples](https://dev.to/shanshaji/writing-effective-prompts-for-large-language-models-two-prompting-principles-and-their-related-tactics-151a) based on his experience with the course.