teleren/devto huggingface dataset:
Laravel Interview Questions Fresher or Beginner
Tags: laravel, phpframeworks, fresher, interview
Published: 2019-04-08 12:27:53

---
title: Laravel Interview Questions Fresher or Beginner
published: True
description:  Laravel comes with built-in support for user authentication and authorization which is missing in some most popular PHP frameworks like CodeIgniter, CakePHP.
tags: Laravel, phpframeworks, fresher, interview,
---

There are more futures associated with the Laravel like modular packaging system with a dedicated dependency manager, utilities that aid in application deployment and maintenance and many more. In addition, there are many different ways of accessing relational databases and their orientation toward syntactic sugar. Moreover, GitHub is used to host the source code of Laravel and it is licensed under the terms of MIT license. So, if you want to know more about Laravel, then check out our [Laravel interview questions](https://www.interviewqueries.com/laravel-interview-questions/) which are described below. You can crack any interviews by reading our top interview questions.

## Read Best Some Laravel Interview Questions:

### What is Laravel?

### How to hash password in laravel?

### What are pros and cons of using Laravel Framework?

### What are traits in Laravel?

### What is Laravel service container?

### How To Use Delete Query In Laravel?

### What is Laravel Dusk?

### What is Laravel Echo?

### What is socialite laravel?

### How to use laravel tinker?

Frequently Asked [Laravel Developer Interview Questions](https://www.interviewqueries.com/laravel-interview-questions/). 

Thankyou
Scale elements on hover using CSS
Tags: css, tutorial, beginners, webdev
Published: 2019-04-08 10:31:09

---
title: Scale elements on hover using CSS
published: true
description: Often we get a requirement to scale images on hover or content block on hover, it can be achieved using CSS through transform property
tags: ['CSS', 'tutorial', 'beginners', 'webdev']
series: 'CSS Nuggets'
canonical_url: https://learnwithparam.com/blog/scale-elements-on-hover-using-css/
---

> Follow me on [Twitter](https://twitter.com/learnwithparam), happy to take your suggestions on topics or improvements

Often we get a requirement to scale images on hover or content block on hover, it can be achieved using CSS through `transform` property

```scss
// Growing in size
.grow:hover {
  transform: scale(1.2);
}
// shrinking in size
.shrink:hover {
  transform: scale(0.8);
}
```

Here `transform: scale` property alone can't help the effect to be smooth, in order to get the smooth effect, we need to add some `transition` to the elements.

```scss
.grow,
.shrink {
  transition: all 0.3s ease-in-out;
}
```

{% codepen https://codepen.io/Param-Harrison/pen/MLypze %}

This technique has a wide range of browser support without vendor prefixes. Feel free to use it next time when needed in your UI 👍

> Note: This article was originally written for [my blog](https://learnwithparam.com/blog/scale-elements-on-hover-using-css/). I am republishing it here for the amazing DEV community.
LeetCode in Kotlin: 7. Reverse Integer
Tags: leetcode, kotlin
Published: 2019-04-08 10:27:21

---
title: LeetCode in Kotlin: 7. Reverse Integer
published: true
description: 
tags: leetcode,kotlin
---

## Problem
https://leetcode.com/problems/reverse-integer/

Given a 32-bit signed integer, reverse digits of an integer.

Example 1:
```
Input: 123
Output: 321
Example 2:

Input: -123
Output: -321
Example 3:

Input: 120
Output: 21
```

Note:
Assume we are dealing with an environment which could only store integers within the 32-bit signed integer range: [−231,  231 − 1]. For the purpose of this problem, assume that your function returns 0 when the reversed integer overflows.

## Solution

```kotlin
fun reverse(x: Int): Int {
    val str = x.toString()
    val stack = Stack<Char>()
    var result = ""

    str.forEach {
        stack.push(it)
    }

    while (true) {
        if (stack.size == 0) break

        if (result.isEmpty() && stack.peek() == '0') {
            if (stack.size == 1) {
                result = "0"
                break
            }

            stack.pop()
            continue
        }

        if (stack.peek() == '-') {
            result = stack.peek() + result
            break
        }

        result += stack.pop()
    }

    return try {
        result.toInt()
    } catch (e: NumberFormatException) {
        0
    }
}
```

```kotlin
fun reverse(x: Int): Int {
    val output = StringBuilder()
    var currVal = x

    if (currVal < 0) {
        currVal *= -1
        output.append("-")
    }

    output.append(currVal.toString().reversed())

    return output.toString().toIntOrNull() ?: 0
}
```

```kotlin
fun reverse(x: Int): Int {
    val y = abs(x)
        .toString()
        .reversed()
        .toIntOrNull() ?: return 0

    return when {
        0 <= x -> y
        else -> y * -1
    }
}
```

## Test code

```kotlin
@Test
fun reverse() {
    assertEquals(321, solution.reverse(123))
    assertEquals(-321, solution.reverse(-123))
    assertEquals(21, solution.reverse(120))
    assertEquals(21, solution.reverse(1200))
    assertEquals(0, solution.reverse(0))
    assertEquals(0, solution.reverse(1534236469))
}
```

## Model solution
https://leetcode.com/problems/reverse-integer/solution/

### Approach 1: Pop and Push Digits & Check before Overflow
```java
class Solution {
    public int reverse(int x) {
        int rev = 0;
        while (x != 0) {
            int pop = x % 10;
            x /= 10;
            if (rev > Integer.MAX_VALUE/10 || (rev == Integer.MAX_VALUE / 10 && pop > 7)) return 0;
            if (rev < Integer.MIN_VALUE/10 || (rev == Integer.MIN_VALUE / 10 && pop < -8)) return 0;
            rev = rev * 10 + pop;
        }
        return rev;
    }
}
```
LeetCode in Kotlin: 1. Two Sum
Tags: leetcode, kotlin
Published: 2019-04-08 10:20:03

---
title: LeetCode in Kotlin: 1. Two Sum
published: true
description: 
tags: leetcode,kotlin
---

## Problem
https://leetcode.com/problems/two-sum/

Given an array of integers, return indices of the two numbers such that they add up to a specific target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.

Example:
```
Given nums = [2, 7, 11, 15], target = 9,

Because nums[0] + nums[1] = 2 + 7 = 9,
return [0, 1].
```

## Solution

```kotlin
fun twoSum(nums: IntArray, target: Int): IntArray {
    for (i in 0 until nums.size) {
        for (j in i + 1 until nums.size) {
            if (nums[i] + nums[j] == target) {
                return intArrayOf(i, j)
            }
        }
    }

    throw IllegalArgumentException("No solution")
}
```

```kotlin
fun twoSum(nums: IntArray, target: Int): IntArray {
    val map = HashMap<Int, Int>()
    nums.forEachIndexed { idx, item ->
        val found = map[target - item]
        found?.let {
            return intArrayOf(found, idx)
        }
        map[item] = idx
    }
    throw IllegalArgumentException("No solution")
}
```

## Test code
```kotlin
@Test
fun twoSum() {
    t(intArrayOf(2, 7, 11, 15), 9, intArrayOf(0, 1))
    t(intArrayOf(3, 2, 4), 6, intArrayOf(1, 2))
}

private fun t(nums: IntArray, target: Int, expected: IntArray) {
    val actual = solution.twoSum(nums, target)

    assertEquals(expected.size, actual.size)
    expected.forEachIndexed { index, i ->
        assertEquals(expected[index], i)
    }
}
```


## Model solution
https://leetcode.com/problems/two-sum/solution/

### Approach 1: Brute Force
```java
public int[] twoSum(int[] nums, int target) {
    for (int i = 0; i < nums.length; i++) {
        for (int j = i + 1; j < nums.length; j++) {
            if (nums[j] == target - nums[i]) {
                return new int[] { i, j };
            }
        }
    }
    throw new IllegalArgumentException("No two sum solution");
}
```

### Approach 2: Two-pass Hash Table
```java
public int[] twoSum(int[] nums, int target) {
    Map<Integer, Integer> map = new HashMap<>();
    for (int i = 0; i < nums.length; i++) {
        map.put(nums[i], i);
    }
    for (int i = 0; i < nums.length; i++) {
        int complement = target - nums[i];
        if (map.containsKey(complement) && map.get(complement) != i) {
            return new int[] { i, map.get(complement) };
        }
    }
    throw new IllegalArgumentException("No two sum solution");
}
```

### Approach 3: One-pass Hash Table
```java
public int[] twoSum(int[] nums, int target) {
    Map<Integer, Integer> map = new HashMap<>();
    for (int i = 0; i < nums.length; i++) {
        int complement = target - nums[i];
        if (map.containsKey(complement)) {
            return new int[] { map.get(complement), i };
        }
        map.put(nums[i], i);
    }
    throw new IllegalArgumentException("No two sum solution");
}
```
Who’s your Bob?
Tags: dailywriting
Published: 2019-04-09 01:23:27

---
title: Who’s your Bob?
published: true
tags: daily-writing
canonical_url: https://marcusblankenship.com/whos-your-bob/
---

At my last job, Bob was the DBA, SysAdmin and SAN Manager. Bob had been there _forever_, mostly kept to himself, and knew how most everything worked. He’d worked for many different bosses, outlasting them all.

One day about 14 years ago, I asked Bob, _“What would we do if you ever quit, Bob?”_

_“It will take at least four people to replace me,”_ he said with a grin. We both laughed.

Friday I learned that Bob was still at the company, doing the same job, all alone. It’s not unreasonable to think that it could take **six** people to replace him now, or more. He hasn’t been promoted, doesn’t have a team to train, and isn’t paid particularly well.

Bob will probably never quit, but he will retire at some point. Or, have a stroke.

When he does, twenty years of tech debt will come due. There won’t be a payment plan, it will all be due right-now.

Tech debt like this is a failing of management, not technical teams.

For twenty years Bob’s managers and the VP of IS, the CTO, and the entire board of directors have turned a blind eye to the debt they were racking up.

Most everyone in IS knows about it, but just shrugs. After all, if Bob’s not complaining, why should they?

When Bob leaves, voluntarily or not, the company will be screwed. Managers who think they can hire someone to come in and “figure out how it works” are going to have a hard time.

## DevOps is not the answer

Please don’t write me back that DevOps is the answer, it’s not. That’s missing the point.

**Some of you have people on your team who singlehandedly carry decades of knowledge, but I want you to understand it’s not an asset. It’s a liability.**

It’s a debt that you can start paying off today, or you can wait until your Bob leaves, and pay it off at a much higher interest rate. But make no mistake, the debt will be paid.

Does this sound familiar, or am I crazy? Do you see any Bob’s where you work?

Best,  
Marcus

The post [Who’s your Bob?](https://marcusblankenship.com/whos-your-bob/) appeared first on [Marcus Blankenship](https://marcusblankenship.com).
Gradient text style using CSS
Tags: css, tutorial, beginners, webdev
Published: 2019-04-08 06:20:54

---
title: Gradient text style using CSS
published: true
description: Gradient backgrounds started the trend, nowadays websites have more gradient colors for many elements after gradient become widely supported on modern browsers.
tags: ['CSS', 'tutorial', 'beginners', 'webdev']
series: 'CSS Nuggets'
canonical_url: https://learnwithparam.com/blog/gradient-text-in-css/
---

> Follow me on [Twitter](https://twitter.com/learnwithparam), happy to take your suggestions on topics or improvements

Gradient backgrounds started the trend, nowadays websites have more gradient colors for many elements after gradient become widely supported on modern browsers.

One such aspect is styling text with gradient color. Let see it in action

```scss
.gradient-text {
  // set the background color
  background: linear-gradient(to right, #ff8a00 0%, #da1b60 100%);
  // background color masked along the text and clip away the rest
  -webkit-background-clip: text;
  // make fill color to transparent so that masked background color will be shown
  -webkit-text-fill-color: transparent;
}
```

### Browser compatibility

- This is only supported in WebKit based browsers. For other browsers, the color property can be the fallback option to render color related to the gradient color.
- `-webkit-text-fill-color` is a non-standard CSS, so have fallback color property to support every browser without causing accessibility issues on non supported browsers.

{% codepen https://codepen.io/Param-Harrison/pen/pGgGxp %}

Apart from IE, all major browser support this solution. Hope you learn a trick to show a text with gradient color on your site 😋

> Note: This article was originally written for [my blog](https://learnwithparam.com/blog/gradient-text-in-css/). I am republishing it here for the amazing DEV community.
TypeScript - undefined vs null
Tags: typescript, javascript, react
Published: 2019-04-08 06:16:55

---
title: TypeScript - undefined vs null
published: true
description: What to use, undefined or null... Or both?
tags: typescript, javascript, react
---

So the `undefined` vs `null` discussion might seem ancient in the JavaScript world. But for me, the question arises again the more I move over to TypeScript.

There seems to be 3 different "camps" when I try to read posts regarding this...

## TL;DR

I will try to NOT use `null` and trying to only use `undefined`.

I read enough comments from people that has done this and seems happy with it to give it a try.

Pros:
- "Easier" syntax `let variable?:Type;` vs `let variable:Type = null` or `let variable?:Type = null`;
- Most other languages seems to have just one type for this!
- Code does not need to handle both.

Cons
- Longer to write
- The difference between an actually `undefined` variable vs a variable set to `null` is lost.
- JSON can only handle `null` and not `undefined`.

## Camp 1 - use both

So, an alternative could absolutely be to use both. And this is how I have donw previously.
But, as mentioned in the TL;DR, most other languages seems to manage without both, and as a programmer, you might need to handle both undefined and null variables, which can make the code more complex.

The pros are, as mentioned, that there now is a difference between an actually `undefined` variable and one set to `null`.

```typescript
const [value, setValue] = useState<number| null>(); 
let value?:number | null;
// value = number | null | undefined

```


## Camp 2 - use `null`

`null` is a word more used in other languages AND is shorter to write!
Is also works nicely with JSON APIs.

The extra code needed is well worth to be able to differentiate.

```typescript
const [value, setValue] = useState<number| null>(null); 
let value:number | null = null;
// value = number | null

```

## Camp 3 - use `undefined`

There should be no need of two typed and `undefined` is the default one when not setting a value.

Array functions is JavaScript return undefined.

```typescript
const [value, setValue] = useState<number>(); 
function (value?:number) {}
// value = number | undefined

```
What are your default 'safe' meaning in software security?
Tags: discuss, explainlikeimfive
Published: 2019-04-08 06:06:10

`I'm bad at english any word correction welcome`


I never build a well-known app that maybe get some DDOS attack or XSS. This is why I'm asking this kind of question to folks here 😄 I never feels secure about my app. 

Lest talk this on web platform, but I welcome any 'safe' opinion around other platform.

For simplicity lets build Login and Register app only, nothing special.

I'll consider that app safe when I do this:

- Hash password
- Using HTTPS
- Using JWT for auth and store that on localStorage/or cookies
- Sanitize my input

That's it from me. Whats yours? Do you had any tips for me? 😃
Day 9 Learning Javascript
Tags: beginners
Published: 2019-04-08 04:42:03

---
title: Day 9 Learning Javascript
published: true
description: 
tags: #beginner
---

DOM DOM DOM...

Learning about DOM was pretty interesting. I wasn't sure about it's usefulness at first, but then I began to see how essential it is for selecting certain elements, classes, and ID's.

I created a shopping list in HTML and used Javascript and DOM selectors to add interactiveness to it, such as adding an input text field with an enter button and the ability to add new items to the shopping list.

Nothing fancy, but a good way to work with the DOM and have some fun with it.
DBMS For Application Development: Relational Model & Relational Database
Tags: database, sql, datamodel
Published: 2019-04-08 03:24:02

---
title: DBMS For Application Development: Relational Model & Relational Database
published: true
description: 
tags: Database, SQL, Data Model
---
Photo by [Carlos Muza](https://unsplash.com/@kmuza) on [Unsplash](https://unsplash.com)

![Laptp](https://images.unsplash.com/photo-1460925895917-afdab827c52f?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2426&q=80)


A **data model** is an abstract model used to organize your application data  and describes how your data relate to one another and real world objects.
There are many types of data models but the most widely used one is the relational model due to its simplicity.
 
The relational model represents data in tables and are grouped into relationships. A database that uses the relational model is known as a relational database. 


The tables in a relational database is assigned a unique name, usually a name that describe what’s going to be stored in the table.

Below is diagram showing the use of the relational model to describe the database structure and relationship of data in a photo sharing application. This diagram shows how data is related and separated into different tables. Properly modeling your data is powerful in relational databases  because it reduces the chances of data being duplicated and redundant data being retrieved. 

![Data Model Diagram](http://leniquenoralez.com/wp-content/uploads/2019/04/diagram.jpg)

The diagram above is know as a schema diagram. A schema diagram is a visual representation of the database schema that shows the relationship in the database, table attributes, primary key and foreign key. 

The **schema** is the logical design of the database, it includes the table attribute,  attribute type and primary and foreign key constraints.
 
The **primary key** is a set of one or more attribute whose values are used to uniquely identify rows in a table. For example the *user_id*, *username* and *email* in the users table are unique for each user record in the table, these three fields are used to uniquely identify a user.

A **foreign key** is a set of attributes that identifies a record in another table, the foreign key in the referencing table is always the primary key in the referenced table.  A foreign key in the above data model would be the *uid* in the followers table that references a *user* in the user table.

Building an application that uses a relational database requires a lot of thinking ahead to ensure data is retrieved efficiently. 

####Useful Resources
- [The Relational Model [YouTube Video] ](https://www.youtube.com/watch?v=kyGVhx5LwXw)
What are some upcoming trends in the software industry ?
Tags: discuss, career, softwaredevelopment
Published: 2019-04-08 03:22:58

---
title: What are some upcoming trends in the software industry ?
published: true
description: 
tags: #discuss, #career , #softwaredevelopment
---

What are the current trends that are picking up pace in the software world today. I have just finished a course on microservices after hearing about it from colleagues, YouTube channels and every goddamn blog posts. Kubernetees happens to be another big thing which everyone is using or trying to use. So, what are these other software tools/architecture style/framework etc that's picking up everyone's interest in the Dev community ?
Internship/Unpaid or Hold out for Entry-Level?
Tags: beginners, discuss, help
Published: 2019-04-08 01:10:12

---
title: Internship/Unpaid or Hold out for Entry-Level?
published: true
description: 
tags: beginner, discuss, help
---

I'm a self-taught developer who's looking to break through in the industry and I need to get experience somewhere. My living situation can take care of me as long as nothing goes wrong (no savings), but I feel like I'm lying when I apply for jobs that want years of experience for entry level even if I'm honest about my position. There's also opportunity in either internships or non-profits, but I went to a meeting for Central Arkansas Javascript Developers and they recommended I look for entry level jobs, not internships.

Do I hold out and wait until I'll find the right job that will take me as a newbie, or should I be hopping on with anyone who will trust me to get real experience right now?

If you look at it from a no school perspective, it's doing real experience without the debt if they'll take me, but also there's a chance I could get paid while getting experience too and not be as such a burden on my family.
Delete Your Master 
Tags: git
Published: 2019-04-08 00:39:39

---
title: Delete Your Master 
published: true
description: You don't need your master anymore. 
tags: git
---

Distributed version control comes with many ways to organize your code. The master branch is by convention the primary focal point for development. This could be a stable or shared hod podge of integration. 

In either case I recommend that you delete your local copy of master, leave the remote branch. When you you are wanting to start work fetch remote and checkout origin/master (or whatever your working branch is).

Yes this puts you into a detached head. This isn't an issue, git will let you build your branch any time. And it is much easier to name a branch after you have some work behind it to name it.

# How is Local Master Used

Pull requests killed the local master branch. The purpose for this branch is to work out a merge of branches for other work happening. And it is still a valid option picked up by Github. 

Pull/Merge requests provide a web interface and will perform clean merges. Merge conflicts are expected to be addressed in the work branch, and one reason rebase is preferred so many places.

I recommend deleting your local master, but if you have a need to control master locally, by all means bring it back. Just remember git will manage origin/master so you don't have to.
A brief note of love for Markdown        
Tags: coding, morganmurrah, markdown
Published: 2019-04-07 23:57:24

---
title: A brief note of love for Markdown        
published: true
description: markdown, beginnings            
tags: coding, morgan murrah, markdown
---

---
I have fond memories of using Markdown early on when I was learning to code which really started just over two years ago. When I was finding JavaScript challenging in one of my early projects I remember taking one afternoon to work through cheat sheets of Markdown syntax and make some nicely formatted ReadMe files.

A nicely formatted Markdown file as a ReadMe on Github with `code formatted` instructions to enter into the terminal can really make a difference in a developer's experience. There are many libraries and projects I possibly never read further about or experimented with because it did not have a clear ReadMe.

> I still use Markdown today and its an incredibly portable format for blogs and lots of things.

[MacDown is my simple markdown editor of choice on a mac with a live preview](https://macdown.uranusjr.com/)

Here's a sentence with a footnote. [^1]

[^1]: This is the footnote.