teleren/devto huggingface dataset:
Building Desktop Applications with Electron
Tags: webdev, javascript, beginners, programming
Published: 2024-05-14 00:31:03

## Introduction

In the past, creating a desktop application required extensive knowledge of programming languages and platform-specific tools. However, with the emergence of Electron, building cross-platform desktop applications has become much easier. Electron is an open-source framework that uses web technologies such as HTML, CSS, and JavaScript to create desktop applications for Windows, Mac, and Linux. In this article, we will explore the advantages, disadvantages, and features of building desktop applications with Electron.

## Advantages

1. **Cross-platform compatibility:** One of the major advantages of using Electron is its ability to create applications for multiple operating systems, eliminating the need for developers to write code for each platform separately.

2. **Familiar web technologies:** As Electron uses web technologies, developers with knowledge of HTML, CSS, and JavaScript can easily create desktop applications without the need to learn new languages or tools.

3. **Customizable:** Electron allows developers to customize the appearance and functionality of their application, giving them more control over the user experience.

## Disadvantages

1. **Performance limitations:** Electron applications can be slower and more resource-intensive compared to native applications, as they require an additional layer of web technologies in order to run.

2. **Larger file size:** As Electron applications package all the necessary web technologies, they tend to have a larger file size than other desktop applications.

## Features

1. **Desktop integration:** Electron allows for seamless integration with desktop features such as menus, notifications, and tray icons, giving the user a more native experience.

2. **Automatic updates:** Electron applications have the ability to automatically check for updates and install them, making it easier to push new features and bug fixes to users.

### Example of Electron's Desktop Integration

```javascript
const { app, BrowserWindow, Menu } = require('electron')

function createWindow () {
  // Create the browser window.
  let win = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      nodeIntegration: true
    }
  })

  // Load the index.html of the app.
  win.loadFile('index.html')

  // Build the menu from a template
  const menu = Menu.buildFromTemplate(template)
  Menu.setApplicationMenu(menu)
}

app.whenReady().then(createWindow)
```

This example demonstrates how to create a simple Electron window and integrate a menu into the application, showcasing how Electron interacts with native desktop features.

## Conclusion

In conclusion, building desktop applications with Electron has its advantages and disadvantages. However, with its cross-platform compatibility and use of familiar web technologies, it has become a popular choice for developers. Its features such as desktop integration and automatic updates also make it a convenient option for creating user-friendly and efficient desktop applications.
Python, pickle
Tags: python
Published: 2024-05-14 00:23:28

파이썬의 pickle(피클) 패키지는 list, dict와 같은 파이썬 객체를 그 형태 그대로 저장하고, 불러올 수 있게끔 하는 패키지​입니다. pickle을 이용해 저장된 객체 파일의 확장자도 .pickle 입니다.

다양한 파이썬 객체들을 그대로 저장했다가, 그대로 불러올 수 있다는 대단히 편리한 장점을 가집니다.

물론, 몇십 기가바이트에 이르는 대용량 객체의 경우 저장하는 도중에 메모리 부족을 일으켜 실행이 중단되거나(* 이 문제는 프로토콜 인수 설정을 통해서 어느정도 해결할 수 있습니다.), 실행이 끝나기까지 오랜 시간이 걸릴 수도 있습니다.

하지만 그럼에도 불구하고 피클 객체는 굉장히 편리한 작업을 가능하게 해 줍니다.


객체를 파일로 저장하기(파일 쓰기)
* 파일 이름에는 상대경로를 쓸 수도 있지만, 절대경로를 사용해야 할 경우에는 파일 경로까지(예 : C:/폴더1/폴더2/...) 포함하여 입력해 주어야 합니다.
```
import pickle


with open(file='파일A.pickle', mode='wb') as f:
    pickle.dump(객체A, f)

```
​

picke.load()는 컴퓨터에 저장되어 있는 피클 파일(.pickle 확장자)을 파이썬 내에 객체로 불러와 줍니다.
파일B.pickle을 불러와 파이썬 내에서 '객체B'라는 객체로 할당해 주는 역할을 합니다.

​

파일B.pickle에 저장된 것이 list이면 list, dict면 dict, 문자면 문자 그대로가 불러와 객체로 할당되는 것을 확인할 수 있을 것입니다.
```

with open(file='파일B.pickle', mode='rb') as f:
    객체B=pickle.load(f)

```

