teleren/devto huggingface dataset:
Use latexindent on macOS Big Sur
Tags: latexindent, perl, macos, latex
Published: 2021-04-14 20:34:47

---
title: Use latexindent on macOS Big Sur
published: true
date: 2021-04-14 19:23:56 UTC
tags: latexindent,perl,macos,latex
canonical_url: 
---

ตัวช่วยจัด indent source ของ LaTeX คือ latexindent แต่บน macOS จะต้องติดตั้ง cpan modules เพิ่มเติมนิดหน่อย

```
Can't locate File/HomeDir.pm in [@INC](http://twitter.com/INC) (you may need to install the File::HomeDir module) ([@INC](http://twitter.com/INC) contains: /usr/local/texlive/2021/texmf-dist/scripts/latexindent /Library/Perl/5.30/darwin-thread-multi-2level /Library/Perl/5.30 /Network/Library/Perl/5.30/darwin-thread-multi-2level /Network/Library/Perl/5.30 /Library/Perl/Updates/5.30.2 /System/Library/Perl/5.30/darwin-thread-multi-2level /System/Library/Perl/5.30 /System/Library/Perl/Extras/5.30/darwin-thread-multi-2level /System/Library/Perl/Extras/5.30) at /usr/local/texlive/2021/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm line 22.
```

ถ้าเจอ error นี้ให้ติดตั้ง modules ต่างๆ ดังนี้

เริ่มแรกให้กำหนด CPATH ให้ชี้ให้ถูกต้อง

```
export CPATH=/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/System/Library/Perl/5.30/darwin-thread-multi-2level/CORE:$CPATH
```

หลังจากนั้นก็ให้ติดตั้ง CPAN Modules

```
cpan install File:HomeDir
cpan install Unicode::GCString
```

ปล. ผมเลือก sudo ตอนที่ CPAN ถามนะครับ
From Swinging Hammers to Flatiron Software Programmer
Published: 2021-04-14 19:07:16

####The Beginning
Around June or July in 2020 I was sitting on a wellsite next to a drilling rig waiting to perform a cement job.  As I went to the rig floor to conduct the safety meeting the driller said the price of oil was 10 cents a barrel.  The lowest that it had ever been since they started keeping track of the cost.  I thought that he was joking as many roughnecks do and brushed it off.  After the meeting I went back to my pickup and grabbed my phone.  He was not only serious but the price of oil plummeted to -35 dollars a barrel.  This was a huge eye opener for me as my company was filling bankruptcy and selling its assets and the oilfield was in for another hard downturn.  I started looking into what options I could have and found software engineering.  This sparked my interest and I researched further.

####Flatiron Wins
After all the blogs articles and polls Flatiron was always there.  They offered career help after graduation and could teach you what you needed to get your career jumpstarted.  I filled out the entry forms, had a meeting with a very nice lady who said I would be an excellent candidate for Flatiron.  This was exciting and nerve wrecking all at once.  I quite my job and put the money down to get started in learning programming.

####Zero Knowledge
I had no idea what this was going to entail.  I knew very little JavaScript because I took a course in high school and never messed with it again.  This was many years ago.   But, I made sure that my entry reviewer knew that and she was confident that I could pick it up and succeed.  

####What's Ruby?
The first thing that was taught to me in the course material was Ruby.  A programming language that has been around for some time now and gaining more popularity.  This was like being dropped in Germany and told you had to go order a pizza.  It was very daunting, but after a lot of persistence and struggle I was able to start catching on.  There were some labs that just seemed way to overwhelming but then reaching out on Slack my classmates were in the same boat.  We all helped each other out through the toughest problems.

####Projects and Reviews 
At the end of every 3 week phase in the course you were tasked with creating your own project with the programming that you just learned.  You get one week to turn in the project and then you schedule a review.  This was always stressful because if I failed the review I would have to retake the phase which was not something that I really could do.  I setup myself to complete the program in 5 months and that's what I intended to do.  

