teleren/devto huggingface dataset:
Java 8 lambdas: 101
Tags: java, java8, lambda, beginners
Published: 2018-12-27 08:41:28

---
title: Java 8 lambdas: 101
published: true
description: Java 8 lambdas starter for absolute beginners.
tags: java, java8, lambda, beginners
---

All you need is 5 minutes to grok the Lambda expressions introduced in Java 8. This post acts as a starter by quickly demonstrating how lambdas are super cool in replacing hefty anonymous classes.

##Anonymous classes##

You have used them all over - to implement event handlers in GUIs, to specify a Comparator for sorting, etc.

        button.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent event) {
                System.out.println("Hello World!");
            }
        });

By doing this, we are just passing the functionality of handling an event. As in passing code as a method argument.

The problem with simplest anonymous classes - one with a single abstract method, is the unnecessary boiler-plate syntax going along with it.

Lambdas exactly solve this by providing a clean & compact syntax to convey the functionality of single method classes.

##A minimalistic example##

- An interface - `Operation`
- A class - `Calculator`

The `Operation` interface declares a method to operate on 2 integers. This can be implemented by multiple types of operations such as Addition and Subtraction.

    public interface Operation {
        int operate(int a, int b);
    }

The static calculate method performs the operation by calling operate method using supplied operands.

    public class Calculator {
	    public static int calculate(int a, int b, Operation operation) {
		    return operation.operate(a, b);
	    }
    }

We want to invoke calculate to perform a defined operation(implementation of Operation interface) on given operands.

###Approach 1 - Using Anonymous class###

		Operation additionOperation = new Operation() {
			@Override
			public int operate(int a, int b) {
				return a + b;
			}
		};

		int result = Calculator.calculate(2, 3, additionOperation);

###Approach 2 - Using lambda expression###

		int result = Calculator.calculate(2, 3, (x, y) -> x + y);


The lambda expression  **`(x, y) -> x + y`** can be dissected into
1. `(x, y)`
Parenthesis enclosed comma separated set of formal arguments(same as in the Interface method signature).

2. `->`
The arrow to differentiate.

3. `x + y`
The body which can have an expression which is evaluated and returned or a block of statements enclosed by curly braces.

This is how lambdas can easily replace those bulky anonymous classes. They also seem to fit perfectly with the new [Java stream API][1] which is a collection of functional-style transformations.

##Resources##
[Oracle Java tutorials - Lambda expressions][2]

[1]: https://docs.oracle.com/javase/8/docs/api/java/util/stream/package-summary.html
[2]: https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html
Announcing SIESGSTarena's Open Source Site 
Tags: opensource, siesgstarena, github, studentdevelopers
Published: 2018-12-30 04:17:03

---
title: Announcing SIESGSTarena's Open Source Site 
published: true
tags: opensource, siesgstarena, github, student developers
description: Description below
---
<center><img src="https://thepracticaldev.s3.amazonaws.com/i/xolbfpjfj3lyr64qgyp6.png" width="100%"></center>
<a href="https://arena.siesgst.ac.in">SIESGSTarena</a> is the <a href="https://codechef.com/">CodeChef</a> SIESGST Campus Chapter is an online platform for conducting programming competitions. It is a one spot for friendly competition, built on top of competitive programming platform. It was created as a platform to help programmers learn, share and improve themselves in the world of algorithms. This platform is built and maintained by students of <a href="http://siesgst.edu.in/">SIES Graduate School of Technology</a>. <br>
At SIESGSTarena, we focus on improving the level of Competitive Programming in the college as well as we engineer applications at an aggressive pace. To do so, the software or tools, we develop as well as use must be simple to understand, production-hardened, and easily accessible. That’s why we support open source software. We make use of the best the community has to offer, and contribute our best work back to the community.
Our Developer Team is excited to announce <a href="https://siesgstarena.github.io/"><b>SIESGSTarena’s Open Source Site</b></a>, a page highlighting some of the best softwares and tools available on our <a href="https://github.com/siesgstarena">public GitHub page</a>. We have some exciting projects in the works. And they’ll be highlighted here, first. <br>
We hope that SIESGSTarena’s open source software sparks adoption, discussion, contributions and ultimately, an even richer open source community.
<br>
Tea Break Challenge, Day #2
Tags: teabreakchallenge, career
Published: 2019-01-02 16:23:53