pickle.dump()를 사용하여 객체를 피클 파일로 저장할 때, 간혹 한참 실행되던 중 메모리가 부족해져 나머지 작업 실행이 중단되고 파일이 제대로 저장이 되지 않을 때가 있습니다. 이 때 사용할 수 있는 것이 protocol=pickle.HIGHEST_PROTOCOL 인수 설정입니다. 

```

with open('파일A.pickle', 'wb') as fw:
    pickle.dump(객체A, fw, protocol=pickle.HIGHEST_PROTOCOL)

```

_참조 : https://m.blog.naver.com/regenesis90/222340644146_
RDS for MySQLでスロークエリログの出力を有効化する
Tags: aws, rds, mysql, japanese
Published: 2024-05-14 00:20:18

RDS for MySQLでパフォーマンスチューニングを行う上で必要なスロークエリログの出力を有効化する方法について案内します。パフォーマンスチューニングを行う上で、[Performance Insights](https://aws.amazon.com/jp/rds/performance-insights/)も有効な手段ですが、[利用できるインスタンスクラスに制限がある](https://docs.aws.amazon.com/ja_jp/AmazonRDS/latest/UserGuide/USER_PerfInsights.Overview.Engines.html)ことと、[条件によって再起動が必要](https://docs.aws.amazon.com/ja_jp/AmazonRDS/latest/UserGuide/USER_PerfInsights.EnableMySQL.html#USER_PerfInsights.EnableMySQL.reboot)となります。

# スロークエリログとは

[公式ドキュメント](https://dev.mysql.com/doc/refman/8.0/ja/slow-query-log.html)より
スロークエリーログは、実行に長い時間がかかっているため最適化の候補となるクエリーを見つけるために使用できます。

# 有効化方法

1秒を超えるクエリを出力する際には、以下のパラメータを変更することによってスロークエリログをCloudWatch Logsへ出力することが可能です。なお、long_query_timeパラメータは小数点を利用することによってミリ秒単位の指定を行うこともできます。
log_output = TABLE → FILE
long_query_time = 1
slow_query_log = 1

設定したログは以下のように設定タブにあるスロークエリをクリックすることによって参照することができます。

![スロークエリログの参照方法](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dmbnzltwd92quu0d0275.png)

設定にあたり、再起動が許容されているインスタンスであれば、インスタンスにアタッチされているパラメータグループを複製した上で、パラメータを変更したパラメータグループを対象のインスタンスにアタッチするという方法を取ることもできます。
この方法であれば切り戻しが容易です。

なお、パラメータグループには比較機能があるため、パラーメータを変更した後は、複製元のパラメータと比較して上記以外の変更箇所がないことの確認を行うことが望ましいです。

![パラメータグループの比較機能](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/44xo91hxqf2wdzidd715.png)

また、再起動が許容されていないインスタンスの場合には、既存のパラメータグループを複製してバックアップを取得した上で、アタッチ済みのパラメータグループを変更することで即時反映が可能となります。

クエリが遅い状態を再現して改めてパラメータ値を元に戻すという方法で対応ができます。
元に戻す場合には、デフォルト値に戻すというボタンがあるので、活用ください。

![デフォルト値に戻す方法](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bjwagsgvjxjtxr4jb9l3.png)
BACKWOODS CIGARS STORE CANADA
Published: 2024-05-13 23:58:54

Welcome to our corner of cigar paradise! We're your go-to destination for authentic Backwoods cigars and an unparalleled online shopping experience. Explore our curated selection of premium cigars and discover the convenience of [Buy cigarettes online Canada](https://backwoodcigars.ca/product-category/order-cigarettes-online-canada/) from the comfort of your own home. Elevate your smoking game with us today!
Issue 44 of AWS Cloud Security Weekly
Tags: aws, security, cybersecurity, cloudsec
Published: 2024-05-13 23:29:00

(This is just the summary of Issue 44 of AWS Cloud Security weekly @ https://aws-cloudsec.com/p/issue-44 << Subscribe to receive the full version in your inbox weekly).

**What happened in AWS CloudSecurity & CyberSecurity last week May 06-May 13, 2024?**
- Amazon Connect has introduced AWS CloudTrail integration for flow management pages on the Connect admin website. This means that whenever you add, modify, or remove a flow from a flow management page, the corresponding activity is recorded in AWS CloudTrail. This enables enhanced visibility, reporting, and compliance.
- Amazon Elastic Container Registry (ECR) has expanded its compatibility by integrating GitLab Container Registry as an endorsed upstream registry for ECR's pull-through cache functionality. With this latest update, GitLab users can seamlessly synchronize images from the newly incorporated upstream registry to their private ECR repositories.

**Trending on the news & advisories (Subscribe to the newsletter for details):**
- Apple platform security May 2024 report- PDF.
- Zscaler responds to post by a threat actor claiming to have potentially obtained unauthorized information from a cybersecurity company. 
- Threat Actor Claims Sale of Dell Database Containing 49 Million Customer Records.
- Ohio Lottery- Data breach notification. 
- CISA and Partners Release Advisory on Black Basta Ransomware. 
- Dell: Threat actor claims he scraped 49M Dell customer addresses before the company found out. 
- White house- 2024 report on the cybersecurity posture of the united states.
Wsl installation error
Tags: ubuntu, wsl, webdev
Published: 2024-05-13 23:15:51



While trying to optimise storage, I deleted some files in one drive and since then, Ubuntu terminal just stopped working, I tried to repair it but it didn't work, then I uninstalled it completely, now trying to install it but it keeps putting out the errors on the picture.
I've applied every solution on Web but still couldn't resolve it.
Please help me out.
Podcast Palooza— What are you listening to? (Music Edition)
Tags: podcast, music, watercooler, discuss
Published: 2024-05-13 23:01:11

Happy Monday y'all! This is Podcast Palooza, where I gather recommendations for podcasts from the community here at DEV. Today I am teaming up with our trusty [Music Monday](https://dev.to/michaeltharrington/series/17887) thread, by DEV Team's favorite, @michaeltharrington, to grant you with an extra-special music-themed podcast thread. 

---

## Let's do it.

We received a request this week to do a Podcast Palooza thread themed around music podcasts. Your wish is my command— here is that thread! 

Now is the time to share any sort of music-related podcasts, musician interviews, band biopics, album reviews, anything under the sun related to music.

![Person shredding on the guitar](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cikkdyd0rixc8jf1ntww.gif)

---

## How We Do
Drop your links to what you have been listening to recently + browse others' suggestions. You can follow the suggested genre if you'd like, but don't feel confined to it; you're free to suggest whatever you want!

_PS: If you are loving this theme, we also have a podcast tag for your listening musings, sharing your very special new episodes, and finding new things from other people on the internet. Check it out._

{% embed https://dev.to/t/podcast %}

---

See ya below!
-**Rachel**
13章10
Published: 2024-05-13 22:39:40

Javaにおいて、`var`キーワードはJava 10から導入され、型推論をサポートするために使用されます。`var`はローカル変数の宣言でのみ使用可能であり、それ以外の場所で使用するとエラーになります。この制限が存在する理由は、Javaの型システムの安全性と明確さを保持するためです。

以下に`var`の使用が許されるケースと許されないケースを説明します。

### `var`が使用可能なケース:
1. **ローカル変数の宣言**:
   - メソッド内部で、初期化式があり、その式から型が明確に推論できる場合に`var`を使用できます。
   ```java
   var number = 123;  // int型と推論される
   var list = new ArrayList<String>();  // ArrayList<String>と推論される
   ```

### `var`が使用不可能なケース:
1. **メソッドのパラメータ**:
   - メソッドの引数として`var`を使用することはできません。
   ```java
   public void example(var param) { // エラー: メソッドのパラメータではvarは使えない
   }
   ```
2. **クラスのフィールド**:
   - クラスのメンバ変数（フィールド）として`var`を使用することはできません。
   ```java
   public class Example {
       var field = "Hello"; // エラー: クラスのフィールドではvarは使えない
   }
   ```
3. **戻り値の型**:
   - メソッドの戻り値の型として`var`を使用することはできません。
   ```java
   public var example() { // エラー: 戻り値の型にvarは使えない
       return "Hello";
   }
   ```
4. **型パラメータ**:
   - ジェネリック型のパラメータとして`var`を使用することはできません。
   ```java
   List<var> list = new ArrayList<>(); // エラー: ジェネリック型のパラメータとしてvarは使えない
   ```

### なぜこれらの制限があるのか？
`var`はその変数が宣言されるブロック内で完全に型情報を推論できる状況でのみ使用されることを意図しています。クラスのフィールドやメソッドのパラメータでは、その型が複数のスコープにわたって一貫して明確でなければならず、`var`を使用すると型の不明瞭さが生じる可能性があるためです。これにより、コードの読みやすさ、保守性、および型安全性が保たれます。
OAuth2.0
Tags: webdev, beginners, programming, learning
Published: 2024-05-13 22:35:47

_**Hello!** This is my first post, and it marks the beginning of a very important journey for me. I’m learning that writing about what I study is one of the best ways to consolidate new concepts. So, let’s dive together into the fascinating world of OAuth 2.0!_

## What is OAuth 2.0?

Contrary to what many initially think, OAuth 2.0 is not an authentication method, but rather an authorization protocol. This means it allows a service (like a website or app) to access resources on another service on your behalf without having to share your sensitive credentials, such as passwords.

For example, have you ever logged into a third-party app using your Google account? Here’s how it works, simplified:

- **Access Request:** When you choose to register using your Google account, the third-party site requests access to Google.

- **Authorization:** You authorize the third-party app to access certain information from your Google account.

- **Access Token:** After authorization, Google issues an access token to the third-party site. This token acts as a secure credential that allows the site to access your approved information for a limited period, usually it is in JWT format ( JSON Web Token). If you want to know more about JWT, I can create a post about it.

- **Refresh Token:** After authoriztion , Google also issues a refresh token to the third-party site. This token will be used to refresh the validation of the access token.

## Behind the Scenes

When the third-party site receives the access token, it uses this token to request your information from Google’s resource server. The server verifies the token and, if valid, provides the requested information to the site, and the refresh token acts to revalidate your access token to avoid you to do all this process everytime, but remember that the refresh token isn’t forever!

The token itself is a key element — it is not a digital certificate but a secure string that grants temporary access. This ensures that your password remains private and reduces the risk of unauthorized access.

## Importance of Scope

Defining the scope of access is crucial. The scope specifies exactly what information the third-party app is allowed to access and what actions it can perform with that access. For example, if you authorize an app to access your basic profile information, it shouldn’t be able to read your email unless explicitly permitted by the scope of authorization.

## Visual Example

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jg9akgx5ump36xt1vba0.png)
A diagram that describes the OAuth2.0 proccess behind the scenes

## Conclusion

Ihope this post has helped clarify what OAuth 2.0 is and how it works. It’s a fundamental concept in internet security today, facilitating a smooth and secure user experience by separating the authorization process from the user’s primary credentials.
Refactorizar 1º día
Published: 2024-05-13 22:34:34

Llevo tiempo creando un portafolio propio, voy muy despacio, lo único que tengo es un navbar y un juego para aprenderse los verbos en inglés (solicitado por mis compañeros).
Después de picar código de forma deprisa para tenerlo lo antes posibles, me he dado cuenta de que este es una basura y he decidido refactorizar el componente.
Hoy he hecho un pequeño cambio, pero que la verdad me daba vértigo y no es era muy buena idea. El cambio se trataba de una función que cargaba los datos a un array (68 campos), el cambio que he realizado ha sido pasarlo a un fichero de datos y en la función anterior leer el fichero de datos y así limpiarlo.

Siguiente paso será hacer funciones mas genéricas y lo meterme con la maquina de estados que he creado.


![Codigo limpio](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m6tfgsck46j71t1gxynm.png)


![Codigo sucio](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1k778g5pygywgszhyjhb.png)
13章9
Published: 2024-05-13 22:33:44

新たに可変長引数を受け取るメソッド`setValue(String... values)`をオーバーロード（追加）する。

つまり、以下のように`A`クラスを修正することで、可変長引数を受け取る要求に応じられます：

1. **単一の文字列**を受け取る既存の`setValue(String value)`はそのままにします。
2. **複数の文字列**（可変長引数）を受け取る新たな`setValue(String... values)`メソッドを追加します。

```java
public class A {
    private String value;

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value; // 既存のメソッド
    }

    public void setValue(String... values) {
        StringBuilder sb = new StringBuilder();
        for (String val : values) {
            sb.append(val);
        }
        this.value = sb.toString(); // 新たなメソッド
    }

    public String toString() {
        return getValue();
    }
}
```

このようにすることで、`A`クラスは単一の文字列または文字列の配列、いずれかを受け取ることが可能になり、`Main`クラスで`a.setValue(args);`を呼び出した際にエラーが発生しなくなります。
About selling a solution
Tags: ecommerce, indiedevelopment, hacking, products
Published: 2024-05-13 22:27:08

Learning how to sell and making your productive attractive are the main concerns you may have while designing a new commercial solution.

## Breakthrough

The first thing you have to consider while designing something you want to sell, is: who are the first commerces, people or companies that you are willing to go after?

A product need to have users and customers to be able to survive and be useful. 

Engineering was created with one main purpose: solving problems that ordinary people are not able to solve.

## How to make something attractive

Attractiveness is all about offering something someone does not have. So let us follow this line and understand some things: there are a lot of products that does the same as yours, maybe some of them are even cheaper. How can you manage to have their customers or to make sure that the new customers of this specific market are going to follow yours instead of theirs?

I think you may have heard about the concept of "Skin in the game" -- basically, you need to insert yourself deeply into the subject you want to succeed -- so, let us apply the book fundaments into the product market.

If you are willing to sell a product to supermarkets, being able to go to actual supermarkets and take a look at their difficulties is a pretty smart way to only aim at the really important stuff and only develop solutions to what they are really trying to improve or solve. Working assertive is working smart.

## About work subject

Choosing the right work subject is following one only path and not being dragged into others. Let me contextualize this: when you start to aim at one use case and then start to try to embrace a lot of others, your product will lose focus and will not be good at any of its features.

Choosing where and how to work previously will help you to know where your product working subject starts and where it ends.

## Network. Talk to people

Talking to people about their work problems can be a good approach to understand what will your app be about. You may talk to a doctor to understand which tech is missing at hospitals. You may talk to a teacher to understand how you could make their job easier. You may talk to a e-commerce owner to understand what metrics or features he would like to have in order to sell more and easier.

You need to talk to people and you need to show them that you are concerned about their work and how it could be better.

## Conclusion

Basically, the smartest way to sell your product is to talk to people and understand what they need, what they want their commerce to have, what issues are they facing daily and mainly: how your product can be useful.

This is the key to attract customers.

-------

Photo by <a href="https://unsplash.com/@and_machines?utm_content=creditCopyText&utm_medium=referral&utm_source=unsplash">and machines</a> on <a href="https://unsplash.com/photos/a-black-background-with-blue-and-pink-lines-HErhYBxhreE?utm_content=creditCopyText&utm_medium=referral&utm_source=unsplash">Unsplash</a>
School Services
Tags: real, life, school
Published: 2024-05-13 22:01:37

Students should be able to complete their education without experiencing financial difficulties in their education life.
Dormitories where students stay and service fees should not be expensive due to financial difficulties.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s0932l27dbahlgokd9fb.jpg)
Increases and fees imposed without taking into account the financial and educational status of students cause difficulties for students.
The silence of the authorities on this situation makes the situation even more difficult.
Authorities need to find a solution to this situation, otherwise it will do nothing but alienate students from education.
For this reason, service fees should be charged proportionally according to distance.
Day 1 of Coding Bootcamp
Published: 2024-05-13 21:49:24

Currently a grade 2 teacher learning to code for a change in my career. As a teacher working in a paperless school, I ave never looked at the backend/behind the senses development of web design, but recently became extremely interested in it. So, here I am, 26 years old, beginning my journey with Columbia University. 

Week 1: The Beginning
This week I learned about basic coding concepts and terminology. I also learned about User Stories and Acceptance Criteria. When building a website it is important to always keep in mind your reason for construction, Who you are building it for, What you are building it for, and the Why. 
I also have begun following two coding moguls, Jem Young (engineering leader for Netflix) and Rachel Nabors (Web animations expert). 
In module 2 of my pre-work, I was given the assignment to create this account and choose a blog to read and post about. While clicking away I am across a heading that immediately grasped my attention, "Visualize your colors and fonts on a real site". In this article I learned that you should use primary and secondary colors on your website. The primary colors are used for main CTA's and sections while secondary colors are used for less important buttons and information cards.
I also read blog called "Growth Mindset for Life". In this blog I learned about the importance of being someone who is easy to be taught. Having a growth mindset means you are open to constructive criticism and challenges. Having this mindset will help you grow in all aspects in life. A fixed mindset will keep you stagnant.
StarDict: Dictionary for your terminal
Tags: tutorial, productivity, linux, software
Published: 2024-05-13 21:15:36

On most repositories, there's `sdcv`, the [console version][1] of [StarDict][2] program.<br>Freely available [dictionaries in StarDict format][3] for offline use.

Use [html2text][4] to correct the dictionary's HTML output for reading at the console.

Set up an [alias][5] for easy lookup.

For example, this alias would setup french definition's:

```bash
sdcvfr() {
  sdcv --data-dir="/path/to/french_file" --non-interactive "$1" | html2text --ignore-emphasis
}
alias sdf='sdcvfr'
```

Now, just type: `sdf développeur`

Any language, instantly, with a single command!

  [1]: https://linux.die.net/man/1/sdcv
  [2]: https://stardict-4.sourceforge.net/index_en.php
  [3]: https://tuxor1337.frama.io/firedict/dictionaries.html
  [4]: https://pypi.org/project/html2text/
  [5]: https://linuxize.com/post/how-to-create-bash-aliases/