teleren/devto huggingface dataset:
My first eclipse plugin
Tags: eclipse
Published: 2023-09-12 19:41:21

I used Eclipse between 2008-2018. After 2018 I saw everyone was using Intellij I moved too. Then today I was trying to write some aspectj code and created an .aj file. I realized intellij community edition does not really support aj files. I checked vscode it also did not support it, then the old friend eclipse came. It caused some issues because of the old plugin version, but after installation of the new version ajdt plugin it worked.

While I was trying to write some code, I realized shortcuts are not working for me because I dont remember eclipse shortcuts anymore, so I remembered there was an intellij to eclipse the [keymapper plugin](https://github.com/IntelliJIdeaKeymap4Eclipse/IntelliJIdeaKeymap4Eclipse). I remembered I opened PR for that repo long ago because **ctrl+tab** was not working as expected. Then when I checked I saw that they [did not merge](https://github.com/IntelliJIdeaKeymap4Eclipse/IntelliJIdeaKeymap4Eclipse/pull/15),

So I wanted to build and install it in my eclipse, then I said OK, let me publish this on github. Now it is [installable](https://github.com/ozkanpakdil/IntelliJIdeaKeymap4Eclipse#readme). It was not a bad experience. Building is a very manual process but at the end it was all in eclipse UI and surprisingly everything worked :D I was not expecting that. Therefore, that is my first eclipse plugin.
Ktor build with graalvm
Tags: graalvm, ktor
Published: 2023-09-12 19:40:49

I wanted to test ktor.io with graalvm build, main problem is all code I found using gradle and my project is using mvn here is the [code](https://github.com/ozkanpakdil/test-microservice-frameworks/tree/main/ktor-demo). like other modules I needed to create reflect config json, otherwise ktor serialize is not working properly with graal and when I send a request to “/hello” endpoint I got empty response. I tried to write myself but did not work and at the end I used command below

```
java -agentlib:native-image-agent=config-output-dir=./graalcnf/ -jar target/ktor-demo-1.0.1-SNAPSHOT-jar-with-dependencies.jar

```

when I ran this command in ktor-demo folder it created **graalcnf** folder and wrote every required files there. After that we need to give those to graal native build with the config below

```
Args = --enable-http \
-H:IncludeResources=.*\\.properties \
  -H:ConfigurationFileDirectories=${project.basedir}/graalcnf/ 

```

Check [here](https://github.com/ozkanpakdil/test-microservice-frameworks/blob/main/ktor-demo/resources/META-INF/native-image/com.mascix/ktor-demo/native-image.properties) to see full configuration. ![ktor and other images](https://user-images.githubusercontent.com/604405/201545632-d430c7c6-45eb-41d0-8bd8-202a8ad9324e.png)Ktor response with graal vm is 35 and quarkus is 23. can see full respot [here](https://ozkanpakdil.github.io/microservicetests/2022-11-13-microservice-framework-test-17.html).
Getting REST version from request mapping of controller for mockmvc
Tags: springboot, spring, restapi, rest
Published: 2023-09-12 19:39:36

When we write a spring rest controller we give version url and start writing different functions as endpoints like below

```
@RestController
@RequestMapping("/api/v1")
public class ControllerApi {

    final LoginSender loginSender;

    public ControllerApi(LoginSender loginSender) {
        this.loginSender = loginSender;
    }

    @PostMapping("/login")
    boolean login(@RequestBody LoginParams params) {
        return loginSender.login(params.server(), params.login(), params.password(), params.build(), params.webManager());
    }

    @GetMapping("/get1")
    LoginParams get1(@RequestParam String login, @RequestParam(required = false) String webMan,
                     @RequestParam(required = false) String server, @RequestParam(required = false) String pass,
                     @RequestParam(required = false) String build) {
        return LoginParams.builder()
                .webManager(webMan)
                .server(server)
                .password(pass)
                .login(login)
                .build(build)
                .build();
    }
}

```

ib the future this controller will have different version number from v1 to v2 or in the future someone will change login endpoint from “/login” to “/loginJwt” but function order probably will not change. So in order to prevent your tests to fail we can collect these data from controller class like the code below.

```
@BeforeEach
void beforeEach() throws NoSuchMethodException {
    RequestMapping requestMapping = ControllerApi.class.getAnnotation(RequestMapping.class);
    Method[] methods = ControllerApi.class.getDeclaredMethods();
    loginUrl = methods[0].getAnnotation(PostMapping.class).value()[0];
    get1Url = methods[1].getAnnotation(GetMapping.class).value()[0];
    apiVersion = requestMapping.value()[0];
}
@Test
void login() throws Exception {
    when(loginSender.login(any(), any(), any(), any(), any())).thenReturn(true);

    String mvcResult = mockMvc.perform(post(apiVersion + loginUrl)
                    .content(mapper.writeValueAsString(LoginParams.builder().build()))
                    .contentType(MediaType.APPLICATION_JSON))
            .andExpect(status().isOk())
            .andReturn().getResponse().getContentAsString();
    Assertions.assertEquals("true", mvcResult);
}

```

One way to write more independent tests. You can see running code [here](https://github.com/ozkanpakdil/spring-examples/blob/master/swagger-boot3-graalvm/src/test/java/org/example/ControllerApiTest.java)

or another way to get the methods by name, like below

```
loginUrl = Arrays.stream(methods)
        .filter(f->f.getName().toLowerCase().contains("login"))
        .findFirst()
        .get()
        .getAnnotation(PostMapping.class).value()[0];
get1Url = Arrays.stream(methods)
        .filter(f->f.getName().toLowerCase().contains("get1"))
        .findFirst()
        .get()
        .getAnnotation(GetMapping.class).value()[0];

```
Using arti to Connect to TOR Network and query WHOIS information in Rust
Tags: rust, tor
Published: 2023-09-12 19:38:12

[This code](https://github.com/ozkanpakdil/rust-examples/tree/main/arti_whois) is a web application that allows querying WHOIS information over the TOR network. It uses the arti library to create and manage the tor connection and tor-rtcompat to define the runtime for the tor connection.

[The arti library](https://gitlab.torproject.org/tpo/core/arti) provides a simple way to connect to the TOR network and make requests through it. It also allows to define the behavior of the tor connection, like in this case OnDemand, which only establishes the connection when it is needed.

By routing WHOIS queries through the TOR network, the application can provide an additional layer of privacy and security. This can be useful for situations where the user wants to remain anonymous while querying the WHOIS server.

Rust, being a systems programming language, is designed to be a safe and concurrent language that is easy to learn and write. Rust’s strong type system and ownership model make it easy to write concurrent code that is safe and efficient.

The match statement in the whois\_handler function is used to handle errors that may occur during the WHOIS query or response parsing, ensuring that the program will continue to run even if an error occurs, rather than crashing.

In conclusion, the use of the arti library for connecting to the TOR network and WHOIS in Rust can be a powerful tool for creating network applications that require privacy and security. The arti library provides an easy and efficient way to connect to the TOR network and make requests through it, while Rust’s safety and performance features make it a great choice for implementing such applications. Its built-in error handling ensures robust and reliable code. The application is able to handle errors during the WHOIS query or response parsing, ensuring that the program will continue to run even if an error occurs, rather than crashing.
Printing running sqls with P6spy in spring boot 3 and hibernate 6
Tags: java, hibernate, sql
Published: 2023-09-12 19:37:00

in build.gradle

```
implementation 'p6spy:p6spy:3.9.1'

```

In application.properties

```
spring.datasource.url=jdbc:p6spy:h2:mem:testdb
spring.datasource.driverClassName=com.p6spy.engine.spy.P6SpyDriver

```

and in spy.properties

```
driverlist=org.h2.Driver
appender=com.p6spy.engine.spy.appender.StdoutLogger
logMessageFormat=com.p6spy.engine.spy.appender.CustomLineFormat
customLogMessageFormat=%(currentTime)|%(executionTime)|%(sqlSingleLine)

```

With this configuration application logs will appear in console. like below

```
2023-04-08T12:14:54.237+01:00 DEBUG 178209 --- [nio-8080-exec-4] o.s.w.f.CommonsRequestLoggingFilter : Before request [GET /byname/name1]
1680952494240|0|select c1_0."id",c1_0."last_name",c1_0."name" from "customer" c1_0 where c1_0."name"='name1'
1680952494242|0|select a1_0."customer_id",a1_1."id",a1_1."city",a1_1."line1",a1_1."post_code" from "customer_addresses" a1_0 join "address" a1_1 on a1_1."id"=a1_0."addresses_id" where a1_0."customer_id"=2
1680952494244|0|select o1_0."customer_id",o1_1."id",o1_1."create_time",o1_1."full_price",o1_1."items",o1_1."update_time",o1_1."version" from "customer_orders" o1_0 join "order" o1_1 on o1_1."id"=o1_0."orders_id" where o1_0."customer_id"=2
1680952494246|0|select b1_0."customer_id",b1_1."id",b1_1."create_time",b1_1."items",b1_1."update_time",b1_1."version" from "customer_baskets" b1_0 join "basket" b1_1 on b1_1."id"=b1_0."baskets_id" where b1_0."customer_id"=2

```

If required user can change the log format like described [here](https://github.com/p6spy/p6spy/blob/master/src/main/assembly/individualFiles/spy.properties#L101), [here](https://github.com/ozkanpakdil/spring-examples/tree/master/h2-spring-transactions-p6spy) is working example project.

P6spy is good for development but should not be used in production, for production every database has their own monitoring logging solution which will show what sql is running from which user.

Postgre sql

```
SELECT pid, age(clock_timestamp(), query_start), usename, query 
FROM pg_stat_activity 
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' 
ORDER BY query_start desc;

```

Check links for [oracle](https://dba.stackexchange.com/questions/8828/how-do-you-show-sql-executing-on-an-oracle-database) and [for mssql](https://stackoverflow.com/a/941836/175554)
Printing running sqls in logs with spring boot 3 and hibernate 6
Published: 2023-09-12 19:36:25

In application.properties

```
logging.level.org.hibernate=info
logging.level.org.hibernate.SQL=debug
logging.level.org.hibernate.orm.jdbc.bind=trace
logging.level.org.hibernate.stat=debug
logging.level.org.hibernate.SQL_SLOW=info
logging.level.org.hibernate.cache=debug

```

will make print all sqls and bindings with it like below

```
2023-04-08T09:31:54.232+01:00 DEBUG 164224 --- [main] org.hibernate.SQL : insert into "address" ("city", "line1", "post_code", "id") values (?, ?, ?, ?)
2023-04-08T09:31:54.232+01:00 TRACE 164224 --- [main] org.hibernate.orm.jdbc.bind : binding parameter [1] as [VARCHAR] - [Glasgow]
2023-04-08T09:31:54.232+01:00 TRACE 164224 --- [main] org.hibernate.orm.jdbc.bind : binding parameter [2] as [VARCHAR] - [apt:0]
2023-04-08T09:31:54.232+01:00 TRACE 164224 --- [main] org.hibernate.orm.jdbc.bind : binding parameter [3] as [VARCHAR] - [G0]
2023-04-08T09:31:54.232+01:00 TRACE 164224 --- [main] org.hibernate.orm.jdbc.bind : binding parameter [4] as [BIGINT] - [28]

```
Add `open with vscode` into context menu in linux mint
Published: 2023-09-12 19:35:40

Add code below to ~/.local/share/nemo/actions/vscode.nemo\_action

```
[Nemo Action]
Name=Open in VS Code
Comment=Open in VS Code
Exec=code "%F"
Icon-Name=visual-studio-code
Selection=Any
Extensions=dir;

```

Then in files go to folder you want to open with VScode then right click and choose open in VS Code.
Add `open with intellij` into context menu in linux mint
Published: 2023-09-12 19:35:17

Add code below to ~/.local/share/nemo/actions/intellij.nemo\_action

```
[Nemo Action]
Name=Open in Intellij
Comment=Open in Intellij
Exec=intellij-idea-community "%F"
Icon-Name=intellij
Selection=Any
Extensions=dir;

```

Then in files go to folder you want to open with intellij then right click and choose open in intellij.
How to Make Coffee with a Moka Pot
Tags: mokapot, coffee, make
Published: 2023-09-12 19:14:23

To make coffee with a Moka pot, grind your favorite coffee beans, fill the lower chamber with water, place the ground coffee in the filter basket, assemble the pot, and heat it on a stove until the coffee starts flowing. Coffee lovers often enjoy the strong and rich flavor produced by a Moka pot. Read Full: [How to Make Coffee with a Moka Pot](https://theabccafe.com/make-coffee-with-a-moka-pot)
How to Host Node.js with EJS on CentOS 7 with Reverse Proxy using Apache Server
Tags: node, linux, ejs, cpanel
Published: 2023-09-12 19:03:12

Node.js is a popular runtime environment for executing JavaScript code on the server side. If you are a software developer looking to host a Node.js application with EJS (Embedded JavaScript) on CentOS 7, this article will guide you through the process. We will also set up a reverse proxy using Apache server to handle incoming requests.

Before we begin, make sure you have a CentOS 7 server up and running. Let's dive into the steps:

Step 1: Install Node.js
-----------------------

To host a Node.js application, we need to install Node.js on our CentOS server. Open your terminal and run the following commands:

`sudo yum install epel-release` `sudo yum install nodejs`

Once the installation is complete, you can verify it by running `node -v` and `npm -v` commands. This will display the installed version of Node.js and npm (Node Package Manager) respectively.

Step 2: Install Apache Server
-----------------------------

We will use Apache server as a reverse proxy to handle incoming requests and forward them to our Node.js application. Install Apache server by running the following command:

`sudo yum install httpd`

Start the Apache server and enable it to start on boot:

`sudo systemctl start httpd` `sudo systemctl enable httpd`

Step 3: Set up Reverse Proxy
----------------------------

Now, we need to configure Apache to act as a reverse proxy. Open the Apache configuration file using your favorite text editor:

`sudo vi /etc/httpd/conf/httpd.conf`

Add the following lines at the end of the file:

`ProxyPass / http://localhost:3000/` `ProxyPassReverse / http://localhost:3000/`

Save and close the file. Restart Apache server for the changes to take effect:

`sudo systemctl restart httpd`

Step 4: Install EJS
-------------------

EJS is a popular templating engine for Node.js. Install it by navigating to your project directory and running:

`npm install ejs`

You can now start developing your Node.js application with EJS.

Congratulations! You have successfully hosted a Node.js application with EJS on CentOS 7 using Apache server as a reverse proxy. Now you can access your application by visiting your server's IP address or domain name in a web browser.

Remember, this is just the beginning of your Node.js journey. Have fun coding and exploring the vast world of Node.js!

References:
-----------

*   [Node.js](https://nodejs.org/)
*   [EJS](https://ejs.co/)
*   [Apache HTTP Server](https://httpd.apache.org/)
Windows Vs Linux - The Numbers
Tags: linux, bash, programming, python
Published: 2023-09-12 18:23:17

## Introduction
Hello!

A while ago I conducted some tests between Windows and Linux (Pop_OS! in this instance). The tests conducted were the following:

- Wake up from sleep.
- Geek bench scores.
- A range of gaming benchmarks.
- **AND a simple software/programming test.**

These tests were conducted on the exact same hardware, the system I used had a dual boot setup to remove as many external factors as possible.

Obviously I want to talk about the software test (hence the bold). 

## The "problem"

Generally the reason to switch to Linux that is mentioned consistently is because

1. It's free
2. It's easier to get software tools setup
3. Security
4. Customization
5. Community support
6. Reliability

This list is not exhaustive but these are the common reasons I see listed why someone should switch from Linux to windows. And I'm not here to say why you should or shouldn't switch. 

I'm here to show you numbers and let you make up your own mind. I intend to do this with an overlooked reason why programmers/developers/engineers switch to using Linux. 

**SPEED!**
![SPEED!](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wykm47nmv50ffot64rw6.gif)

## The Results

Again, this is a simple example but it correlates to my experience in general. Using the following 10 languages:
1. Rust
2. Typescript
3. Python
4. Java
5. Bash
6. C++
7. C
8. R
9. JavaScript (Firefox)
10. Go

The test was to get each of these results to print the string "Bye\n" 1,000,000 times. As I say simple, but the results were interesting. I'm not going to add anymore, I will let the results speak for themselves and you may draw from them what you wish.

I also encourage discourse below to share experiences and or concerns with this method to test.

Thanks for reading! 

![Results](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pojd2wuldgrrv2q94car.png)
Display website icons in the VSCode markdown preview
Tags: vscode, markdown
Published: 2023-09-12 17:59:30

A quick inspiration realized: in the markdown preview of VSCode, in addition to displaying the link itself, if it's a popular website, such as GitHub, Twitter, Google, etc., the corresponding logo will be added in front of it.

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

It has been published to the VSCode extension store: [https://marketplace.visualstudio.com/items?itemName=rxliuli.markdown-link-logo](https://marketplace.visualstudio.com/items?itemName=rxliuli.markdown-link-logo)

Inspiration source: [https://discourse.joplinapp.org/t/32608](https://discourse.joplinapp.org/t/32608)

Have fun! ✨
First Contributions: learn how to contribute to open source projects
Tags: opensource, beginners, tutorial, 100daysofcode
Published: 2023-09-12 17:56:10

I followed the hands-on tutorial in the Readme of first contributions and made my first pull request to the same repo.
This is my Day 01 of #100daysofcodechallenge

{% embed https://github.com/firstcontributions/first-contributions %}
Top 7 Featured DEV Posts from the Past Week
Tags: top7
Published: 2023-09-12 17:44:03

---
title: Top 7 Featured DEV Posts from the Past Week
published: true
description: A round up of the most-read and most-loved contributions from the community this past week
tags: top7 
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/izn8hfzc0bhki5h4cu15.jpg
---

_Every Tuesday we round up the previous week's top posts based on traffic, engagement, and a hint of editorial curation. The typical week starts on Monday and ends on Sunday, but don't worry, we take into account posts that are published later in the week._ 

---

{% embed https://dev.to/novu/building-a-real-time-chat-with-websockets-novel-and-clerk-40ac %} In this tutorial, @nevodavid will run you through the process of building a chat application. By the end, you’ll learn how to authenticate users with Clerk, send real-time messages via Socket.io in a React and Node.js application, and add Novel WYSIWYG editor to a React app.

---

{% embed https://dev.to/srbhr/swirl-an-open-source-search-engine-with-llms-and-chatgpt-to-provide-all-the-answers-you-need-1amc %} A lot of time is spent going through all of the different folders and searches needed to find what you’re looking for. @srbhr found the solution to this problem in Swirl Search, an engine that can look through multiple platforms and generate data using an LLM. 

---

{% embed https://dev.to/jacktt/creating-dynamic-readmemd-file-388o %} @jacktt has a weather widget in their GitHub bio that updates every six hours. How is this possible? Through the power of GitHub Actions!

---

{% embed https://dev.to/cherryramatis/linux-filters-how-to-streamline-text-like-a-boss-2dp4 %} In this comprehensive guide, we'll explore the general definition of Unix philosophy, investigate the key elements of a well written script, and learn the building blocks of scripting with @cherryramatis!

---

{% embed https://dev.to/thevinitgupta/discover-bun-a-faster-modern-javascript-runtime-5fob %} Bun is the new Javascript Runtime built from scratch to serve the modern Javascript ecosystem. But do we even need another JavaScirpt tool? Here’s @thevinitgupta with the answer to this question and more. 

---

{% embed https://dev.to/opensauced/moneyball-for-engineers-4ki9 %} @bdougieyo shows how green squares on GitHub are a framework that no longer holds value because it encourages the wrong metrics. Here’s how OpenSauced handles this issue. 

---

{% embed https://dev.to/wasp/build-your-own-ai-meme-generator-learn-how-to-use-openais-function-calls-1p21 %} In this two-part tutorial, we’re going to build a full-stack instant Meme Generator app with @vincanger! The tools you’ll need are React & NodeJS w/ TypeScript, OpenAI’s Function Calling API, and ImgFlip.com’s meme creator API.

---

_That's it for our weekly Top 7 for this Tuesday! Keep an eye on dev.to this week for daily content and discussions...and be sure to keep an eye on this series in the future. You might just be in it!_
Time to break up with auto-generated URLs, custom domains for preview environments have arrived!
Tags: webdev, news, frontend, developer
Published: 2023-09-12 17:35:18

**Custom domains now available on preview environments! 👏**

Tired of those ugly auto-generated URLs? So are we, that's why we are excited to introduce our brand-new feature: **Custom domains on preview environments**. 😍

With our PaaS, you were always able to set up a custom domain for your production environment, but it was not possible for your staging or development environments (also called preview environments), meaning you were stuck with our auto-generated URLs.

Which led to many of you letting us know that we should do something about it, by voting for the feature on our Product Portal. It soon became the most-voted feature on the Product Portal so we knew it was time to listen and do something to improve this!

**What does this feature mean exactly?** **[Let's find out now!](https://platform.sh/blog/custom-domains-now-available-on-preview-environments/?utm_source=devto&utm_medium=organic_social&utm_campaign=custom_domains&utm_id=platformsh_blog)**