teleren/devto huggingface dataset:
My Git/Github Learning Adventures
Tags: learninggitandgithub
Published: 2019-10-10 14:46:33

Learning Git and Github have been challenging and fun.
I have found both the confidence and knowledge to move forward and I would like to share some of that journey here.
When I began this class I didn't know anything about coding or really anything about programming at all. 
Other than the limited knowledge I've acquired from my oldest son who is in the IT field, I was beginning this adventure with very limited knowledge. 
At first my confidence in my ability was non-existent, but each hour and day brings more knowledge and more confidence in my own ability in the IT industry.
This week we focused on learning Git and Github and the challenge did not disappoint! I did multiple exercises fully before I even started to understand what I was doing.
It felt a little frustrating at first and that frustration built monumentally all the way up until one day it all just clicked and suddenly made sense.
WHAT A SENSE OF RELIEF!
Everything I had done up until then suddenly felt familiar and I was able to begin helping my peers and gaining momentum. 
When I look back on some of the frustration I was feeling I feel blessed to have the ability to work past it and grow as a person. 
Let's take a look at some of the things I've learned on my Git/Github journey!
First, if you're unfamiliar with VCS and how it works this can be quite daunting, but my advice is just keep moving forward because it gets easier! 
Git is the command line tool, and GitHub is an open source repository hosting site that facilitates things like work flow and collaboration.
A repository is a a central location in which data is stored and managed, with both local and remote accessibility, giving users the ability to modify and collaborate seamlessly. 
When working in the Local repository a user has the ability to pull changes from the remote repository, work and modify locally,then push changes back to the remote with record of change.
GitHub uses something called Github Flavored Markdown (GFM), an easy-to-read/write syntax for formatting plain text. 
GFM is a strict superset of CommonMark,and content not specified on the original CommonMark Spec are known as extensions.
The design goal of MarkDown's formatting syntax is to make it as readable as possible. 
The idea is that a Markdown-formatted document should be publishable as-is, without looking marked up with tags and formatting instructions.
The functionality of Github as an open source is to help programmers and coders collaborate and contribute to each others codes. 
It hosts your source code projects in a variety of different programming languages and keeps track of the various changes made to every iteration.
The basic commands used are user friendly, creating an easy environment to work with multiple team members on multiple facets of the project at the same time.
I am still trying to figure out the push and pull operations, and look forward to the "click" that I know is coming, with perseverance. 
Onward I march into the Git fray.

“You don’t have to be great to start, but you have to start to be great.” –Zig Ziglar
Daily Challenge #87 - Pony Express
Tags: challenge
Published: 2019-10-10 14:31:35

---
title: Daily Challenge #87 - Pony Express
published: true
series: Daily Challenge
description: How many riders does it take to deliver a package?
tags: challenge
---

The Pony Express was a mail service that operated from 1859-60 in the United States. It was made completely obsolete by the intercontinental telegraph. 

There were a number of stations where a rider would stop to switch to a fresh horse, or pass the mail bag along to another rider to continue the trek.

`stations` is an array/list of distances in miles from one station to the next along the route. 

Implement a `riders` function, to return how many riders it would take to get from point A to point B. Riders will never agree to riding more than 100 miles.

example: stations = [43, 23, 40, 13]
output: 2 riders

Good luck!

***
_This challenge comes from dinglemouse on CodeWars. Thank you to [CodeWars](<https://codewars.com/>), who has licensed redistribution of this challenge under the [2-Clause BSD License](<https://opensource.org/licenses/BSD-2-Clause>)!_

_Want to propose a challenge idea for a future post?  Email **yo+challenge@dev.to** with your suggestions!_
IBM i "Book" Chapters 1 and 2
Tags: ibmi, rpgle, as400, rpg
Published: 2019-10-10 14:02:39

---
title: IBM i "Book" Chapters 1 and 2
published: true
description: Chapter 1 and 2 of my book Learning IBM i as a Lowly Web Developer
tags: IBMi, RPGLE, AS400, RPG
---

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/c6f51nssiylzsvrn5wwl.png)

