teleren/devto huggingface dataset:
Ruby Methods
Published: 2023-11-30 02:17:07

A **method** is a reusable section of code written to perform a specific task in a program. 

Reasons to divide programs into methods:

1. If something goes wrong in your code, it's much easier to find and fix bugs if you've organized your program well. Assigning specific tasks to separate methods helps with this organization.

2. Makes your program less redundant and code more reusable - not only can you repeatedly use the same method in a single program without rewriting it each time, but you can even use the method in another program.

**Method Syntax**

Methods are defined using the keyword **def**.

There are three parts:
 
1. The _header_, which includes the def keyword, the name of the method, and any _arguments_ the method takes.

2. The _body_, which is the code block that describes the procedures the method carries out. The body is indented two spaces by convention.

3. The method ends with the **end** keyword.

**Parameters and Arguments**

If a method takes arguments, we say it _accepts_ or _expects_ those arguments. 

The _argument_ is the piece of code you actually put between the method's parentheses when you call it, and the _parameter_ is the name you put between the method's parentheses when you _define_ it. 

**Splat**

_Splat arguments_ are arguments preceded by an asterisk. this tells the program that the method can receive one or more arguments.

The syntax for defining a method that has multiple arguments is as follows:

```
def what_up(greeting, *friends)
  friends.each { |friend| puts "#{greeting}, #{friend}!" }
end

what_up("What up", "Ian", "Zoe", "Zenas", "Eleanor")
```

The **"*"** symbol before the friends parameter, indicates that this method can receive multiple friend arguments. 

**Return**

Return, hands us back a value. 

The **return** keyword is used to specify the result that the method should produce. When you call the method, it "returns" this result, which you can use then use in other parts of your program.

If you replace return with print in a method, the method will output something into the console, but it won't produce a result that you can use in your code. So if you need to use the result of a method elsewhere in your program, you need to use return, not print.
01.SSH
Published: 2023-11-30 01:55:31

As everyday I go to bus station and use Busmap HaNoi(you can download on appstore and chplay, if you travel Ha Noi in Viet Nam and want to journey by bus) to check bus time comming.I will pick up 2 or 3 bus route to my company.

I have used SSH for remote my job but I can not explain detail information How it work. I am surfacing internet and as a post on dev.to, it is a detail explanation. So I want to note on my page:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a6whyxvrzy2h2fv55b2s.png)
In real life, this is what the analogy translates to:

You == developer.
Your bedroom == your laptop, or whatever local machine you're typing on.
The Metaverse == a remote machine/server you are trying to access from your local machine.
The VR headset == the SSH tunnel that allows you to access the remote machine (Metaverse) from your local machine (bedroom).
Login screen == the SSH key pair that ensures only authorized parties can use the SSH tunnel. I'll explain this more thoroughly in a later section of this blog.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0r4lhlcja6i9tgphu0ep.png)
In layman's terms, SSH is like a secure, secret tunnel that lets you connect to another computer over the internet. It helps you do things on that computer as if you were sitting right in front of it.

**Why do I need to use SSH?**
a: _Deploying Code_
IBM BPM
I always use to deploy snapshoot on IBM BPM
Network:
I use to configure the network equipment
b: _Updating a server configuration_
other: config IoT gateway.....

**It was better for 2 main reasons.
**
_Encrypting data_
Let's say that part of the data being transmitted from my machine to a remote machine is the string "username: jesswang password: ?IamC00l!". Without encryption (so with older protocols like Telnet or FTP), a hacker would be able to read that string as you just read it. With encryption, the data they get back might look like "H23kLs*^!d8%PwZx0KsL!9B#N%u@i8". In reality, the encrypted data would be a different sequence of bytes that adheres to encrypted algorithmic standards (that I don't know much about), but this is just to give you an idea.

_Authentication_
Older programs like Telnet relied solely on password-based authentication. When you connect to a remote system using Telnet, the Telnet server prompts you to enter a username and password to login. However, Telnet transmits your passwords in plaintext, making it easy for hackers to read. SSH primarily uses a different (and better) approach called public-key authentication. I'll explain how it works below so you can understand how your information is better protected from hackers.

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

Source:https://dev.to/therubberduckiee/explaining-ssh-to-my-uber-driver-38a
New to Dev.to!
Tags: webdev, javascript, programming, beginners
Published: 2023-11-30 01:52:50

Hey everyone! I'm new to Dev.to and just wanted to say hi! I'm currently on the first steps of web development and want to join the community and learn more. I have a certificate in Python, and have done a bit of playing around in CSS, HTML, and Javascript. Can't wait to learn more and share with you all the projects that I'm working on!
震惊世界！！！美国黑客恶意卖数据？
Published: 2023-11-30 01:44:53