---
title: Tea Break Challenge, Day #2
published: true
description: Our choices are the sustenance of our behavior.
tags: teabreakchallenge, career
---

Our choices are the sustenance of our behavior. It may not be immediately obvious, but choices are not only about what we choose to do, but perhaps even more about what we choose *not* to do. This is especially true when we have multiple good options to choose from. Take a moment to write a list of three tempting things you are actively choosing *not* to do today.


https://www.teabreakchallenge.com/messages/2
Public API's
Tags: api, android
Published: 2019-01-08 05:36:32

---
title: Public API's
published: true
description: public api
tags: api, android
---

Yesterday from my Telegram Channel, there is a website that list all public api. I'm a sucker for API. Try to make at least one app (on Android) from the lists. One that caught my attention is Advice Slip (http://api.adviceslip.com/) 

It return simple json.

```{
slip: {
advice: "You can fail at what you don't want. So you might as well take a chance on doing what you love.",
slip_id: "184"
}
}```

I want to use unsplash api (https://unsplash.com) as background and the text on top of image will be the advice from Advice Slip.

So here is the site : https://public-apis.xyz/ for you developer out there to make some MVP. Happy coding.
Snippet or not indexed posts
Tags: meta
Published: 2019-01-09 10:54:47

Sometimes I just want to add quick notes but it's not qualify as proper post. It's something similar to coderwall.com. Maybe we can add another flag like `indexed: false` and this post will not appear in any feed. But it still public with proper url, or maybe you can view it all at specific url like dev.to/snippets/, and people can still react or comment on that post. It just to reduce some clutter on the main feeds from some half finished notes.
Fancy Function Parameters of JS
Tags: javascript, clean
Published: 2019-01-10 01:00:41

---
title: Fancy Function Parameters of JS
published: true
description: 
tags: js, clean
---

The code is from [this post](https://www.javascriptjanuary.com/blog/fancy-function-parameters). It makes the params more clear.

```js
function renderList(list, { 
    ordered = true,
    color = '#1e2a2d',
    bgColor = 'transparent'
} = {}) {
    /* ... */
}

// simple use
renderList(['love', 'patience', 'pain'])

// with all arguments
renderList(['one', 'two'], { ordered: true, color: '#c0ffee', bgColor: '#5ad' })

// with only one optional argument (bgColor)
renderList(['one', 'two'], { bgColor: '#5ad' })
```
Explaining Scrum story points
Tags: scrum, points, agile
Published: 2019-02-23 10:18:52

After many years using Scrum and lots of companies later, I have seen that people have a tendency to assign timings to story points like 3 points = 8hour work. This is bad for planning and makes you unable to use one of the properties of Scrum.

Let's start by quickly recalling the point of the story points and what do we seek to obtain by using them.

Software development teams aren't usually a uniform mind of similar expertise and experience, some people are better at the backend, some have more years of experience, and so on. These differences make them think that they can solve a particular problem in X hours but that X greatly differs on value from member to member of the team and add to that the fact that we, software developers, are way too optimistic at estimating timings. How can we solve these problems?

Fortunately, software developers are extremely good at assessing the complexity of a problem and the appraisal difference between a senior and a junior regarding complexity is not that big when compared to difference while comparing timings.

So, by relating story points to the complexity we gain a more general consensus about the workload of a given problem thus allowing the team to be able to predict how much complexity they can tackle on a given stretch of time.

## Important things to take into account:

- Always remember that this is an iterative process that yields better results the more iterations it runs, so don't expect the first sprint to nail the points.

- Never ever change the points assigned to a story. One of the things you expect to gain is predictability and for that, you need to maintain the same error pattern your team has. If you change the value of a story after a sprint that pattern will be blurred or directly lost.

- It's the product owner job to translate the amount of complexity a team can tackle into timings for upper management and that should never be a concern for the developers.

- If you reduce the number of story points to fit more complexity on the sprint you are only cheating yourself.
ClassicPress development version on your VVV environment
Tags: classicpress, opensource, php
Published: 2019-01-28 09:54:58

---
title: ClassicPress development version on your VVV environment
published: true
tags: ClassicPress,Open Source,php
canonical_url: https://daniele.tech/2019/01/classicpress-development-version-on-your-vvv-environment/
---

I love VVV or Varying Vagrant Vagrants. For developers is very useful also to start working with wordpress and discover new tools. 

The post [ClassicPress development version on your VVV environment](https://daniele.tech/2019/01/classicpress-development-version-on-your-vvv-environment/) appeared first on [Daniele Mte90 Scasciafratte](https://daniele.tech/eng).
What did you learn today?
Tags: whatilearnttoday
Published: 2019-01-16 08:01:32

---
title: What did you learn today?
published: true
description: 
tags: whatilearnttoday
---

Hello dev folks, hope the source is with you. Ok so I was thinking since a career in software engineering requires life long learning, why don't we share the new stuff we learn everyday? using #whatilearnttoday. It can be anything from a feature in a languge to non technical skills that can be applied to our field. What you share might save someone's life you know?
Learning React and Typescript - asking for advice
Tags: react, typescript
Published: 2019-01-17 04:16:09

---
title: Learning React and Typescript - asking for advice
published: true
description: 
tags: react, typescript
---

I want to try React and Typescript. Is there a chatroom I can ask question about both or do I need two separate chats? I tried using Discord but it ask me to claim my account in order to post a message but I don't know what account I should claim (:

Also, can someone refer to me to good example of React and TypeScript? maybe this repo? https://github.com/Lemoncode/react-typescript-samples


Thanks!
Changelog: JSFiddle Liquid Tags Now Live
Tags: meta, changelog
Published: 2019-01-17 21:16:10

We have another new tag, the JSFiddle tag!

[JSFiddle](https://jsfiddle.net) is another place where you can save and share your code online. It's a great place to make quick demos to then show off in your blog posts.

The standard look is like so

```
{% jsfiddle https://jsfiddle.net/link2twenty/7m6ej0m9/ %}
```
{% jsfiddle https://jsfiddle.net/link2twenty/7m6ej0m9/ %}

but you can also choose which tabs to include and in which order they should appear. The tabs you can have are `js,html,css,result`.

```
{% jsfiddle https://jsfiddle.net/link2twenty/v2kx9jcd/ result,html,css %}
```
{% jsfiddle https://jsfiddle.net/link2twenty/v2kx9jcd/ result,html,css %}

Or even just have the results panel

```
{% jsfiddle https://jsfiddle.net/link2twenty/xyycj5ta/ result %}
```
{% jsfiddle https://jsfiddle.net/link2twenty/xyycj5ta/ result %}
Friday Blast #54
Tags: fridayblast, links, post
Published: 2019-01-20 14:43:28

---
title: Friday Blast #54
published: true
tags: friday_blast,links,post
canonical_url: https://horia141.com/friday-blast-54.html
series: "Friday Blast"
---

[Timeouts and cancellations for humans (2018)](https://vorpus.org/blog/timeouts-and-cancellation-for-humans/) - a precursor to the Trio article from [last week](https://dev.to/horia141/friday-blast-53-3ffc-temp-slug-3521549), this one deals with a more structured way to handle timeouts and cancellations in general. Like in that one, the notion of scope is married with the _cancel token_ of C# fame to get something really interesting. This one and the previous article have actually made me yearn for trying some of that scope based concurrency. I’ve also long had my suspicions that some of the ways in which timeouts are handled are not so great, and end up with additive timeouts if not downright incorrect code.

[50 years in tech: the Exxon delusion (2018)](https://mondaynote.com/50-years-intech-part-4-the-exxon-delusion-d92ada84f6e) - war stories from somebody who has almost twice as much tech experience as I have lived. Interesting that even in the 70s there was the notion of _data being the new oil_. Things are so fast in the tech industry, even our cycles are quick.

[Reinforcement learning - bandit problems (2018)](https://oneraynyday.github.io/ml/2018/05/03/Reinforcement-Learning-Bandit/) - I don’t think folks’ll get that much from this without some prior “bandits context”, but for me it was a refresher. A nice tidbit, I’ve wanted to write about for some time, which this article mentions. One can think of “A/B testing”, “bandit problems” and “reinforcement learning” as very related techniques, in increasing order of complexity. For the first one, everything is static and predetermined wrt the actions that must be taken. For the bandit case, we’re allowed to learn globally about which actions are good and which are not and adjust things accordingly. For the reinforcement learning case we can learn _locally_ (that is, consider the state in which the system is), and work from there.

[Computing SVDs and pseudoinverses (2018)](https://www.johndcook.com/blog/2018/05/05/svd/) - the SVD is a workhorse of linear algebra, and a nice theoretical thing to boot - how many “things” apply to all matrices, for example? The pseudoinverses has the same relationship to the inverse as the SVD has to the diagnoalization. It pops up a lot in practice as well - in the same setups. Approximations of best solutions etc.

[Why we built Docker? (2013)](https://www.youtube.com/watch?v=3N3n9FzebAA) - back when Docker was just 3 months old, it’s creator gave this very cogent talk about what sort of issues Docker would solve and what they hoped it would do to the tech ecosystem. In the end it did a bunch more than that, but somehow it feels like _it’s still not there yet_. Just 5 years ago.
Top 5 DEV Comments from the Past Week
Tags: bestofdev
Published: 2019-01-22 15:44:16

---
title: Top 5 DEV Comments from the Past Week
published: true
description: Highlighting some of the best DEV comments from the past week.
tags: bestofdev
cover_image: https://res.cloudinary.com/practicaldev/image/fetch/s--7VrAA2ln--/c_imagga_scale,f_auto,fl_progressive,h_420,q_auto,w_1000/https://thepracticaldev.s3.amazonaws.com/i/qmb5wkoeywj06pd7p8ku.png
---

This is a weekly roundup of awesome DEV comments that you may have missed.  You are welcome and encouraged to boost posts and comments yourself using the **[#bestofdev](/t/bestofdev)** tag.

I love a good cathartic rant, and the **[Sh*tpost: can we stop saying "syntactic sugar"?](https://dev.to/jenninat0r/shtpost-can-we-stop-saying-syntactic-sugar-3i4j)** was no exception.  @marek hopped in with some useful thoughts on the subject:
{% devcomment 8871 %}

There was a great conversation where people answered: **[What do you do while waiting for tests to finish running?](https://dev.to/jess/what-do-you-do-while-waiting-for-tests-to-finish-running-5898)**.  At the top of the thread was a reply from @sergio who described the difference in test speeds for Rails/Elixir:
{% devcomment 86ga %}

In at truly great article, **[25 years of coding, and I'm just beginning](https://dev.to/dechamp/25-years-of-coding-and-im-just-beginning-442n)**, @tylerlwsmith empathized and described how they related to the author:
{% devcomment 8751 %}

In a discussion of Slack's new logo — **[Slack Has A New Face](https://dev.to/forstmeier/slack-has-a-new-face-e1f)** — @objque basically won the thread 🦆🦆🦆🦆:
{% devcomment 87gn %}

@derekjhopper rounds things off this week with a wonderful comment about how to think about making a contribution to open source.  The entire **[Open source contribution for beginners?!](https://dev.to/coreyrodgers95/open-source-contribution-for-beginners-pf7)** article and discussion is worth a read:
{% devcomment 87d1 %}

See you next week for more great comments ✌
Google Chrome Licensing API returning 500 error. Need help!
Tags: help
Published: 2019-01-22 17:35:45

---
title: Google Chrome Licensing API returning 500 error. Need help!
published: true
tags: help
---

Hi. Any Chrome Extensions developer here?

I've developed a chrome extension and I'm trying to provide Free Trial to users using Google License API. I'm taking the code here(https://stackoverflow.com/questions/25707443/chrome-web-store-payments-free-trial-for-extension) as reference. Getting OAuth token is working fine. But after that when I'm making a call to the license API, I'm getting below 500 error(in link). I'm not sure what I'm doing wrong. Any help is appreciated!

https://thepracticaldev.s3.amazonaws.com/i/yviatoopipigebonhlup.png
These are your biggest enemies
Tags: education, motivation, inspiration
Published: 2019-01-23 08:37:01

---
title: These are your biggest enemies
published: true
description: Obstacles that will prevent anyone from success
tags: education, motivation, inspiration
---
Through my humble experience, these are the biggest enemies if any ambitious person:

<b>1- Luck</b>

Luck can drastically change a person’s life, let’s say that one has won the lottery, he/she will become very famous and rich. However, keeping the money is the hardest part.

If you want to build a successful company, you need to put luck away because if you want your success to last forever then you should be able to stand up and overcome all the challenges especially when everything is against you (life, luck, crisis).

If you overcome all the obstacles while luck is against you, then what would life be if luck turned back to your side.

If you rely on luck, then you might get lucky for a small period of time then you will begin to fall apart.

<b>2- Smoking</b>

Smokers should stop smoking if they want to become successful. Just look at all the famous people like Steve Jobs, Bill Gates, Dan Lok, Wes Brown etc… Do they smoke?

Smoking prevents you from being successful because the money spent to buy cigarettes can be invested on yourself or on your company.

Assuming you’re buying an average of one packet of cigarettes that cost 3$ every day. By a simple math calculation, you can find that you’re spending almost 11000$ in 10 years (3*365*10). You might think that this is a small number, but if you invest this sum on yourself therefore, you would’ve been able to double or triple this amount since you could’ve mastered a skill that is worth thousands of hundreds of dollars.

My advice is, before buying a cigarette, think about how you could’ve used that money to your advantage. If you couldn’t find anything now, then put aside, everyday, 3$ and forget about them. When you find out what skill you can learn or master, then spend that money on it.

<b>Related Article:</b> <a href="https://dev.to/hussein_cheayto/no-more-stress-using-this-trick-2o4k">No More Stress Using This Trick</a>

<b>3- Alcohol</b>

Too much alcohol will give you a hangover all day, therefore, you won’t be able to concentrate or work which leads you to lose a precious amount of time.

You can learn more about time and how to be efficient <a href="https://dev.to/hussein_cheayto/7-things-that-i-wish-i-knew-when-i-was-younger-135g">here</a>

<b>4- Overnights</b>

Staying up all night is a bad habit. Try to become a day worker. Wake up early everyday and begin building your dreams. Sleeping all day will prevent you from being productive since you will feel lazy.

Finally, I hope that this article was helpful for at least one person, therefore, I would be happy that my time spent writing this article would be effective and not considered as wasted time.

<b>Related Article:</b> <a href="https://dev.to/hussein_cheayto/best-ways-to-get-great-ideas-884">Best Ways To Get Great Ideas</a>
EF Core Auto Migration with No Data Loss
Tags: efcore, entityframeworkcore, showdev, help
Published: 2019-01-28 06:51:51

---
title: EF Core Auto Migration with No Data Loss
published: true
description: Live Migration support for EF Core
tags: ef-core,entity-framework-core,showdev,help
---

EF Core has dropped support for Auto Migration, which is very useful in prototyping applications. Migration support is too laborious in EF Core.


# Introducing EF-Core-Live-Migration

## Features

1. Creates Missing Table
2. Creates Missing Columns
3. If column already exists and if data type is different, then old column is renamed and new column column will be created with transfer of data from old, transfer can be lossy, 
4. Renames old indiexes and creates new ones
5. Creates indexes based on foreign keys

## Installation

```ps
PM>Install-Package NeroSpeech.EFCoreLiveMigration
```

## Configure

```c#
public void Configure(IApplicationBuilder app, IHostingEnvironment env){

	if(env.IsDevelopment()){
		app.UseDeveloperExceptionPage();

		using (var scope = app.ApplicationServices.GetService<IServiceScopeFactory>().CreateScope())
		{
			using (var db = scope.ServiceProvider.GetRequiredService<AppModelContext>())
			{
				MigrationHelper.ForSqlServer(db).Migrate();
			}
		}
	}

}
```

## Limitations

Works only with SQL Server right now.


## Old Name Attribute

If you decide to rename a column, you can mark the property with `[OldName("name")]`, so while migration, it will rename existing column if there is no data loss. In case of data loss, existing column will be saved as other column and data will be transferred to new column.

## Help Wanted

The API was written without Migration API introduced later in EF Core. I need help in rewriting API with Migration API so it can be used with any backend.
Create your own eCommerce Shop in Laravel
Tags: githunt, laravel, opensource, webdev
Published: 2019-01-28 07:48:37

---
title: Create your own eCommerce Shop in Laravel
published: true
description: Bagisto is an Open Source Laravel eCommerce package that has totally reinvented the wheel of eCommerce ecosystem providing multi warehouse feature out of the box.
tags: githunt, laravel, opensource, webdev
---

The new entry in Open Source eCommerce frameworks, [Bagisto - Laravel eCommerce](https://bagisto.com/en/) has recently launched the [beta version](https://github.com/bagisto/bagisto/releases/) of their new release. Folks at Bagisto considered this as a major update. 

Addition to that, the new [multi-vendor extension](https://bagisto.com/en/laravel-multi-vendor-marketplace/) allows you to attract vendor to sell on your marketplace. Also with multi warehouse inventory, they have totally redefined the way you manage your multiple inventory sources in eCommerce.  

Check it out on GitHub:

{% github bagisto/bagisto %}