This is a post to say that I have "completed" the first two chapters of my small "book" **Learning IBM i as a Lowly Web Developer**. (Most of the core content is in an acceptable state, but may still be tweaked when I read it over for the millionth time).

The work in progress can be found at https://barrettotte.github.io/IBMi-Book/#/


## Preface
It should be obvious, but I'm not a writer and barely a programmer sometimes.
This book is lazy and heavily relies on "learning by example". Therefore, it might be tough for some people to follow. But, I do try to briefly explain and walkthrough writing each program.

I also decided to use SEU throughout this book just to get the full "green screen" experience. If you can code in SEU, you can code in something better be default.

I do mention [ILEditor](https://github.com/worksofbarry/ILEditor) and plan to include a brief overview of this awesome IDE so that people have the option to use it instead of ancient SEU.


## Chapter 1
https://barrettotte.github.io/IBMi-Book/#/core/ibmi/index

In chapter 1, I mainly go over operating system concepts and Access Client Solutions (ACS). This includes some Source Entry Utility (SEU) and Program Development Manager (PDM).

For practice, I walkthrough creating a library, source physical file, and a CL source member. Additionally, I step through compiling and running a three line CL program.


## Chapter 2
https://barrettotte.github.io/IBMi-Book/#/core/cl/index

In chapter 2, I give an overview of the syntax/structure of CL and start writing some basic CL. The example CL program I provided accepts user input via inquiry and echos it back to the user as a message.

For a more beefy example, I included a subpar implementation of fizzbuzz in CL to go over subroutines, conditionals, and loops. It could definitely be a better implementation, but I think it serves its purpose just fine.


## Conclusion
I hope to keep making progress on this book as I feel inspired. The next chapter is going to be on the basics of some old RPG and newer RPGLE. Additionally, I hope to add more content to the CL chapter on the differences between newer CLLE vs CL.

If you happen to read the book and have a suggestion on an improvement, please open an issue in my repository here https://barrettotte.github.io/IBMi-Book/#/ and I'll definitely consider it. After all, I'm still a complete noob to the IBMi and could use all the help I can get.

On a related note, my company allowed me to attend [RPG & DB2 Summit](https://www.systemideveloper.com/summit/conferences.html) in Minneapolis. I'm 23 so I'll be sticking out like a sore thumb around all the seasoned IBM i developers. I hope to learn a bunch of cool content to include/mention in this book.
Was it fair coding task assessment?
Tags: csharp, career, discuss, codequality
Published: 2019-10-10 14:01:08

Warm greetings to community of [dev.to](https://dev.to)

Recently I tried to apply on a job in a software development company (what a surprise :))

I've got coding task description and a deadline date from them and started to work. Task was implemented and sent back for assessment, but I've got negative feedback and they decided not to proceed further with me.

I understand that my solution is not optimal and can be improved significantly in a different ways, that's for sure. I just tried to be pragmatic and followed Occam's razor principle.

But... could anyone from community be so kind and please tell me if company assessment was fair enough comparing **initial task description** and **assessment notes**?

I would be very grateful for you opinions.

##### Here is assessment notes:
> After review of the task I cannot evaluate it with positive outcome. The task is simple and very small but still should be done according to the latest coding standards.

> Positives:
* Convertion of numbers was well tested
* Detailed input validation with error handling

> Negatives:
* Everything is static in whole project, no dependency injection, no interfaces
Hepler methods in region in Main class
* No unit tests for the supporting methods as there is only one static that gives output
* Inline function with logic in one big switch case that cannot be tested out
* Even if it wasn’t specified it would be good to close the convertion functionality in as service to be able to use it in different apps

> To summarize I cannot recommend such task and candidate for client verification.

Here is repo with the task description and sources written on C#: {% github AndreyWeber/NumberToWords %}
Breto - A Multi-UI Status Bar
Tags: go, linux, dwm, tmux
Published: 2019-10-10 13:52:01

[View on Github](https://github.com/jrswab/breto)

Breto (originally called Go-Status) is a small project I wrote a few months back to display the time and date in DWM. It's written in Go and the name means "shelf" in Esperanto.

Even though it started as a way to display the time in my DWM bar it now does much more and even works in other window managers.

If you have any feature you'd like to see added feel free to send a pull request or open an issue. I would like to add as many blocks as is deemed useful by anyone using this application.


## Current Features:

### Blocks:

- Date & Time
- Weather via wttr.in
- Total RAM not used
- Total space left in the home directory
- Icons

### Current UIs:

- DWM
- i3wm
- tmux

### Icons:

To display icons in DWM:

1. Install FontAwesome v4
2. Set FontAwesome as the second font in `dwm/config.h`
   - eg. `static const char *fonts[] = { "Source Code Pro:size=13", "FontAwesome:size=14" };`
	 - Relaunch DWM

### Current Icons:

- Tempurature
- Disk
- RAM
- Volume
- Syncthingt
- Dropboxt
- Redshift

Currently, the icons are much too small to be useful in Tmux or i3wm without further configuration.

If you have an easy way to display FontAwesome icons at the same scale as the terminal text please submit a pull request.

## How To Use:

1. Open main.go in a text editor.
1. If cloned from Gitlab change the custom package directories from Github to Gitlab.
2. Edit the last `status` variable to contain the blocks you wish to use.
3. Change the last line to match your UI (eg, `ui.Dwm(status)`).
4. Build the binary.
5. Edit your config file to use the new binary.

### Adding to DWM:

- Simply set `ui.Dwm(status)`, compile, and execute.
- If you already have a startup script for DWM just add a new line for go-status

### Addng to Tmux:

- `set -g status-right "#($HOME/PATHTO/tmux-status)"`
 - If you have colors in this setting add the path at the end of the string
 - Be sure to use the correct path and name of the file you built with GO.
 - Running `mv go-status ~/tmux-status` will allow you to use `"($HOME/tmux-status)"` in your config.
- `set -g status-right-length 53`
 - If you are not using all the custom packages this number can be lower
 - This also will vary based on screen size. 53 is the minimum that worke for all current blocks
 - If you notice the status getting cut off just increase the number and reload tmux.

### Adding to i3wm:

- In the i3wm confige file, change `status_command ...` to `status_command PATH/TO/go-status`

## Wttr.in Options:

1. Add your area to the weather function
   - Area Code: 'wttr.in/~00000?format=2' 
   - City: 'wttr.in/~Paris?format=2'
	 - More information can be found at [wttr.in/:help](https://wttr.in/:help)
2. Add tweaks to `blocks/wttr.go`

## To-Do:

1. ~~Get a proper name~~
2. Scale icons in tmux and i3wm

## License:

MIT
5 steps for becoming a great team leader
Tags: skills, teamleader, teamwork, leadership
Published: 2019-10-10 13:43:05

Here’s a list of 5 valuable points to help you improve your leadership skills:

1. *Guide with the example*
The key is to be willing to work hand in hand with the members of your team and, in times of crisis, assume the responsibility that corresponds to you and be consistent with it. It is not only a matter of being able to make important decitions, a leader must also have criteria in doing so. Many bosses make arbitrary decisions that the team does not share or respect, and that is a mistake.

2. *Communicate, but really, every day*
Great leaders make sure they are heard and understood, but they also know that it is important to listen. Sometimes team members are not very expressive or eloquent, and that’s why a leader must encourage communication to ensure that everyone is focused in the same direction.

3. *Acknowledge your limits*
A good leader has self-confidence and, when committing to something, goes for it with courage. However, you must always recognise the things that go over your capabilities and be ready to ask for help whether it’s from a mentor or even from one of your team members.

4. *Become a teacher, then delegate*
Give your team the authority to express opinions and to take charge of their responsibilities. But also, never forget to take the time to explain work, before letting them go solo. If a leader acts with integrity, he will be encouraging the loyalty and self-esteem of the group, and the gratification will come as high productivity and commitment.

5. *Be optimistic, but also realistic*
One of the responsibilities of the leader, although not exclusive, is to keep the team’s motivation high. To achieve this, it is certainly essential that you always maintain a positive attitude. However, always improve your planning and organizational skills to pursue and achieve more realistic goals, in order to live up to your team’s expectations.


Hope you find this useful, and remember, if your have your team’s trust even in chaos, you’re doing just fine!
Responsive Off-Canvas Menu
Tags: codepen, javascript, css
Published: 2019-10-10 13:18:36

---
title: Responsive Off-Canvas Menu
published: true
tags: codepen, javascript, css
---

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/2zhnazpb0k6k1aw2cweo.png)

{% codepen https://codepen.io/giandomenico/pen/bGGVpQV %}
Locator Strategy: CSS Selector
Tags: css, testing, beginners
Published: 2019-10-10 13:14:41

# Preface:
In my previous blog I discussed about XPath. In this blog I will try to focus on some most important concepts in CSS Selector. I will strongly recommend to read the Locator Strategy: XPath before reading this blog.

CSS Selector should be preferred when we don’t have any suitable Id or name. Selectors are patterns that match against elements in a tree, and as such form one of several technologies that can be used to select nodes in an XML document. For more information visit W3C Recommendations.
Syntax:
## Direct Child:

In CSS, “>” is used to define the direct child relationship between the elements. For example:

`html>body`

Body tag is the direct child of html tag.

## Descendent(sub-child):

If an element is the any child or grand child of the current element, but not a direct child in CSS it is defined by whitespace.

`div img`

That means, img tag is a descendant of div tag, but not a direct child.

## Finding Element using Id and Class attributes:

For Id attribute in an element CSS has a special symbol “#”. Unlike XPath you can find element directly using Id.

`#products`

This will find the element that has id ‘products’.

Like Id you can identify element using class name. For that you need to use “.”.

`.setter`

You can use above selector to find element that has class name setter.

## Finding elements using other attributes:

CSS support finding elements using attribute other then Id and class. Have a look on the following example:

`img[title='English']`

Finding an image element using attribute title.

## Finding elements using multiple attributes:

You can find element using multiple attributes.

`img[title='English'][alt='United States']`

## Use of Wildcards:

CSS supports use of wildcard characters like “^”, “$” and “*”.

You can use “^” with attribute name to simulate ‘starts-with’. Let’s see an example:

`img[title^='En']`

This will find any image tag that has an attribute named ‘title’ with value starts with ‘En’.

Let’s see the use of “$”.

`img[title$='sh']`

It simulates ‘ends-with’. Will find an image tag that ends with value ‘sh’.

“*” is used to find any specific pattern in the value of attributes.

`img[id*='n_U']`

Here it will search for image tag with a pattern ‘n_U’.

# Conclusion:
In this blog, I focused on the basic usage of CSS Selectors. Next time I will explain some of the advanced topics of CSS Selectors. Till then practice…
Stop Thinking In Lifecycle Methods
Tags: react
Published: 2019-10-10 18:52:53

---
title: Stop Thinking In Lifecycle Methods
published: true
tags: react
canonical_url: https://ianjones.us//stop-thinking-in-lifecycle-methods
---

## The Problem

I hear a lot about how to translate class lifecycle methods into hooks. I think this can be helpful at first explaining them but harmful in the long run if this is the only way you think about hooks.

componentDidMount is a lifecycle method that can trip you up if you try to implement it with hooks. You want something to run just once and set some values in your component state.

Say a component took a user id and called some endpoint to load the user:

```js
function User({ id }) {
  const [user, setUser] = React.useState()
  React.useEffect(async () => {
    const userResult = await axios.get(`/users/${id}`)
    const { data } = userResult
    setUser(user)
  }, [])
  return <div>{user ? user.name : 'loading...'}</div>
}
```
This looks fine if you are thinking about components in a class lifecycle way. There is a subtle bug here though. Say someone navigated away through React Router and changed pages without re-rendering this component. This effect wouldn't re-run. If you landed on another users page, the old data would be there until a page refresh occured.

## The Explaination

We need to think of react hooks in a new way. Don't build your hooks like you would your class components. Think of our components in effects and state. Our useEffects allow us to sync our effects with our state.

In this case, our state is the user inside of the component. We fire off an effect so that we can eventually load the user into state. This effect has an id dependency. Thus, we need to add that to our dependency array:

```js
function User({ id }) {
  const [user, setUser] = React.useState()
  React.useEffect(async () => {
    const userResult = await axios.get(`/users/${id}`)
    const { data } = userResult
    setUser(user)
  }, [id])
  return <div>{user ? user.name : 'loading...'}</div>
}
```
If your effects are interacting with your state and changing it, then you need to make sure that effect runs every time your state changes.

The Solution
Luckily, we can have our code editor tell us when we are using state inside of an effect.

The React team has built an eslint plugin that checks the state you use in an effect and makes sure that state is also in the dependency array.

If you are using a recent version of CRA, then you already have this eslint rule installed!

The eslint plugin for React hooks can save you from introducing subtle bugs into your application.

`yarn add eslint-plugin-react-hooks --dev`

The react team suggests this configuration:

```js
{
  "plugins": [
    // ...
    "react-hooks"
  ],
  "rules": {
    // ...
    "react-hooks/rules-of-hooks": "error",
    "react-hooks/exhaustive-deps": "warn"
  },
  // I had to add this for my set up
  "parserOptions": {
    "ecmaVersion": 7,
    "sourceType": "module",
    "ecmaFeatures": {
      "jsx": true
    }
  }
}
```
Importing Stored Procedures in Apache Cayenne
Tags: java, orm, tutorial
Published: 2019-10-10 13:02:27

## Executive Summary

Add to the cayenne plugin's dbImport section in your pom.xml:

```xml
<includeProcedure>Procedure_Name</includeProcedure>
```

Run your maven commands:

`mvn cayenne:cdbimport`
`mvn cayenne:cgen`

The second should result in:

`Add procedure Procedure_Name`

You can use your procedure via:

```java
// Returns a ProcedureResult
ProcedureCall
.query("Procedure_Name")
.param("param_name", param_value)
.call(context); // The previously created context.
```

To return a particular class:

```java
ProcedureCall
.query("Procedure_Name",ModelClass.class)
.param("param_name", param_value)
.call(context); // The previously created context.
```

To return a List of your particular class:

```java
ProcedureCall
.query("Procedure_Name",ModelClass.class)
.param("param_name", param_value)
.call(context) // The previously created context.
.firstList();
```

## Backstory

I'm currently using [Apache Cayenne](https://cayenne.apache.org/) for a project I'm working on for a friend. It's been really useful so far, but a couple days ago I realized it wasn't automatically importing my new stored procedure. Although there's [code](https://cayenne.apache.org/docs/4.1/api/org/apache/cayenne/query/ProcedureCall.html) for *calling* procedures, I was having a hard time ensuring my procedure was imported when I ran the `cdbimport`/`cdbgen` commands. Additionally, I was having a *really* hard time finding resources/examples.

In the end I ended up using "ol' reliable"- ctrl + space. After stepping through the sub-sections in pom.xml's cayenne plugin section I found one tag named `<includeProcedure>`. Adding it to the `<dbImport>` section is what finally did the trick: 


<!-- Other entries... -->
	<build>
		<plugins>
                <!-- Other entries... -->
			<plugin>
				 <groupId>org.apache.cayenne.plugins</groupId>
				<artifactId>cayenne-maven-plugin</artifactId>
				<version>${cayenne.version}</version>
				<configuration>
					<!-- Other entries... -->
					<dbImport>
						<defaultPackage>com.example</defaultPackage>
						<includeProcedure>Procedure_Name</includeProcedure>
					</dbImport>
				</configuration>
                        <!-- Other entries... -->
			</plugin>
		</plugins>
	</build>


After making this change, run your cayenne `cdbimport`/`cgen` commands again and you will be able to use the Procedure like so:

```java
ProcedureCall
.query("Procedure_Name")
.param("param_name", param_value)
.call(context); // The previously created context.
```

There's more to the ProcedureCall than just this example, so be sure to check out the Executive Summary above and its [Javadoc](https://cayenne.apache.org/docs/4.0/api/org/apache/cayenne/query/ProcedureCall.html).

Hopefully this will save someone some time in the future.