我们应该强烈抨击美国黑客恶意卖数据的行径，呼吁相关部门加强监管和打击黑客攻击行为，维护网络和信息安全，保障公众的合法权益和安全。同时，我们也应该加强信息安全意识教育，提高公众对于信息安全的认知和自我保护能力。
#美国黑客 #恶意 #卖数据是一种极其不负责任和危险的行为，这种行为不仅违反了法律和道德规范，也严重侵犯了个人隐私和信息安全。

#黑客攻击是一种违法行为，违反了计算机犯罪法等相关法律法规，这种#恶意行为不仅会对个人和社会造成严重的危害，而且也会对#黑客自身带来法律风险和不良后果。

#黑客 #恶意 #卖数据的行为是对个人隐私的严重侵犯。个人数据是极其敏感和私人的信息，一旦落入不法分子手中，就可能导致身份盗窃、欺诈等严重后果。这种行为不仅对个人造成了不可挽回的损失，也对整个社会造成了极大的安全隐患。

#黑客 #恶意卖数据的行为也破坏了信息安全的信任基础。这种行为让人们对于互联网和信息安全的信任度降低，进一步加剧了信息安全的风险和挑战。
Generic ML framework
Published: 2023-11-30 01:21:23

Guys I have abstracted the ML.NET framework into a library that takes away a lot of the hard work for using ML.NET. And of course being generics based you don't need to cut and paste any code! Checkout https://genericml.odoo.com/. I imagine that this will be a B2B thing. Your devs can become basic data scientists overnight. With Python something like 80% of all models developed by Python data scientists never get into production probably due to the impendence of the tools as apps are built with other .net/java etc. With the framework its really easy to build tools that the business can use to build models on a laptop. Look mum no containers or GPUs required! Contact me at alistair@genericml.com
Planning for Release 0.4
Published: 2023-11-30 01:20:07