####The New Beginning
I have just finished the program mid April 2021, and I am ecstatic.  I went through a death in the family and then a divorce in the middle of the final project, but was still able to achieve my goal with the help and support of everyone at Flatiron.  This program truly is amazing and I would recommend it to anyone who is even thinking about getting into a career in the software field to give Flatiron a chance.
HIRING: Chief Technology Officer @Color of Change
Tags: career
Published: 2021-04-14 19:02:16

Color Of Change is hiring its first [Chief Technology Officer] (https://colorofchange.recruiterbox.com/jobs/fk0utfr?source=devto) - a core member of the senior leadership team.

Color Of Change is one of the largest Black-led racial justice organizations in the country with more than 10 million members. Their team has been at the forefront of some of the most impactful campaigns to challenge injustice and hold corporate and political leaders accountable to Black communities.

The organization is making deep investments in technology and data to continue growing its talented, innovative team in-house. This is a perfect opportunity for someone looking to have an impact on critical campaigns in this moment in time.

Please pass along to communities or individuals where there may be a strong fit.
Iconic developers  🧐🤠🤪
Tags: discuss, webdev, watercooler, programming
Published: 2021-04-14 18:48:43

> Photo by <a href="https://unsplash.com/@danielkcheung?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Daniel Cheung</a> on <a href="https://unsplash.com/s/photos/lego?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>
 
_EDIT: If there are three or more good profiles in the comment I will dedicate a new post to them, let's see how many we can create!_ 
# Developers
Developers, they come in all shapes and sizes. What do most of them have in common? They don't like to be put in a box. Despite this I'm going to do just that 😜 I'm going to try to capture different developer characteristics by matching them with their own personal icon 😊 I'd really like to know: with what kind of developer can you relate to the most? I'll start by describing 3 types, but please feel free to leave your own "iconic developer" in the comments!
___
## 🧐 The know-it-all
This programmer always seems to know the best solution, at least that's their belief. 

#### Habitat
Enjoys being around other programmers to showcase their knowledge. Can mostly be found crawling the web.

#### Best to ask for
Doing research on new frameworks/tools because gathering knowledge is their power.

#### Needs works on
Mostly needs to work on getting stuff done. There is a big difference between code in your head and actual code.

___
## 🤠 The cowboy 
This programmer writes code faster than their shadow. This speed comes with a cost though. 

#### Habitat
Enjoys hackathons and feels comfortable in a team with other cowboys! 

#### Best to ask for
Creating a proof of concepts that needs to be done fast.

### Needs works on
Writing code that is less prone to error and easier to maintain. Mostly the code of a cowboy is not something you want the change later on.
___
## 🤪 The funny one 
Making puns all day and leaving Easter eggs left and right in the code. Keeps the team happy!

#### Habitat
Are at their best in a close team. Likes to add joy to programming!

#### Best to ask for
Creating a proof of concepts that needs to be done fast.

#### Needs works on
Being less influenced by the mood of others. Consistency in the code is hard if the mood is off.
___
## There must be more 😎
Please let me know what you can come up with!
To get you started:
😎😁🤐😴🤑😤🐱‍👤

```markdown
## 💻 [name]

#### Habitat

#### Best to ask for

#### Needs works on
```

Looking forward to your creativity!
Hacer peticiones HTTP con Laravel y Guzzle
Tags: php, laravel, esp
Published: 2021-04-14 18:43:19

Hola, en esta oportunidad les vengo a mostrar como hacer peticiones HTTP con Guzzle en Laravel.

Lo primero que tenemos que hacer es instalar Guzzle en nuestro proyecto:

```php
composer require guzzlehttp/guzzle
```

Una vez instalado podemos usarlo en cualquier parte con la clase http que usa Guzzle, esto importandola con la instruccione use:

```php
use Illuminate\Support\Facades\Http;
```

En este caso yo lo estoy utilizando para realizar peticiones en el mismo proyecto, y el resultado de la petición poder usarlo en el test


```php
<?php

namespace Tests\Feature;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;
use App\Models\Product;
use Illuminate\Support\Facades\Http;

class appServicecsProductServiceTest extends TestCase
{
    /**
     * A basic feature test example.
     *
     * @return void
     */
    public function test_create()
    {   
        $product = Http::post('http://localhost:8000/api/admin/productos', 
            ['product_title' => 'producto_de_prueba',
            'product_price' => '200000',
            'product_content' => 'Este producto es importado de italia',
            'product_photo' => 'imagen.png',]
        );
       
       $this->assertEquals($product->body(), 'Product has been created successfully');
    }
}
```

Estos son los distintos métodos que nos van a permitir acceder al estado de la petición:

```php
$product->body() : string;
$product->json() : array|mixed;
$product->collect() : Illuminate\Support\Collection;
$product->status() : int;
$product->ok() : bool;
$product->successful() : bool;
$product->failed() : bool;
$product->serverError() : bool;
$product->clientError() : bool;
$product->header($header) : string;
$product->headers() : array;
```
Y como el body de la petición me devuelve:

```php
Product has been created successfully
```
el test pasa:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9gsykz5n2blj2fl05p7q.png)


