teleren/devto huggingface dataset:
Shell Scripting for Newbies 02
Tags: bash, shell, script, beginners
Published: 2018-07-18 02:46:24

---
title: Shell Scripting for Newbies 02
published: true
description: Learn the basics of shell scripting to automatize your tasks!
tags: bash, shell, script, newbies
cover_image: https://thepracticaldev.s3.amazonaws.com/i/icz0wk9u1yom8uajyr8w.jpg
---

###Variables###

With simple variables, you can...
- save values using **=**
- find those values putting **$** in your **echo**

*"One Look Is Worth A Thousand Words"*
```sh
#/bin/bash

var="Yes, did it!"
echo "Have you done it? $var"
```
The result of running this script is:

```
Have you done it? Yes, did it!
```

###Talking to the user###

But let's do something useful with this concepts. Imagine you can only show the date for the user if he knows **the secret password**! You might want to ask him the password, so do it by using the command **read**. 

Then, if the user type the <del>easiest ever</del> right password "dog", the date is shown, otherwise, the program is closed. Let's have a look at the code before anything.

```sh
#/bin/bash

echo "What's THE SECRET PASSWORD?"

#Puts the user's answer in the variable answer
read answer

#If answer is dog dog, print date!
test "$answer" == "dog" && date
```
Now, gotta understand it:
- The operator **==** means **equals to**
- The operator **&&** means **and**

As we had already saved the user's answer in the variable **$answer** with the command **read**, when we compare the variable **$answer** to **"dog"**, if they are the same, it prints the date; else, it finishes the program (because there are no more commands to execute).

Therefore, the result of the script must be both below:

With the right password:
```
What's THE SECRET PASSWORD?
dog
Ter Jul 17 23:32:39 -03 2018
```
With the wrong password:
```
What's THE SECRET PASSWORD?
cat
```
###I'm not convinced!###

So let's crack this code a bit more! 

```sh
#/bin/bash

echo "What's THE SECRET PASSWORD?"

#Puts the user's answer in the variable answer
read answer

#REVERSE LOGIC!
#If answer is not dog, exit; Else, print date!
test "$answer" != "dog" && exit
date
```
Stuff is different here:
- The operator **!=** means **different**

Now we use the reverse logic to do the same thing. This time, the command **exit** can **only** happen if the user's answer is different from **"dog"**. Otherwise, it will continue running the script and eventually reach the command **date**.

The result is **exactly** the same as in the previous script!

##About##