In release 0.3, I made two PRs([286](https://github.com/tarasglek/chatcraft.org/pull/286), [302](https://github.com/tarasglek/chatcraft.org/pull/302)) to [ChatCraft](https://github.com/tarasglek/chatcraft.org), but there is still a big gap before the merge. So in release 0.4, the plan is to refine these two PRs, including the following tasks:

1. Directly paste image to attach
2. Image in chat messages can be clickable to see full version.
3. Resize the image in the browser within the max size of the image that OpenAI will process
4. Optimize the image locally so upload is faster
5. Investigate issue: lot of horizontal scrolling on mobile
6. Update the icon on mobile to a camera
7. Support the camera use case, but also attaching a photo from the camera roll
Plesk 升級筆記
Tags: plesk
Published: 2023-11-30 00:24:31


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

[Plesk](https://www.plesk.com/) 是一款伺服器管理系統，透過 Plesk，我們可以比較方便的在主機上配置各種服務與應用，例如最典型的虛擬主機，Plesk 可以幫助我們配置 web server 的 vhost 設定，另外像是資料庫、DNS、郵件、防火牆等的都可以在 Plesk 內做配置，在應用方面，也支援 PHP 服務，還可以指定每一個虛擬主機所要搭配的 PHP 版本，雖然以上這些事都可以透過手工自行配置，但 Plesk 提供了友善的 web 界面以及更為周全的配置設定，包括負載監控、遠端備份、系統更新、TLS 憑證管理、第三方服務整合等，對要建構一個可靠的服務而言，Plesk 是個很省力的選擇。

## Plesk CLI

一般來說我們都是用 web 界面對 Plesk 做操控，但其實 Plesk 也是有提供 CLI 的工具讓我們可以在 shell 內操作 Plesk，當然，想要用 shell 操作 Plesk 的先決條件是我們必須可以透過 SSH 登進主機內，這點前提是一定要的，如果是自己的主機自己裝的 Plesk，那應該是都有 SSH，但若是外購主機，那很有可能主機商不會提供你 SSH 的權限，那只能殘念了。

下面記錄本人的 Plesk CLI 筆記，會隨著時間而增加內容。

Plesk 的命令就是 `plesk`，而因為 Plesk 本身是管理許多服務的軟體，所以通常也必須搭配 `sudo` 使用，容先敘明。

## 更新 Plesk

Plesk 本身也是由許多的作業系統套件所組成，但它有自己的套件管理體系，與 Plesk 自己本身組件管理有關的命令通常都是被歸納在 `installer` 這個子命令內，例如要更新 Plesk 自己，使用以下命令：

```sh
$ plesk installer update plesk
```

要注意，上面這行一旦執行就會立馬更新，不會再次確認，使用前務必確認前置作業是否已完成，例如備份—最重要也最常被忽略的事。

正常情況下，上面的命令會幫我們把 Plesk 自己更新，但有時會遇到有另外一個 Plesk Installer 安裝程序在執行，導致我們無法重複執行的問題，這時候我們必須先把既有的安裝程序終止：

```sh
$ plesk installer stop
```

上面這行會把原有的 Plesk 安裝程序終止，終止之後再跑上面的更新命令應該就可以順利執行了。


## 升級 Plesk

在 Plesk 目前的版次是這樣的：

**18.0.28 Update 3**

前面的 18.0.28 表示版次，從 18.0.28 到 18.0.29 稱為升級（upgrade），以升級的命令處理，而從 18.0.28 到 18.0.28 Update1 稱為更新（update），以上節的 `update` 子命令處理。更新和升級雖然都是對軟體的改版，但更新往往表示規模較小，大多是一些錯誤修正或安全性補丁，而升級的版次跳號象徵著幅度更大的改版，除了錯誤修正與安全性補丁外，可能還會有新特性的加入或舊特性的退役，然而不管是更新還是升級，都建議在施做前，對系統做一次快照備份，施做後有問題才有機會挽回。

升級的命令與更新類似，但稍有不同的是更新必須明確的指定目標版號：

```sh
$ plesk installer upgrade plesk 18.0.29
```

上面這行表示「把 Plesk 升級到 18.0.29 版」。

關於 Plesk 新版的釋出資訊，可以看 [Change Log for Plesk Obsidian](https://docs.plesk.com/release-notes/obsidian/change-log/)。


## 相關文章

- [Plesk / Cloudflare / Lightsail 混合架構的安全規劃](https://editor.leonh.space/2020/cloudflare-lightsail-plesk/)
Best CSS Resources For Web Developers 💻
Tags: webdev, tutorial, css, frontend
Published: 2023-11-30 00:14:37

**_If you're looking to learn or improve your skills in CSS (Cascading Style Sheets), plenty of resources are available online. Here are some recommendations:_**

---

### Online Courses:

1. **MDN Web Docs: CSS Basics**
   - Website: [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web/CSS_basics)
   - Description: Mozilla Developer Network provides comprehensive documentation on CSS basics. It's a great starting point for beginners.

2. **freeCodeCamp: Responsive Web Design Certification**
   - Website: [freeCodeCamp](https://www.freecodecamp.org/)
   - Description: FreeCodeCamp offers a hands-on coding curriculum. Their Responsive Web Design Certification covers HTML and CSS.

3. **Codecademy: Learn CSS**
   - Website: [Codecademy](https://www.codecademy.com/learn/learn-css)
   - Description: Codecademy provides an interactive learning experience for CSS. The platform offers hands-on coding exercises.

### Books:

1. **"CSS Secrets: Better Solutions to Everyday Web Design Problems" by Lea Verou**
   - Description: Lea Verou shares advanced CSS techniques and solutions in this book. It's suitable for those who want to deepen their understanding of CSS.

2. **"CSS: The Definitive Guide" by Eric A. Meyer and Estelle Weyl**
   - Description: This book is a comprehensive guide to CSS. It covers CSS2 and CSS3 specifications, making it a valuable resource for both beginners and experienced developers.

### Reference Websites:

1. **W3Schools - CSS Tutorial**
   - Website: [W3Schools CSS Tutorial](https://www.w3schools.com/css/)
   - Description: W3Schools provides a comprehensive and easy-to-follow tutorial on CSS. It includes examples and a try-it-yourself editor.

2. **CSS-Tricks**
   - Website: [CSS-Tricks](https://css-tricks.com/)
   - Description: CSS-Tricks is a website with articles, guides, and tips on CSS. It covers a wide range of topics from beginner to advanced levels.

### Practice Platforms:

1. **CodePen**
   - Website: [CodePen](https://codepen.io/)
   - Description: CodePen is an online code editor that allows you to experiment with HTML, CSS, and JavaScript. You can also explore and fork pens created by others.

2. **CSS Diner**
   - Website: [CSS Diner](https://flukeout.github.io/)
   - Description: CSS Diner is an interactive game that helps you learn and practice CSS selectors.

### Advanced Topics:

1. **"CSS Grid Layout" by MDN Web Docs**
   - Website: [MDN Web Docs - CSS Grid Layout](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout)
   - Description: MDN's guide on CSS Grid Layout is an excellent resource for mastering this powerful layout system.

2. **"Flexbox Froggy"**
   - Website: [Flexbox Froggy](https://flexboxfroggy.com/)
   - Description: Flexbox Froggy is an interactive game for learning Flexbox, a layout model in CSS3.

Remember to practice regularly and build projects to reinforce your learning. CSS is best learned through hands-on experience, so try to apply what you learn in real-world scenarios.
What’s the Optimal Coding Environment?
Tags: discuss, codenewbie, beginner
Published: 2023-11-30 00:00:00

---
published_at : 2023-11-30 00:00 +0000
---
What's your preferred coding environment and tools for maximum productivity? Share your tips.
<br>
Follow the CodeNewbie Org and #codenewbie for more discussions and online camaraderie!
{% embed https://dev.to/codenewbieteam %}
What Makes Confident People Confident, Including Healthy Boundaries?
Tags: discuss
Published: 2023-11-30 00:00:00

---
published_at : 2023-11-30 00:00 +0000
---
What makes confident people confident, including healthy boundaries? Discuss your thoughts.<br>
Follow the DEVteam for more discussions and online camaraderie!
{% embed https://dev.to/devteam %}
taming the rhizome
Tags: gamedev, writing
Published: 2023-12-24 16:21:15

---
title: taming the rhizome
published: true
date: 2023-11-30 00:00:00 UTC
tags: [ 'gamedev', 'writing' ]
canonical_url: https://onwriting.games/daily/20231130-1915-taming-the-rhizome/
---

Game designers have a basic design tool: the mechanics.

These are things that the player **can do to change the state**.

A typical example is "jumping". Or "running".

In narrative games, "choosing an option" is a mechanic.

A very common practice for designers is to choose a mechanic and **design around it**.

That is, to explore all the ways that this mechanic can be used and that are interesting.

Once they exhaust a mechanic, if it's not enough to sustain a game, they explore another mechanic and eventually the **combination of both**.

This strategy is precisely to solve a problem that we share when writing dynamic stories: **taming the rhizome**.

Game designers could create endless rules for special cases, and these rules generate first and second order consequences that greatly complicate the design.

Many games suffer from this problem and **become incoherent**.

If we write without thinking too much, and we constantly create ad-hoc variables to represent such and such a state, it becomes **very difficult** for us to maintain coherence throughout our story.

It's already difficult to be coherent in a linear story, imagine if there are 120 variables that we have to keep in mind at all times.

That's why it's a good idea to sit down and think: what is the minimum set of variables that I can have in my story, so that it's not **too difficult for me to reason about it** but at the same time it's **interesting for the player**?

In Dance of the Spirits, I'm experimenting with 3 very important variables, which I'm using for the definition of the story and the consequences of actions, and 5 or 6 that are less relevant.

The important variables are defined quite early in the story, one is randomized and the other two are tied to some player decisions.

The less relevant variables have more to do with enabling or disabling options to the player according to the actions they took, but they do not significantly affect the story.

My estimate is that the game is going to have about 35,000 or 40,000 words.

I'm still not clear if the 3 variables are enough to generate something interesting, but I think they are.

I share this to start identifying some kind of parameter of what might be needed depending on the size of the story.

If you have worked on a narrative game that did something like this (designing the story around a bunch of variables), I'd love to hear your experience! Reply to this email and let me know.
Optimizing Python application's Docker image with strip
Tags: python, docker, optimize
Published: 2023-12-04 10:39:57

---
title: Optimizing Python application's Docker image with strip
published: true
date: 2023-11-30 00:00:00 UTC
tags: python, docker, optimize
canonical_url: http://aivarsk.com/2023/11/30/python-docker-strip/
---

I was going through some Docker images of large applications and looking at the layer sizes with `dive`. A lot of space was used by installed dependencies under `/usr/local/lib/python3.10/dist-packages/` and virtual environments. Yes, there were a lot of `.py` and `.pyc` files as you would expect but the largest files were the `.so` files. In one of the cases, there were 269M of compiled C and C++ code in shared library files (`find /usr/local/lib/python3.10/dist-packages/ -name "*.so" | xargs du -hsc`). I suspected that it was too much and most of them might contain the debug information. And I don’t think Python developers would use the `gdb` and look at backtraces of C++ code. So I tried to remove the debug information with `strip`. And behold - the size was reduced to 119M, and more than 100M were saved.

So now I added striping of libraries right after the `pip install` command in `Dockerfile`:

```
find /usr/local/lib/python3.10/dist-packages/ -name "*.so" | xargs strip

```

Even for simple projects with SQLAchemy, it reduces shared library size from 4.9M to 980K. I think it’s worth keeping this trick in my toolbelt.
Throwback Thursdays in Tech History: Three Topics in Video Games History
Published: 2023-12-14 18:49:54

---
title: Throwback Thursdays in Tech History: Three Topics in Video Games History
published: true
date: 2023-11-30 00:00:00 UTC
tags: 
canonical_url: https://gingerkiwi.dev/blog/2023-11-30-three-topics-in-video-games-history/
---

_Note: This is one of many posts that were done on LinkedIn while this site was being developed and are now being migrated over. Being formatted for LinkedIn means this is an easy to scan list, rather than paragraphs. At some point, I'll go back and turn these posts into proper articles._

This week we look at three topics in video games history! 🎮

## Contents

1. The first games console - way before Atari existed.

2. 1970s and 1980s text based adventure computer games 🔮

3. Blind accessible gaming on the Nintendo Switch 🦮 + 🎮 = 🥳

## 1. Two Videos about Ralph Baer and The Brown Box 👴

1. [This Man Invented the World's First Video Game Console](https://youtu.be/-I73oK9q-jk?si=g57-EFJE5ZIGZs4t)

- 11 Nov 2013
- Time: 5:01

1. [Meet Ralph Baer, the Father of Video Games](https://youtu.be/83ThW_HjtBg?si=R-N5kdgRHCsXvste)

- 8 Dec 2014
- Ralph Baer developed the first home video game console
- Time: 17:21
- Channel: [Motherboard](https://www.youtube.com/Motherboardtv) (Tech by Vice)

## 2. Text Adventure Games 🔮

[1985: Making TEXT ADVENTURE Games](https://youtu.be/qXAubRZ-qjw?si=eTlOqg7XmHYe6j2T)

- 10 Nov 2022
- Fred Harris goes behind the scenes at Boston software company Infocom.
- The developer has enjoyed great success with its line of text adventure games - the likes of Zork, Planetfall, Enchanter, and The Hitchhiker's Guide to the Galaxy
- which eschew graphics in favour of a simple text display, and arcade gameplay in favour of what the company calls 'interactive fiction'.
- This clip is from Micro Live, originally broadcast 29 November, 1985.  
Time: 7:58  
Channel: [BBC Archive](https://www.youtube.com/c/BBCArchive)

🌌 Play the 30th Anniversary Edition of [The Hitchhikers Guide to the Galaxy game](https://www.bbc.co.uk/programmes/articles/1g84m0sXpnNCv84GpN2PLZG/the-game-30th-anniversary-edition)

## 3. How Blind Gamers Play Nintendo Switch 🦮 + 🎮

[How Blind Gamers Play Nintendo Switch](https://youtu.be/wZx63C60rRw?si=EQDUh0Qo7FfH0X8n)19 Dec 2017

- As a legally blind gamer, people have asked me James what games he has found accessible and why?
- James tackles the accessibility of the Nintendo Switch from games, hardware, to software.  
Channel: [James Rath](https://www.youtube.com/@jamesrath)

Check out [#a11yTO - Accessibility Toronto on LinkedIn](https://www.linkedin.com/company/a11yto/) and the [A11yTO gaming website](https://gaming.a11yto.com/) to learn more about accessible gaming!
Code Challenges pt. 2
Tags: webdev, javascript, programming, codenewbie
Published: 2023-11-29 23:29:44

Part 1 of this series is [Reverse a String](https://dev.to/bencodes/code-challenges-pt-1-3df7).

#####Next up, we're working with Palindromes

Prompt:
You are given a string. Check to see if it is a palindrome. If it is return true, if it is not return false.

Include all characters (spaces, punctuation, numbers, etc.) in determining if the string is a palindrome.

Note: Palindromes are words that are the same when spelled forwards as backwards, e.g. racecar.

Example outcomes:
isPalindrome('racecar') === true
isPalindrome('animal') === false
isPalindrome('mom') === true

Code:
_Note: all we're doing is checking to see if the string is the same forwards as backwards..._

```
function isPalindrome(string){
    const reversed = string.split('').reverse().join('')
    return reversed === string
}
```
_Why does this work?_

First we just make a reversed copy of the string.

We could use the for-loop version ([Version 2 of Reverse a String](https://dev.to/bencodes/code-challenges-pt-1-3df7)), but it's not the _only_ thing we're doing so we might as well just use the built-in methods.

From there, since all we're doing is comparing the string being passed in to the reversed copy, we return the boolean value from the expression `reversed === string`.