Para mas información pueden visitar la documentación de Laravel: [https://laravel.com/docs/8.x/http-client](https://laravel.com/docs/8.x/http-client)
Wednesday Links - Edition 2021-04-14
Tags: java, jvm, maven, kotlin
Published: 2021-04-14 18:25:57

Profiling is undervalued tool (30s read) 🦄
https://twitter.com/richardstartin/status/1379783843251650560?s=19

Bitemporal History Design Pattern (15m read) 🥸
https://martinfowler.com/articles/bitemporal-history.html

How to solve dependency conflicts with BOM (13m read) 🤞
https://reflectoring.io/maven-bom/

Kotlin Plugin 2021.1 makes your development faster (7 min read) 🚀
https://blog.jetbrains.com/kotlin/2021/04/kotlin-plugin-2021-1-released/

Hands on Foreign Linker API introduced in JVM 16 (34 min read) ☕️
https://blog.arkey.fr/2021/02/20/a-practical-look-at-jep-389-in-jdk16-with-libsodium/

Small improvements in JVM 16 (7 min read) 🧐
https://nipafx.dev/java-16-stream-mapmulti/

Have a fun learning about custom Splitterators (12 min read) 👾
https://www.javaspecialists.eu/archive/Issue289-MergingSortedSpliterator.html
Ubuntu 20.04: fix wifi not working on Lenovo ideapad 330
Tags: ubuntu, linux
Published: 2021-04-14 18:13:10

A few days ago i installed the latest LTS version of Ubuntu. Yep, it's Ubuntu 20.04 with code name focal fossa on my Lenovo ideapad 330.

The installation is easy and run smoothly because i used LAN for the internet connection. When the installation process is done, i tried to open YouTube to test my internet connection and yeah it works well.

After that, i unplugged the LAN and try to use wifi as my internet connection, but i cant found the wifi settings on my laptop. I though my wifi is error, so i tried to connect my smartphone to the wifi and it's connected.

Okay, i plugged the LAN again and tried to found the solution for this problem and it didn't take long time to find the answer.

The problem occurred because Lenovo ideapad 330 used Realtek RTL8821CE for its wifi adapter and the driver is not provided in the fresh installation so, you need to install it manually.

I found this helpful [GitHub gist](https://gist.github.com/debojyoti/228729498628e898497557db57619a28) that will guides you to fix this issue, but i will cover it here and make it simple so, you don't need to be confused.

Let's begin :)

### 1. clone the repository
First, we need to clone [this repository](git clone https://github.com/tomaspinho/rtl8821ce.git). Please make sure you have installed the right version of Ubuntu because this laptop is only working with minimum version 18.10.

Open your terminal and type these command.
```sh
git clone https://github.com/tomaspinho/rtl8821ce.git
```
```sh
cd rtl8821ce
```

### 2. install the driver
Run these command one by one.
```sh
sudo make all
```
```sh
sudo make install
```
```sh
sudo modprobe -a 8821ce
```
Wait until the installation process done. Now, open your settings and you should see the wifi settings right there :).
I added a spaceship to my game
Tags: unity3d, devlog, csharp
Published: 2021-04-14 17:55:43

I'm currently developing my first 3D game in Unity. It's a parkour FPS game. Recently I added aliens as enemies into the game. But it didn't make much sense to have aliens on a parkour map. 
So I added a spaceship to the game. But how can you do parkour in a spaceship? Well... the spaceship consists of multiple parts which are connected with parkour. The game is settled at the edge of space, that's why there is gravity. I also made an FPS arm and a weapon switching system for the player. You can watch the full 7 minute devlog video here: https://youtu.be/ZPChXCuhpx8
What do you think about the game so far? Any feedback is greatly appreciated.
LaTeX Errors: Document 
Tags: latex, codenewbie
Published: 2021-04-14 17:25:21

Hello, this is the second post about Errors, in this time we are going to talk about *Errors in the Document*

> I am going to write the error in `this format`, the description of the error in *this format* and the possible solution in normal format

# General Errors in the Document

- `Improper prevdepth` *You forgot to close the environment with `\end{myEnvironment}`* Find what is the environment which is causing troubles and then close it
- `LaTeX Error: \begin{Environment} on input line *** ended by \end{OtherEnvironment}` *You misspelled the name of the environment when closing it* Check if the name of the environment is the same and correct it 
-` No error message, just paused` *You have forgotten to put `\end{document}`* Put that instruction and everything is going to be ready :) 
- `LaTeX Error: Missing \begin{document}`
    - Some contents which must be inside the `\begin{document}` are outside this
    - You have forgotten the `\begin{document}` environment

Check that environment and the instructions that you have put and write them inside `\begin{document}`

- `Missing endcsname inserted` *You put a `\` in the name of an environment, for example, `\begin{\document}`* Check the name of the environments and delete the `\`
- `LaTeX Error: verb illegal in command argument` *You have written the `verb` (verbatim) command inside another command* 
    - If you want the style of verbatim in your text you can try `{\tt your Text}`
   - Put the `verb` command outside that environment

- `LaTeX Error: Not in outer par mode` *You nested some environments which can not be nested* There is not a simple solution for this, because, sometimes you want to do something specific but LaTeX does not support that. 
    - Try to put the environment outside the other environment
    - Search for some environments which can do that you want

This is all for today, thanks :)
#3 of 100DaysOfCode 
Tags: 100daysofcode, react, javascript, codenewbie
Published: 2021-04-14 17:14:52

Third-Day, well that was pretty mindboggling. I made another project using React and, I feel great about this one. 😀

The syntax is quite overwhelming but still not as bad as callback hell and the schemas in MongoDB so it's Ok.

Anyway, I learned the following things today.
* TC39 is the technical community that makes yearly releases of ECMAScript. - more of a did you know❓ really
* Classes in ES6.
* fetch *API*, *promises*, *async*, and *await*. 
  Just enough to make the app working otherwise I have no idea how they work
* Class Component in React - This one is the hero to the day.
  + functionality of constructor and this in the class component 
  + what is *React.Component* class 
  + super() constructor 
* render() - A class component must have a render() function
* '*props*' keyword (plural) in class component not <del>*prop*</del>
* Styling in react
  + Its value. 
  + And the fact that there is no double curly braces syntax to pass styles in the *style* property, there we are just passing a javascript object and outer curly braces denotes that it's a dynamic expression syntax
* properties inside a 'state' in a class component has to be an object, it can't be of any other data type
* *class field* - for example
```javascript
constructor(props){
  super(props);
  this.state = {
    profiles: [], // just some variable name
  }
}
```
something like that can be replaced by something like this (lol slick code 😂)
```javascript
state = {
  profiles: [],
}
```
* Input in react
  + via normal DOM API (i.e. querySelector())
  + via ref() - react syntax 
  + via controlled elements - exciting one 

The issue I face today is in line 67 of the [completed file](https://github.com/icecoffee-dev/-3_100DaysOfCode_GithubCardsApp/blob/main/github%20Cards%20App-Class%20Components/GithubCardsApp%20Complete.jsx) If anyone wanna check it out.

Their instead of this,
```javascript
addNewProfile = (profileData) => {
this.setState(
  prevState => ({
    profiles: [...prevState.profiles, profileData],
  })
)
};
```
I tried to push values directly in the array without using setState()
```javascript
addNewProfile = (profileData) => {
  this.state.profiles.push(profileData) 
// it didn't gave an error but the DOM also never updated itself. 
};
```

Yeah, and this about sums it up.
The part that I most struggled with is the input one but it was quite simple actually, the only thing that I am lacking right now is practice and I am sure after making some more projects, I'll be able to master this.

👉 This is my today's [work](https://github.com/icecoffee-dev/-3_100DaysOfCode_GithubCardsApp/tree/main/github%20Cards%20App-Class%20Components)

👉 You can build and run the files on this [playground](https://jscomplete.com/playground) 

Thanks for reading this and joining me, 😀
Wish me luck.🤗
Have a beautiful day. 🌻
How I Automated the Unemployment Call Hotline with JavaScript.
Tags: javascript
Published: 2021-04-14 17:13:15

The goal is to get a hold of a representative from New York state's unemployment office. New York state has an unemployment claim help hotline is a series of prompts that drags then after about 5 minutes, you're spit out into a ditch on the side of the New Jersey Turnpike, and the call hangs up. Rinse, repeat, rinse, repeat.

These systems are automated, why should we have to repeat the same prompts over and over and over. Most automated call systems allow you to press 0 to speak to a representative, however not the NY unemployment hotline. It seems like they deliberately make the series of prompts very difficult to navigate. 

Alas there is a simple way to automate this on our end. Most digital phone apps treat a comma (,) as a two second pause, so we can use and abuse this to our advantage.

I created a browser bookmarklet (piece of code that runs in on any page in the browser) for Google Voice. The script will start "recording" keypresses and append a comma every two seconds and log them to the console.

{% embed https://gist.github.com/reggi/97287e8a89bdee59f80b85074148076e %}

To add this bookmarklet to your bookmark bar, follow these steps:

1. Copy the minified / formatted code below
2. Right click on the bar, click "Add Page"
3. Paste the code in the "URL" field.
4. Click "Save"

Now, go to https://voice.google.com/, open "Developer tools" and then click on the bookmarklet you created.

Then all you need to do is copy the output from the browser's console, you may need to add some beginning commas for the initial prompt, as commas only start appending after the first keypress.

```
‪(888) 209-8124‬,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9,,,,,,,,,,,,,,2,,,,,,,,,,,<SOCIAL-SECURITY-NUMBER>,,,,,,1,,<FOUR-DIGIT-PIN>,,,,,,2,,2,,2,,,,,,,,,,,5,,,,,,1
```

From there you would need to replace `<SOCIAL-SECURITY-NUMBER>` and `<FOUR-DIGIT-PIN>` with your own personal information. Be careful when automating anything with your personal information, be cautious when finding phone numbers and make sure they come from the businesses website directly.

Caveats, if the hotline changes the prompts, the generated number will break, so keep tabs with updates to the hotline.
Destructuring nested object
Tags: javascript, codenewbie, webdev, beginners
Published: 2021-04-14 17:13:12

Task: Destructuring `response.body.count`.
```js
const response = {
  msg: "success",
  body: {
    count: 5,
    data: ["File 1", "File 2"],
  },
};

const {
  body: { count },
} = response;

console.log(count); // 5
```
Here, first **body** is destructured, then **count** is destructured from **body**.


---

**Thanks for reading 💙**  
Follow **@codedrops.tech** for daily posts.  
[Instagram](https://www.instagram.com/codedrops.tech/) ● [Twitter](https://twitter.com/codedrops_tech) ● [Facebook](https://www.facebook.com/codedrops.tech/)

Micro-Learning ● Web Development ● Javascript ● MERN stack ● Javascript  
**[codedrops.tech](https://www.codedrops.tech/)**
Kotlin collection methods – groupBy(), sumByDouble(), mapValues(), toSortedMap() example

Tags: kotlin, groupby, sumbydouble
Published: 2021-04-14 16:56:00

Kotlin collection methods – groupBy(), sumByDouble(), mapValues(), toSortedMap() example
https://grokonez.com/kotlin/kotlin-collection-methods-groupby-sumbydouble-mapvalues-tosortedmap


In the tutorial, <a href="https://grokonez.com">Grokonez</a> will show you how to combine Kotlin collection methods: <code>groupBy()</code>, <code>sumByDouble()</code> with Kotlin List and <code>mapValues()</code>, <code>toSortedMap()</code> with Kotlin Map.

<!--more-->
<h2>1. Kotlin collection methods - groupBy(), sumByDouble(), mapValues(), toSortedMap()</h2>
<code>groupBy()</code> with method signature:

<pre><code class="language-java">
public inline fun <T, K> Iterable<T>.groupBy(keySelector: (T) -> K): Map<K, List<T>>
</code></pre>

-> <code>groupBy()</code> is used to group elements of the given collection by the key returned by the given [<strong>keySelector</strong>] function. Result is a map collection.

Practice:

<pre><code class="language-java">
val productList = listOf(Product("iPhone 8 Plus 64G", "Apple", 850.00),
							Product("Samsung Galaxy S8 64GB Unlocked Phone", "Samsung", 699.99),
							Product("iPad Pro 9.7-inch 32 GB", "Apple", 474.98),
							Product("Samsung Electronics Ultra HD Smart LED TV", "Samsung", 677.92),
							Product("Google Pixel Phone - 5 inch display", "Google", 279.95),
							Product("iPad Pro 9.7-inch 128G", "Apple", 574.99),
							Product("Google Wifi system 1-Pack", "Google", 149.90),
							Product("Samsung Galaxy Tab 4", "Samsung", 127.67))

val groupProductsWithMadeBy = productList.groupBy { it-> it.madeBy }
groupProductsWithMadeBy.forEach { println(it) }
/*
	Apple=[Product(name=iPhone 8 Plus 64G, madeBy=Apple, price=850.0), Product(name=iPad Pro 9.7-inch 32 GB, madeBy=Apple, price=474.98), Product(name=iPad Pro 9.7-inch 128G, madeBy=Apple, price=574.99)]
	Samsung=[Product(name=Samsung Galaxy S8 64GB Unlocked Phone, madeBy=Samsung, price=699.99), Product(name=Samsung Electronics Ultra HD Smart LED TV, madeBy=Samsung, price=677.92), Product(name=Samsung Galaxy Tab 4, madeBy=Samsung, price=127.67)]
	Google=[Product(name=Google Pixel Phone - 5 inch display, madeBy=Google, price=279.95), Product(name=Google Wifi system 1-Pack, madeBy=Google, price=149.9)]
*/
</code></pre>

More at:

Kotlin collection methods – groupBy(), sumByDouble(), mapValues(), toSortedMap() example
https://grokonez.com/kotlin/kotlin-collection-methods-groupby-sumbydouble-mapvalues-tosortedmap