teleren/devto huggingface dataset:
Personal Update: Back At It
Tags: update
Published: 2018-09-07 06:06:45

---
title: "Personal Update: Back At It"
published: true
description: I haven't written a post in a while and I need to write something to give myself a kick start.
tags: update
cover_image: https://thepracticaldev.s3.amazonaws.com/i/u067xwpepsn8578e0n9h.jpg
canonical_url: https://assertnotmagic.com/2018/09/06/back-at-it/
---

*Cover image by Feliphe Schiarolli on Unsplash.*

Hi!  I haven't written a blog post in a while.  In fact, I'm way behind my pace for the last two months.  I wanted to bang at least 200 words out to keep my writing muscle in shape and get things going again.  I've got a couple of posts planned, but I'm sure more inspiration will come.

## Back to School!

On a personal note, part of why I've been busy *not* writing blog posts is because last week I had my first lecture of my Master's in Computer Science (focus on Intelligent Systems, Robotics, Systems Administration, and a bit of Security/Forensics)!  I'm super excited, because, honestly, I really like school.  I'm going to take a bunch of classes over the next two years, learn a lot, get a whole bunch of fodder for more blog posts, graduate (God willing!), and once I get my Master's, hopefully, somebody somewhere will let me teach classes on something.  That's about as far as I got on the plan.  Anyways, wish me luck, and enjoy the deluge of CS-powered blog posts that are coming your way.

## Punch Cards

Last week, I didn't have much time to write a post because I was writing a research paper on the early punch cards used to program computers.

 > It was pretty punchy, but it had a few holes in it. HA!

As it turns out, the reason why you probably limit your code lines to 80 characters wide is because of how long U.S. money was in the 1880's.  A guy named [Herman Hollerith](https://en.wikipedia.org/wiki/Herman_Hollerith) created punch cards for the U.S. Census Bureau to help speed up processing the census data, and he had a bunch of U.S. Treasury money boxes laying around, so he cut his punch cards to fit in those boxes.  With the spacing of the holes on the card, it left him with 80 columns.  Today, 80 columns is the preferred max line length of the Linux kernel.  Python says to try to keep most lines under 72 (to have a nice margin), but definitely limit to 79 columns.  Does every team work like this?  No.  But it's neat that we work on a standard that programmers have been adhering to one way or another since 1880.  Feels pretty cool, right?