You can find all my scripts in [my github](https://github.com/azbardini/shellscript)!

Follow me for more articles!
glasshfishのインストールとサンプルアプリケーションのデプロイ方法の紹介について
Tags: glassfish, java, beginners
Published: 2018-07-18 02:43:18

---
title: glasshfishのインストールとサンプルアプリケーションのデプロイ方法の紹介について
published: true
description: glassfishのインストールからサンプルのデプロイ確認までを行う
tags: glassfish,java,beginner
---

本投稿ではjavaの代表的なアプリケーションサーバーであるGlassFishの導入とサンプルプロジェクトのデプロイを行います。

・https://javaee.github.io/glassfish/download
にアクセスし、glassfishのダウンロードを行います。

https://thepracticaldev.s3.amazonaws.com/i/wakr53w6mxz6b1o1xb22.png

今回はfull platformを選択しました。

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

・c直下に解凍したのち、C:\glassfish5\bin　に移動し、サーバーを起動するためのコマンド　asadmin start-domain を実行


```
cd C:\glassfish5\bin
asadmin start-domain
```


![server](https://thepracticaldev.s3.amazonaws.com/i/4xskh1x0mngx07x097un.png)

・サーバー起動後にブラウザで
http://localhost:4848
にアクセス。
正しく起動していればglassfishのメニューが表示されます

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



・作成したwarファイル
C:\glassfish5\glassfish\domains\domain1\autodeploy
に配置し、
ブラウザから
http://localhost:8080/<作成したアプリケーション>

にアクセスするとアプリケーションが表示されます。


![acess](https://thepracticaldev.s3.amazonaws.com/i/02eps407e6kbpylo7biz.png)

正常にアクセスできました。

この手順で皆さんが作成したアプリケーションをサーバーにアップロードしてブラウザから閲覧できることができます。
What is 'impedence mismatch' in the context of sql databases ?
Tags: help, sql, nosql
Published: 2018-07-18 02:10:49

---
title: What is 'impedence mismatch' in the context of sql databases ?
published: true
description: 
tags: #help,#sql,#nosql
---
I came across this term somewhere while trying to understand differences between sql and nosql databases. Tried searching more about it but couldn't get it. I'm unable to understand how relational data model to object data model conversion happens and why is it costly ? How exactly nosql databases eliminate this problem ?
Shell Scripting for Newbies 01
Tags: bash, shell, script, beginners
Published: 2018-07-18 01:57:43

---
title: Shell Scripting for Newbies 01
published: true
description: Learn the basics of shell scripting to automatize your tasks!
tags: bash, shell, script, newbies
cover_image: https://thepracticaldev.s3.amazonaws.com/i/icz0wk9u1yom8uajyr8w.jpg
---

Let's suppose you want to check your *any linux system* stats, you might probably use commands such as **w**, **date**, or **df**. That means you need to write three commands and check their results, one by one... Not the funniest hobby!

That's where shell scripting arrives: lets automatize tasks, and a little more...

###Hello Mars###

To start, let's just create an **hellomars.sh** file. Do this by typing in your terminal:
```sh
touch hellomars.sh
```

Then, use <del>vim</del> your finest editor to edit this file and have some <del>lack of</del> fun creating your first Hello Mars script!
```sh
#/bin/bash
echo "Hello Mars!"
```

Once created, give this file permission to be executed and execute the file itself by typing:
```sh
chmod +x hellomars.sh
./hellomars.sh
```
As you may have noticed, **echo** is the command to write something as output. The *#/bin/bash* is used to tell linux which interpreter it must use (there are plenty of them, *sh*, *bash*, *dash*...). The output of the script might be as follows:
```
Hello Mars!
```

###One after the other###

Now that you know how to write something in the screen, lets write something relevant. Putting all those first commands together, you can make another file such, let's call it *mysystem.sh*:

```sh
#/bin/bash
echo "Aliens using this computer:"
w
echo "What year am I?"
date
echo "Is there any computer left?"
df -h
```
- tip: -h flag turns *df* a little more *human readable*.

By running this script, the output must be something as shown below:

```
Aliens using this computer:
 22:13:13 up  1:54,  1 user,  load average: 0,55, 0,56, 0,60
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
bardini  tty7     :0               20:22    1:54m  2:28   0.60s /sbin/upstart --user
What year am I?
Ter Jul 17 22:13:13 -03 2018
Is there any computer left?
Filesystem      Size  Used Avail Use% Mounted on
udev            2,9G     0  2,9G   0% /dev
tmpfs           586M   17M  570M   3% /run
/dev/sda1       105G   33G   67G  33% /
tmpfs           2,9G   31M  2,9G   2% /dev/shm
tmpfs           5,0M  4,0K  5,0M   1% /run/lock
```
People might not understand the functions you are using in your script, so comment it using hashtags:


```sh
#/bin/bash
#This shows users in this computer
echo "Aliens using this computer:"
w

#This shows the date and time of this computer
echo "What year am I?"
date

#This shows the disk usage of the computer
echo "Is there any computer left?"
df -h
```

##About##

You can find all my scripts in [my github](https://github.com/azbardini/shellscript)!

Follow me for more articles!
My struggle I have when speaking with other developers. And ways I want to fix it
Tags: discuss
Published: 2018-07-17 23:58:27

---
title: My struggle I have when speaking with other developers. And ways I want to fix it
published: true
description: It's been months and today even though I've been programming for a few years I still find myself being confused by some discussions I have with other fellow developers.
tags: discuss
---

I've been a happy developer for a few years and do understand some concepts, but over this learning journey I've met a lot of other developers and what I've noticed is I have a huge problem when having programming conversations with them. 

# My problem

So, every single time I have a programming discussion with another developer I'm enjoying the time and having fun learning some new things about programming however, my huge problem is if I do not understand something I tend not to say "I don't understand?" or "What does this mean?" I just say "Oh cool" or "That's interesting" even though I have no idea what they mean. I guess I'm easily embarrassed and that's a bad trait to have because then I worry too much, I think part of the reason I am writing to DEV community is because if I write this I might actually start realizing that's okay not to understand things and I should get out of my bad habit.

# My goals to overcome this

I love setting goals, do I always stay true to all of them. No. However, I am really driven in learning how to expand my skill set in programming every single day. So here's some goals I am going to do for my future self.

- When I don't understand something ask nicely for a better explanation (priority)
- If I kind of understand a topic in the conversation but not on a great level, add it to a list of things to research and spend some time reading about it every night until the list is over.
- Keeping the list of things to read is important to me so I will strive to have that list always have a minimum of one concept to read.

Short goal list but it fits my issue and should be able to get rid of that bad trait I have pretty much always had. 

# What are your thoughts?

Finally, I would like to ask the DEV community for some advice on overcoming this as well. I understand it's okay to not know everything but the thing is I don't really put an effort into learning a new concept because how easily embarrassed I can get which doesn't help in my development of becoming a better programmer.

Thank you for taking the time to read this article and I hope I'll get some awesome advice from this wonderful community. I've been reading the articles for a while but just registered last night so happy to be a part of DEV 

*p.s.* At the start of my programming journey I was always asking questions, super excited and then in no time it just started to go away because I felt like at the level I was at I didn't want to get embarrassed to the point where I wouldn't want to program anymore cause then I would just judge every single line I wrote and would start to disbelieve in my abilities.
Build a blog with GatsbyJS in 1 minute
Tags: website, gatsby, javascript
Published: 2018-07-17 23:55:13

---
title: Build a blog with GatsbyJS in 1 minute
published: true
description: Build a blog with GatsbyJS in 1 min
tags: 
- website
- gatsbyJS
- JavaScript
---

{% youtube d3FN_N5hzgY %}


TL;DR
1. Build a blog with gatsbyJS
2. Host it free on github using github pages
3. Fork them (I didn't. T.T)

I thought the entire development process was simple and easy. I can't seem to use png image in the markdown, didn't have time to debug further. Tell me if you can replicate the same error.

My verdict: I adore it.


Credits:
Music - https://soundcloud.com/thisisfrequency/cloud-41-back-to-you-carla
Thumbnail - https://unsplash.com/@beccatapert
Full HTTPS on your Github pages, for free
Tags: github, domain, blog, security
Published: 2018-07-17 21:18:10

---
title: Full HTTPS on your Github pages, for free
published: true
description: How I can run my blog using a full SSL encrypted connection FOR FREE
tags: [github, domain, blog, security]
cover_image: https://domenicoluciani.com/assets/images/covers/letsencrypt.png
---

From today my blog is full encrypted by a full SSL protocol, **for free**. How?

I run [my blog](https://domenicoluciani.com) for free, I don’t need anything else than my Github’s account, this is possible using Github Pages and Jekyll.

If you want to know how [read the full post](https://domenicoluciani.com/2018/05/04/https-on-github-pages.html)!
Please verify your email on pypi.org and test.pypi.org
Tags: python, pypi, psa
Published: 2018-07-17 20:35:02

---
title: Please verify your email on pypi.org and test.pypi.org
published: true
tags: [python, pypi, psa]
canonical_url: https://dmerej.info/blog/post/please-verify-your-email-on-pypiorg-and-testpypiorg/
---

Just a quick post to kindly ask you to make sure your email is verified on both pypi.org and test.pypi.org

# What to do

Ff you have an account on either pypi.org or test.pypi.org, please make sure that you email is verified, and if not, ask for a confirmation email to be sent.

Whether or not you have an account, feel free to spread the news using those links:

- [announce on twitter](https://twitter.com/thepypa/status/1019040253020123137)
- [announce on distutils-sig@python.org](https://mail.python.org/mm3/archives/list/distutils-sig@python.org/message/5ER2YET54CSX4FV2VP24JA57REDDW5OI/)

You can also re-use this article on your own blog for instance ;)

# Why this matters

pypi.org is essential to lots of python developers, but is unfortunately maintained by a tiny number of great people and they need our help.

If we don’t help them, pypi.org may become unable to send _any_ email, period, which will make things really complicated for everyone.

# More details

The full explanation is also [on GitHub](https://github.com/pypa/warehouse/issues/3632) if you want to take a look.

Thanks for your help in keeping pypi.org working!
💥each_with_object💥
Tags: ruby, rails, juniordev
Published: 2018-07-17 19:14:23

---
title: "💥each_with_object💥"
published: true
description: 
tags: [ruby, rails, junior dev]
---

I've been wrestling with a slightly nasty refactor story recently. The following is my first iteration of a method that loops through a hash of `@nameservers` and for each one assigns the `host` to an instance variable in the class, then loops through each IP in the `info` hash and adds the output from a private method in the `@results` hash.
That's a lot of looping. 💩


```ruby
def check
    @results = {}
    @nameservers.each do |host, info|
      @host = host
      info[:ips].each do |nameserver_ip|
        @results[nameserver_ip] = ip_check(nameserver_ip)
      end
    end

    @results
+end
```
`@nameservers` is a hash that looks something like this:
```ruby
{
            "Google" => {
        :country => "USA",
            :ips => [
            [0] "8.8.8.8",
            [1] "8.8.4.4"
        ]
    },
           "OpenDNS" => {
        :country => "USA",
            :ips => [
            [0] "208.67.222.222",
            [1] "208.67.220.220"
        ]
    },
         "Fortalnet" => {
        :country => "Brazil",
            :ips => [
            [0] "189.90.16.20",
            [1] "189.90.16.21"
        ]
    },
    "Probe Networks" => {
        :country => "Germany",
            :ips => [
            [0] "82.96.64.2",
            [1] "82.96.65.2"
        ]
    }
}
```
What's the best way to simplify that method? Well, another dev turned me on to the `each_with_object` method. Instead of defining and returning the `@results` hash explicitly, it can be incorporated into one of the loops. How it works?

```ruby
			def check
				@nameservers.each_with_object({}) do |(host, info), results|
					info[:ips].each do |nameserver_ip|
						results[nameserver_ip] = ip_check(host, nameserver_ip)
					end
				end
			end
```
When you call `each_with_object` on `@nameservers` I'm passing an empty hash as the argument. (It doesn't need to be an empty hash. It can be a pre-existing hash or even an array). Inside the block you pass the object or objects to loop over, in this case `host` and `info`, and then the variable name you want to assign the object you passed in as an argument. So my hash will be returned as `results`. 
The second loop in my method remained almost exactly the same, except that I decided to pass `host` through to my private `ip_check` method as well so that the state wasn't leaking into the rest of the object. 

And voila. Just what I needed.
LaravelNuxt under the hood
Tags: spa, api, laravel, nuxt
Published: 2018-07-17 18:08:42

---
title: LaravelNuxt under the hood
published: true
description: How does LaravelNuxt work internally?
tags: spa, api, laravel, nuxt
---

In this post we'll see how [laravel-nuxt](https://github.com/skyrpex/laravel-nuxt) works. If you don't know what is it, you can check the introduction and tutorial
[here](https://dev.to/skyrpex/create-a-spa-with-laravel-and-nuxt--54k).

Basically, there are two different modes:

- [Development mode](#development-mode)
- [Production mode](#production-mode)

## Development mode

The `laravel-nuxt dev` command will launch two servers that interact with each other: Nuxt's and Laravel's dev servers.

### The Nuxt server

Will be launched internally using:

```bash
nuxt dev --spa
```

This is the server we'll be fetching with our browser. Serves multiple purposes:

- Listen to the port 8000 by default.
- Compile assets and enable [Hot Module Replacement](https://webpack.js.org/concepts/hot-module-replacement/).
- Render the HTML page when accessing a special dev URL (which is `/__laravel_nuxt__` by default).
- Proxy any other routes to the Laravel server (that aren't `/__laravel_nuxt__`).

Proxying to Laravel is mandatory because we won't be handling headers or cookies using Nuxt.

### The Laravel server

The Laravel server will be launched internally using:

```bash
php artisan serve
```

We aren't supposed to do any calls here. It will:

- Listen to the 8001 port by default.
- Serve your routes as usual (which should consist in API routes only).
- Serve a fallback route which will render the `/__laravel_nuxt__` page whenever a non-AJAX call is made.
  - This is handled by the `Pallares\LaravelNuxt\Controllers\NuxtController::class` controller.
  - This should be your only web route.

With the proxying from Nuxt to Laravel, we let our app to attach any headers and cookies (like `laravel_session`) to the HTML rendered by Nuxt.

## Production mode

The `laravel-nuxt build` command will just execute:

```bash
nuxt build
```

It'll compile all your frontend assets to the `public/_nuxt` directory, which will usually consist of some JS files and CSS files, along with a `index.html` file which will be served by the `Pallares\LaravelNuxt\Controllers\NuxtController::class` controller.

> Any non-AJAX request to the Laravel server (that doesn't match any existing route) will render your HTML page. As you may have noticed, you'll never get a 404 response from Laravel (but you may still render a 404 page using Nuxt).

The app will be deployment-ready after executing this command. You can also test it using `php artisan serve` and opening `http://localhost:8000/`.

If you still have any doubts, don't hesitate to write a question here! Regards.
Find duplicates algorithm series- A SORTED array as an input.
Tags: array, twopointers
Published: 2018-07-17 18:03:51

---
title: Find duplicates algorithm series- A SORTED array as an input.
published: true
description: 
tags: Array, Two Pointers
---

This is an extension of problem we have discussed in an earlier post.

{% link https://dev.to/s_awdesh/finding-duplicates-inside-an-array---easy-version-37la %}

I like this problem more because there iss more thinking involved and it forces us to write down the algorithm without using an extra space.
First Hint to solve this problem is how could we utilize the fact that input array is SORTED?

Whenever I see SORTED in a problem statement 'Binary Search' is the first thing that comes to my mind but that won't work in this case because we have to find all the duplicates that exists inside the array so we have to parse all the items inside an array. 
Parsing all the items inside an array when array contains 'n' items gives us O(n) time complexity thus defeats the purpose of using Binary Search which is famous of it's logarithm __O(logn)__ time complexity.

Could we utilize the SORTED behavior of the items inside array to get linear time algorithm without using an extra space and without using Binary search?

How about we compare each element with it's neighbor and if they are similar then add them into the list of duplicate elements otherwise insert distinct element back in array. 
We are going to use two pointers to solve this, one pointer to compare element and it's neighbor other is to maintain distinct element. 


Let's walk through above code with an example-:


![Example](https://thepracticaldev.s3.amazonaws.com/i/52lin09gyxh2buezt879.jpeg)


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



**Conclusion**

We utilized SORTED property of an array by comparing neighboring elements with each other. If it was an unsorted array we had to use extra data-structure like Set and won't be able to do in place algo in linear time.

There are couple of more variation of __finding duplicate__ problem that I want to try and write about in coming days.

Stay tuned. :)
Who are up to talk to and advice or seek for it?
Tags: discuss, javascript, showdev
Published: 2018-07-17 16:46:45

---
title: Who are up to talk to and advice or seek for it?
published: true
description: 
tags: #discuss #javascript #showdev                
---

Since the chat option is available now in Dev.to I was wondering I could meet few amazing people to talk to learn from them regarding

* career advice,
* understanding business
* going into F1 racing since they need IT and Electronic communication engineer people anyways so why not get a job their and roam around world during each season
* how to get into some cool jobs
* learn networking 

> 'cause one's network is one's net worth.

* how to understand business in technical terms and only pick up technical business rather than going for some consultancy work after few years in your career

because here in India people do that more often and they are the most cunning ones I don't want to end up like that

* how to go on with being DigitalNoMads because I want to live in Vienna, New York, or some small city in Germany I don't remember the name of



Hope to meet some enthusiast people and learners who want to know the basics about how to learn in college and learning pathways and sharing fundamental resources can definitely message me. I just want to try this out new messaging feature.
Ask Dev, Beginner seeking advice for security, networking or hacking?
Tags: informationsecurity, networking, hacking, discuss
Published: 2018-07-17 16:30:45

---
title: Ask Dev, Beginner seeking advice for security, networking or hacking?
published: true
description: 
tags: information-security, networking, Hacking, discuss
---
I want to start from practicals as well as understanding concepts from core how to be either a security expert or an hacker. Everyone recommend to start a jump through TCP - IP but what about practical application?
Video: Object-Oriented Programming Concepts
Tags: oop, objects, overloading, inheritance
Published: 2018-07-17 13:35:38

---
title: Video: Object-Oriented Programming Concepts
published: true
description: Learn about instances, encapsulation, overloading, inheritance and overriding.
tags: OOP, Objects, overloading, inheritance
---

{% youtube Lparx4yR5bY %}

See also: [Understanding Classes](https://dev.to/lefebvre/oop-101-understanding-classes-343p)