This week we learned about Binary and Hexadecimal.  I knew about it already thanks to [Vaidehi Joshi's awesome series](https://dev.to/vaidehijoshi/hexes-and-other-magical-numbers).  I get the feeling I'll be referring to that series more and more as I go through more classes.  But, expect a post from me on Binary, Hex, and Decimal numbers in the next little while.

More posts soon!

<hr>

*Originally posted on [`assert_not magic?`](https://assertnotmagic.com/2018/09/06/back-at-it/)*
Validate javascript data type in runtime? Yes, Hello Type.
Tags: datatype, javascript
Published: 2018-09-07 06:03:29

---
title: Validate javascript data type in runtime? Yes, Hello Type.
published: true
description: The article introduce a library to validate data type of javascript in runtime, and talk about its idea.
tags: data type, javascript
cover_image: https://thepracticaldev.s3.amazonaws.com/i/oac4e6gneaa45w5v2wyo.png
---

**update: I have published [tyshemo](https://github.com/tangshuang/tyshemo) which contains the data type system inside, and more rationality.**

Days earlier, I began to learn about Typescript. When I meet _interface_ and _generics_, my mind is suddenly confused, "what's this? what's that?". As a frontend conservative weak type follower, I do not want to write such a lot of code which is not related to my bussiness logic. Later, I looked into Flow which is advocated by facebook, I feel so frustrated because it will be the trend.

However, they make our project code more complex but not resolve the data type checking in runtime. As a little jser, I am always broken by data from APIs. "TypeError: xxx property of undefined", "TypeError: xxx property of null", "xxx is not a function", "xxx has no 'slice' method"...

Is there a way to validate data type and object structure easily? Finally, I wrote one library: [HelloType](https://github.com/tangshuang/hello-type).

## Survive from API data structure

Before you use the data from API, validate its structure by HelloType. Firstly, wrap a structure with HelloType's api method, then use the instance to assert:

![](https://thepracticaldev.s3.amazonaws.com/i/8fdhm2dcclxnutl4hi6j.png)

If the parameter of `put` does not match BooksType, an Error will be thrown. In the function, after `assert`, you do not need to worry about any data type and structure, just use the data as you wanted.

## Trace error without break program

If you just want to collect the error information and do not want to break the program process, use `trace` method:

![](https://thepracticaldev.s3.amazonaws.com/i/hoq1yn5n76xoqw4hoc7w.png)

It will not pay any effect on your render performance, because it is run asynchronously.

## Strict mode

As your data which is posted to your server should must and should only has certain properties, use strict mode to check whether the data structure is right:

![](https://thepracticaldev.s3.amazonaws.com/i/jptizgx0ya7x9m5ctxsn.png)

Becuase the first item of `books` has a additional property `size`, and strict mode used, assert will break the program.




There are more features, look into my [github](https://github.com/tangshuang/hello-type) to find out your interests.
How to Remove All Local Git Branches That Aren't 'master'
Tags: git
Published: 2020-09-24 03:47:16

---
title: How to Remove All Local Git Branches That Aren't 'master'
published: true
date: 2018-09-07 00:00:00 UTC
tags: git
canonical_url: https://nickymarino.com/2018/09/07/remove-non-master-local-branches/
---

*This post was originally published on [my website](https://nickymarino.com). Check it out for more awesome content!*

Every so often, I’ll want to delete all of my local branches for a repository that aren’t the `master` branch. An easy command to do this is:

```
$ git branch | grep -v "master" | xargs git branch -d

```

(If you want to keep multiple branches, such as `master` and `develop`, you can chain them together using `grep -v "master\|develop"`)

`git branch` lists all of the local branches for the repo, `grep -v` prints all of the lines from the previous command that don’t match “master”, and `xargs` takes each line from the previous output and runs `git branch -d <output_line>`.

I recommend using `-d` rather than `-D` in case git recommends not deleting the branch.
Visibility into Failing Kubernetes Pods
Tags: docker, linux, systemadministration, kubernetes
Published: 2018-12-15 03:00:35

---
title: Visibility into Failing Kubernetes Pods
published: true
tags: docker,linux,system-administration,kubernetes
canonical_url: https://medium.com/@jmarhee/visibility-into-failing-kubernetes-pods-8df50b6b96ed
---

A status of CrashLoopBackoff usually means your Pod would be created, the containers pulled, but something is causing the container process to exit and cause the container to fail, begin a backoff timer, and restart. Access to a container is sometimes as simple as exec-ing the pod container in question:

```
kubectl exec -ti \<pod name\> -c \<container\> -- /bin/sh
```

but an alternative method if the pod container does not support this (it happens), you can do two things:

1. Override the entrypoint, and start the container with a new command to allow you to enter and debug (useful if you suspect the entrypoint command is failing because of something like network connectivity or DNS resolution — you can login and ping and netcat and dig whatever you want), or…
2. Run a sidecar that runs a shell and anything in the main container is available over the localhost network.

This first method is fairly straightforward, you’re just declaring in the container field a new subset for the spec, command :

```
app: web
 spec:
 containers:
 - name: web-app
 image: bizco/neat-frontend:latest
 ports:
 - containerPort: 8081
   command:  
 - "/bin/sh"  
 - "-c"  
 - "sleep 36000"
```

the sleep command will keep this command active, and the container running, and you can log right into the desired image, and effectively overriding the original entrypoint command for the image.

In the second case, this can be where the software isn’t failing outright, but you suspect theres an issue reaching the service, or resolving something for the pod, more broadly, or even if the image does not support a command field, so exec isn’t going to do it for you and leave the service running in the running container, you can add a new container as a sidecar to allow you that access to a shell to debug:

```
app: web
 spec:
 containers:
 - name: web-app
 ...

 - name: debug-shell  
 image: alpine:3.6 
   command:  
 - "/bin/sh"  
 - "-c"  
 - "sleep 36000"
```

and then everything running in the pod, with a port in use will be available over localhost. An example might be if, for example, you have a pod running a database like MongoDB, and the service hasn’t failed, but seems to hit snags on certain operations, so you suspect an issue pulling down new data to feed to MongoDB configured like this:

```
containers:
 - name: mongodb
 image: mongo
 ports:
 - containerPort: 27017
```

If you add that second container, you can reach MongoDB, rather than exposing via Service in KubeDNS (i.e mongodb.whatevernamespace.cluster.local ), you can just hit localhost:27017 inside that Pod as you would with any other service running in that Pod.
Where to Learn new tech skills Online?
Tags: discuss, webdev, beginners, help
Published: 2018-09-06 16:42:33

---
title: Where to Learn new tech skills Online?
published: true
description: 
tags: #discuss #webdev #beginners #help
---

I am into frontend development and I try to find genuine learning resource for updating myself with changing skill set in the market. So this is a discussion topic for those who are trying to find resources which are worth checking out for frontend and backend skills.

I have joined Teamtreehouse in past. And they have moved to their own cloud IDE and their scope limits to Mac. Their Content is not meant for anything serious usage. It just doesn't feel satisfying doing their trails.

Lynda seems to be not updating the content for new frameworks or even between the new updates in frameworks. After Linkedin acquisition they too moved to cloud IDE on some courses.

Pluarlsight is one that I tried for 2 month trial available with Microsoft last December. It has older content and no updates on frontend and backend topics.

Wes Bos and Azat's courses are literally less focused on fundamentals and also too much commentary and less code.

Udemy has lot of spam content mostly stolen videos and piracy content being resold by some authors. Skillshare also tackles really less quality content.

What I have not tried so far -

- Safari Online Oreilly courses
- Frontend Masters
- PacktPub Courses
- TutsPlus Envato
- SpringBoard

Any place you refer for courses and training?
Jelly Fin: Calling all imposters! Yes, you! Let's Build Together.
Tags: javascript, beginners, jellyfin, mentoring
Published: 2018-09-06 19:48:32

---
title: Jelly Fin: Calling all imposters! Yes, you! Let's Build Together.
published: true
description: Adulting is hard.  Let's put our heads together and figure it out.
tags: javascript, beginners, jellyfin, mentoring
---

![Impasta](https://www.tasteofhome.com/wp-content/uploads/2018/02/noodledadjoke.jpg)

Hey Jellies!

I'm looking for a small team (one that looks nice, and not too expensive) of core developers to put our heads together and build something awesome.  Beyond that, we will invite contributors to help us build an app together.

## Here's my pitch

I'm looking for beginners.  
* Are you feeling like an imposter in a room full of professionals?  
* Do you want to learn something new?  
* Interested in knowing what a mythical "best practice" is?

Guess what? Your opinion matters.  In my experience as a seasoned developer, I've learned more from people new to the game than people set in their ways.  That's why I want to grow together.

**You will have mentors. And you will mentor others.** This is important.  I don't care if you started coding **today.** We will build you up.

## Here's the link to the app

{% github https://github.com/jonathan-irvin/jelly-fin %}

It's rough, but that's ok.  We will get there with *your* help.

## Here's the basis

It's personal finance.  Boring, right? Yes. No one likes adulting. So, let's automate adulting so we can focus on other stuff more exciting.  To get there, we will build an app that takes what we know, like bills that don't change and predict the stuff we don't like the coffee you consume on a daily basis.  You know who you are. ;)

Let me say that again.

> AUTOMATED ADULTING

## Sound good?

It won't just be about coding either.  Let's share ideas and help each other code better.  Let's write tests and keep high code coverage **for the hell of it**.  Because we're badass like that.  _Pull requests will be about building you up, not tearing you down._

## CICD?
I eat that for breakfast.  Yeah, we will have a deployment pipeline.  Our code will be **beautiful** because we wrote it.  But also because we automate it using [Prettier.io](https://prettier.io)

## Android or iOS?

How about both?  Yeah, you read that right.  We will be multi-platform!

## When can I start?

Come [chat](https://discord.gg/xveZ3FT) with us right now on Discord!  Take a look at the repo and get ready for awesome app development.

## Come Jell with Us!
An MSBuild File To Work With .Net Core As Well
Tags: csharp, msbuild, dotnetcore
Published: 2018-09-06 12:34:34

---
title: An MSBuild File To Work With .Net Core As Well
published: true
description: A minimal MSBuild file that works with both MSBuild and dotnet build.
tags: csharp,msbuild,dotnetcore
---

I sometimes take some extra time and effort to create some files from scratch simply because I don't want all the extraneous fluff that comes with letting automated utilities build a file. For example, if I create a new solution in Visual Studio there will be a .csproj file created as part of the process.  And that .csproj will be filled with all sorts of extraneous settings that I don't want or care about. So every now and again I build an MSBuild .csproj from scratch.  

I had an MSBuild file that worked fine for building a small/simple library that I created.  But then I tried to build the library with dotnet core and I ran into an issue.  

Digging into the issue a bit I found that basically MSBuild does some hidden wizardry to include some files without being told to include them. Specifically it includes mscorlib.dll without the file ever getting mentioned.  But dotnet core doesn't have that implied behavior.

So without any further ado here's my modified build file that works with both MSBuild and dotnet build for whatever it's worth.  I hope it helps others.

```xml
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup> 
    <Compile Include="ColorNumberGameEvent.cs" /> 
    <Compile Include="GameStates.cs" />
    <Compile Include="LegalColors.cs" />
    <Compile Include="GameSolution.cs" />
  </ItemGroup>
  <ItemGroup>
    <References Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client" />  <!-- Included for dotnet build -->
  </ItemGroup>                        
  <Target Name="Build">
    <Csc TargetType="library" Sources="@(Compile)"
       TreatWarningsAsErrors="true"
       WarningLevel="4"
       AdditionalLibPaths="@(References)"
       References="mscorlib.dll"/> <!-- Included for dotnet build -->
  </Target>
</Project>
```

A couple of notes:

1.) I would have used the _ProgramFiles(x86)_ environment variable (rather than hard coding the path) but there's a bug with MSBuild and environment variables that contain "("

2.) You need both the _AdditionalLibPaths_ and the _References_ set in order for this to work.
Laravel 5.7 Release: What's New? 10 Features To Try
Tags: laravel, php, coding, opensource
Published: 2018-09-06 18:46:16

---
title: Laravel 5.7 Release: What's New? 10 Features To Try
published: true
description: 
tags: #laravel #php #coding #opensource
canonical_url: https://auth0.com/blog/laravel-5-7-release-what-is-new/
---

TL;DR: Laravel 5.7 is a major release to, at time of writing, the most popular PHP framework on GitHub. Furthermore, Laravel Nova was also released. 
In this article, we'll cover the new features in Laravel 5.7 and several other changes and deprecations.

[Read on 🎯](https://auth0.com/blog/laravel-5-7-release-what-is-new/?utm_source=dev&utm_medium=sc&utm_campaign=wn_laravel57)

![Laravel 5.7 Release: What's New? 10 Features To Try](https://thepracticaldev.s3.amazonaws.com/i/yhrvnyww026pl9u7lzn0.png)
Hiring for the first time
Tags: interview, help
Published: 2018-09-06 18:28:06

---
title: Hiring for the first time
published: true
description: 
tags: interview,help
cover_image: https://thepracticaldev.s3.amazonaws.com/i/kfqv3f4d9zp8d0qzvkx4.png
---
With recent promotion, one of my tasks will be filling up a team with a couple of junior developers. This is going to be the first time I'll interview someone. Could anyone share posts, books, videos, personal experience, basically anything that I could consume in order to prepare myself for it better and be as much as stress free as possible?

I also should mention that it's going to be internal recruitment and I'll have to interview people I work with daily.

Any kind of comments and questions are welcome!
My favorite CLI tools
Tags: cli, tools
Published: 2018-09-06 17:34:26

---
title: My favorite CLI tools
published: true
description: 
tags: cli,tools
---
Get started

<code>
brew install htop jq bat exa prettyping diff-so-fancy
</code>

The tools explained a bit.

[htop](https://github.com/hishamhm/htop) a more advanced top alternative.
<code>alias top="htop"</code>

[bat](https://github.com/sharkdp/bat) - a fancy cat with syntax highlight
<code>alias cat="bat --theme=1337"</code>

[prettyping](https://github.com/denilsonsa/prettyping)
<code>alias ping="prettyping --nolegend"</code>

[jq](https://github.com/stedolan/jq)

[exa](https://github.com/ogham/exa)
<code>alias ls=exa</code>
<code>alias ll="exa -l"</code>
example <code>ls -la --git</code>

[diff-so-fancy](https://github.com/so-fancy/diff-so-fancy)
<code>alias diff=diff-so-fancy</code>
Show current git branch
Tags: tooling, bash, git
Published: 2018-09-06 15:05:29

---
title: "Show current git branch"
published: true
description: "Stop making mountains out of molehills"
tags: ["tooling", "bash", "git"]
---

During development, it can be quite convenient to always know which branch you are on without having to do a git status. Most developers use unnecessarily sophisticated bash scripts to modify the prompt string 1 (PS1)  variable of their shell. As embarrassing as it is, I was most developers (I even had my own repo with a "performance" focused approach). Now, I simply use a one-liner. In fact, I just visit this article and copy paste the following into my `~/.bash_profile`:

```bash
# Show current git branch when entering a git repository
export PS1="\W \[\e[0;36m\]\$(git rev-parse --abbrev-ref HEAD 2> /dev/null)\[\e[0m\]\$ "
```

*Originally published in https://plog.czarpino.com/show-current-git-branch/*
Your favorite terminal ?
Tags: terminal
Published: 2018-09-06 14:43:42

---
title: Your favorite terminal ?
published: true
description: 
tags: terminal
---

Since you are developers, you definitely use terminal once (Or use it all the time :]]). So what's your favorite terminal, how it look like, how do you setting it up.

Here's mine...Simple terminal i use everyday.

![](https://github.com/banminkyoz/purify/blob/master/demo/demo_osx_hyper.png?raw=true)

I do use hyper instead of default terminal on macos or iterm2...Although it's a litle bit slower, but it's not the problem, cause it look so cool.

So what's your terminal look like, do you love using it everyday ? Please share it with me.

Btw, this is the theme i use (I use oh-my-zsh): [Purity, oh-my-zsh themes](https://github.com/banminkyoz/purify)
Example of using LazyInitializer.EnsureInitialized
Tags: net, programming
Published: 2018-09-18 02:47:36

---
title: Example of using LazyInitializer.EnsureInitialized
published: true
tags: .NET,Programming
canonical_url: https://www.briannipper.com/2018/09/example-of-using-lazyinitializerensurei.html
---

[![](https://2.bp.blogspot.com/-I6pWygiwGZ8/W4xk7uMLyaI/AAAAAAAAHKU/n3QXOFMoZtk8ZiLqt59Hwgq8WEnC8TVTgCLcBGAs/s320/LazyMeme.jpg)](https://2.bp.blogspot.com/-I6pWygiwGZ8/W4xk7uMLyaI/AAAAAAAAHKU/n3QXOFMoZtk8ZiLqt59Hwgq8WEnC8TVTgCLcBGAs/s1600/LazyMeme.jpg)
When looking at making systems more efficient it's helpful to think about being lazy. A helpful tool in the .NET tool belt is the static class under the System.Threading namespace LazyInitializer. In particular this class contains a method [EnsureInitialized](https://docs.microsoft.com/en-us/dotnet/api/system.threading.lazyinitializer.ensureinitialized?view=netframework-4.7.1)  
  
This method is very simple to use and provides a convenient way to ensure that an initialization is called only once based on the value of the target property already being populated.  
  
For example, if you need to load a file as part of the setting of values in an application you can use the EnsureInitialized method.  
  
The following is a derived example of using the class to illustrate the usage pattern.  
  
<textarea cols="90" rows="49" style="display: none;">using System; using System.Collections.Generic; namespace Example.EnsureInitialized { class Program { static void Main(string[] args) { var configurationService = new ConfigurationService(); var configInfo = configurationService.ConfigInfo(); foreach(var configItem in configInfo) { Console.WriteLine(configItem.Value); } Console.ReadKey(); } } class ConfigurationService { private Dictionary<long string> _simpleExample; public ConfigurationService() { System.Threading.LazyInitializer.EnsureInitialized(ref _simpleExample, Init); } private Dictionary<long string> Init() { // The following would be replaced with some expensive operation like reading a file from disk. return new Dictionary<long string> { {1, "Hello"}, {2, "World"} }; } public Dictionary<long string> ConfigInfo() { return _simpleExample; } } } </long></long></long></long></textarea><script src="https://gist.github.com/briannipper/ac2778ccd0d15b4ab217083331419ae7.js"></script>
Loading up a Docker database with data
Tags: dockerdatabase
Published: 2018-09-06 11:04:25

---
title: Loading up a Docker database with data
published: true
description: Using docker init.d for database dumps
tags: docker database
---

We all need data.

Especially when running code against local environments that in Production would be running against a back end database.  When I was building up some local Dockerized applications (Tomcat and MySQL) I wanted to have my UI showing some data.

This was partly to know things were up and running, since our main page makes a call against the Database to display some information on the initial page.  Data that lives in the backend, or in this case the MySQL container.  I thought about how I might have to add start up scripts, or maybe set up a MySQL database already loaded, but then I found about Docker's entrypoint initdb.d and that solved my problem easily.

> COPY deployment/docker/mysql/very-small-db.sql /docker-entrypoint-initdb.d

This takes my database dump, which I made small so all it needs is my schema and maybe a couple of days worth of data, and initializes my database with it when I start up the container.  This way I can fiddle with the dataset as I want and rebuild the container and then be on my way.

The great part about using tools is when you suddenly find a new feature, or way to use them.