teleren/devto huggingface dataset:
My Top 3 books to learn Java programming for beginners
Tags: java
Published: 2019-02-10 09:14:58


---
title: My Top 3 books to learn Java programming for beginners
published: true
description: 
tags: java
---

![alt text](https://thepracticaldev.s3.amazonaws.com/i/a3ih28l3bq12i2g7p5f7.png "")


The Java programming language is one of the most used programming languages in the world and there are thousands of books out there to learn various topics. 

Here are my top 3 books to learn java programming for beginners. Each of these books has its own style. 



***1- How to think like a computer scientist.***

This book is actually the introduction course to computer programming at MIT. The book exists in two versions. One in python and the other in Java. 

I usually recommend this book for computer science students. 




***2- Murach's java programming***

If you want to learn how to get your first steps in the java programming with more practice than theory, this is the book you need. 

All of Murach's publications follow the same pattern. The left page explains a specific point and the right page shows how to get this point done. So, if you open the book at any page you will find the theory at the left and the code at the right. 




***3- Introduction to java programming by Daniel Liang***

I am considering this book a piece of art. It contains a massive amount of information. Its language is very simple for a non-native English speaker like me. The content of the book is well organized. The book also contains some intermediate and advanced topics. 

The most thing I like about this book is its excersises. Each chapter has a set of excersises that start with simple tasks and its difficulty increase gradually.
Looking for open source contribution - HELP
Tags: beginners, javascript, opensource, github
Published: 2019-02-10 19:52:31

---
title: Looking for open source contribution - HELP
published: true
description: 
tags: beginners,javascript,opensource,github
---

Link - https://github.com/0xPrateek/Portfolio-Template
A portfolio website template for Geeks,Programmers,Developers and hackers.
The Power of a Testing Framework
Tags: tdd, testing, fortran, framework
Published: 2019-02-10 23:11:36

---
title: The Power of a Testing Framework
published: true
description: My new testing framework has been a success
tags: tdd, testing, fortran, framework
cover_image: https://everythingfunctional.files.wordpress.com/2019/02/holdingpower-1200-2-1080x608.jpg
canonical_url: https://everythingfunctional.wordpress.com/2019/02/10/the-power-of-a-testing-framework/
---

I am now ready to call Vegetables a huge success. In my [last post](https://everythingfunctional.wordpress.com/2018/11/19/eat-your-vegetables/) I discussed its design and construction. I am now using it in a project at work. The power and convenience it has brought us is huge.

The design of Vegetables is such that its use highly encourages writing your tests in a BDD, or at least a specification style. This means that the act of writing tests encourages you to think more explicitly about the requirements of the code you’re writing.

Now that your test descriptions are written as a requirements specification, the testing framework can report those requirements back to you. We’ve got our tests and our requirements developed as part of a single effort; two birds with one stone.

Next, with all the information collected by the testing framework as part of running the tests, and the ability to ask it be verbose when reporting the results, means our test suite can effectively generate our V&V report for us. That makes 3 things now that we have gotten out of the single effort of developing our test suite.

Finally, I added in the ability to ask the framework to run only a subset of the tests. Add this to the verbose outputs and I can get detailed feedback about the piece of code I’m currently working on, without having to wade through the outputs from the rest of the test suite. This shortens and simplifies the feedback cycle and makes TDD, or at least writing the tests very shortly after the code, much more useful. In fact, I put the following script into our repository for everybody to use while developing or debugging.

```
#!/bin/bash
 
DRIVER_PROGRAM="unit_test_build/vegetable_driver"
 
./shake.sh "${DRIVER_PROGRAM}" && $DRIVER_PROGRAM -q -v -f "${1}"
```

I think having this level of power and flexibility from my testing framework is going to be a must have for any project of significant size in the future. It has proved to be too useful to do without. And if one like this doesn’t exist in the language I want to use, I’ll now be confident about creating it, since I’ve now done it for Fortran.
My EMACS Custom Indent Function Uses 'tab-width'
Tags: elisp, showdev, productivity
Published: 2019-02-11 15:10:25

---
title: My EMACS Custom Indent Function Uses 'tab-width'
published: true
description: Sharing a new trick I learned in Elisp.
tags: elisp, showdev, productivity
cover_image: https://camo.githubusercontent.com/38467eb65de742741e216b6df7f986f2d7a621c6/687474703a2f2f7777772e656d61637377696b692e6f72672f706963732f7374617469632f54616273537061636573426f74682e706e67
---

*I think image came from here: [https://github.com/jcsalomon/smarttabs](https://github.com/jcsalomon/smarttabs)*

I have been investing a guilty amount of time customizing my EMACS init config lately. It began with trying to understand more iterative processes in Elisp, so I read up on loops; most of which are simple examples, but I am a bit proud of what I was able to work on just now.

So I am trying to get the Aggressive Indent package to use 2 spaces for indentation - A.I. uses the local mode indent width - which is not that difficult, but as I dedicate a section of my init to setting these widths I thought I should at least update the custom indent function I had. It was a custom interactive function I mapped to my space key that *insert*(s) two spaces for quick indentation. I used this to quickly indent my code (enter+space or beginning-of-line+space). A horrible process! Anyway now it uses a while loop and the global tab-width variable to *insert* spaces.

```elisp
; Previously
;(defun space-times-2 ()
(defun insert-space-indent ()
  (interactive)
  (setq scoped-indent-width tab-width)
  (while (> scoped-indent-width 0)
    (insert " ")
    (setq scoped-indent-width (- scoped-indent-width 1))
  )
)
```

I thought this was exciting, learning Elisp here and there, it's a very different syntax to the web languages. If this is interesting or helpful I'll share more of Elisp/EMACS stuff I've been learning.

\#candevtobemytwitter
How to create overlapping images with CSS Grid
Tags: cssgrid, css, frontenddevelopment
Published: 2019-02-18 16:00:54

---
title: How to create overlapping images with CSS Grid
published: true
description: Create an overlapping image effect with CSS Grid. No absolute positioning or negative margins needed!
tags: CSS Grid, CSS, Front-end Development 
---

{% youtube sZJrcOfBaNY %}

If you enjoyed this screencast, consider subscribing to my [YouTube channel]
(https://www.youtube.com/channel/UC2jJoQlzvLPvnYfowAEVaOg) for more screencasts about HTML, CSS, and JavaScript.
Look for advice - need React component library for pet project
Tags: react, javascript
Published: 2019-02-20 23:33:05

---
title: Look for advice - need React component library for pet project
published: true
description: 
tags: react, javascript
---

Hello! I have a pet project and I plan to rewrite it in React.
Couple words about project:

- It is working in browser

- It supposes a lot of text editing, visual editing, plots and schemas so it is desktop first.

Right now I use customized Bootstrap 3 for UI. I reduced margins and paddings to have more dense environment.

What is valuable for me:

- It is supposed that user will work in my program for hours. It is very important to keep user eyes. So UI lib should have color themes for that.

- Themes with small component size.

- Possibility of class based customization because I use several third-party visual tools and it should be integrated together.

You can help me by answering questions:

- Which component libraries are suitable?

- Which component libraries are not suitable?

- What colors or color themes are good for long usage?
Sometimes, in the heat of the moment, it's forgivable to cause a runtime exception.
Tags: javascript
Published: 2019-02-21 01:32:39

---
title: Sometimes, in the heat of the moment, it's forgivable to cause a runtime exception.
published: true
description: Perhaps we could benefit from putting more thought into how our code can fail, and who is going to see it when it does.
tags: javascript
---

Runtime errors _suck_. But when you're working in JS they're difficult to avoid. Fortunately though, our whole deal is problem solving; so avoid them we do. 

For client-side JS this seems totally necessary: We shouldn't subject users to runtime exceptions; we should be giving them appropriate feedback in the event of an error.

But do we _always_ want to avoid runtime exceptions at all costs? I'm not convinced. 

In a perfect world, we'd have an equivalent to Elm's compiler in every language. But in the real world, we can save ourselves some time when things actually do go wrong.

Take this, as an example:

```javascript
import someModule from 'someModule';

const {
  someObject: {
    someFunction,
  } = {},
} = someModule;
```

Let's assume that our code is being transpiled with Babel before it's deployed. In this instance, if `someObject` didn't exist in `someModule`, then this would transpile fine. But at runtime, `someFunction` would be `undefined`. 

```
Uncaught TypeError: someFunction is not a function.
``` 

It seems like this code is destined to fail for one of our users. 

Consider if we'd done it this way instead, without the default value in our destructuring:

```javascript
import someModule from 'someModule';

const {
  someObject: {
    someFunction,
  },
} = someModule;
```

Now, if `someObject` doesn't exist in `someModule` we'll get a runtime error when trying to transpile instead of after it's been deployed.

```
Uncaught TypeError: Cannot destructure property `someFunction` of 'undefined' or 'null'.
```

Not only is this feedback much faster, but it's also going to fail on _our_ machine. This particular example can only even happen in one place in any given file, which improves our ability to locate the problem quickly. With any sort of automated build pipeline in place, this error now _can't even possibly make it to production_ any more. Not bad considering that all we did was remove three characters.

This example isn't indicative of every possible problem we can encounter in JS, of course. But this was a real example that I saw recently. It was the direct result of an over-zealous approach to preventing runtime exceptions: something that the original code _didn't even do_. 

**TL;DR**: We ought to spend a lot more time thinking about how and where our code can fail, and we should be very careful to consider unintended consequences we introduce by trying to protect ourselves from errors.
Adding Pages to a Gatsby Project
Tags: gatsby, react, beginners
Published: 2019-02-21 16:27:43

---
title: Adding Pages to a Gatsby Project
description: How to add new pages to a Gatsby project and navigate between them with Gatsby's Link component.
canonical_url: https://michaeluloth.com/gatsby-adding-pages/
tags: gatsby, react, beginners
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/7bmn1ovozc4p9gy3t0ax.png
series: Up & Running with Gatsby
published: true
---

This is the fifth video in our [beginner series](https://www.youtube.com/watch?v=jAa1wh5ATm0&list=PLHBEcHVSROXQQhXpNhmiVKKcw72Cc0V-U) exploring GatsbyJS and how to use it to easily build performant apps and websites.

In this video, we learn how to add new pages to a Gatsby project and how to navigate between them using Gatsby's Link component.

Check out the video below or [view the entire playlist](https://www.youtube.com/watch?v=jAa1wh5ATm0&list=PLHBEcHVSROXQQhXpNhmiVKKcw72Cc0V-U) on YouTube.

Enjoy! 🎉📺

{% youtube ktHshp6SKXc %}
Decorator design pattern [Structural]
Tags: blog, concepts, designpattern, extension
Published: 2019-02-26 03:25:58

---
title: Decorator design pattern [Structural]
published: true
tags: blog,concepts,Design Pattern,extension
canonical_url: https://itscoderslife.wordpress.com/2019/02/23/decorator-design-pattern-structural/
---

The Decorator Design Pattern allows adding new behavior to existing types. We can extend the functionality of the type without modifying its implementation which is a flexible alternative to subclassing.

The Decorator can be implemented via wrapping the object to be enhanced. Extensions provide the ability to add additional methods to types without having to suppress or change their source code.

> The Decorator Design Pattern adds new responsibilities to objects without modifying the code of the type used to create them

Example:

A Basic Color class lets you create color with RGB and HSB. What if I have to create a color using hex values? Typically we subclass. Instead of subclassing we need to extend the same color class and add a function to create color with hex values.

Another example would be when ordering food online a typical burger or subway sandwich would cost x then user also has options to add extra cheese or steak. Sometimes the vendor provides option to add a drink to the cart. All this adding extras would cost additional charges. The final cost is caluclated with calling the decorators to add their cost to the cart over the base item.

Common misuses: Accidentally replacing the existing functionality of a type. Another misuse is that we may change the original purpose of a type by decorating it with unrelated behavior.
Random gif generator, Pricing cards, Cloudinary uploader & more | Module Monday 29
Tags: showdev, opensource, webdev, javascript
Published: 2019-02-25 17:10:56

---
title: Random gif generator, Pricing cards, Cloudinary uploader & more | Module Monday 29
published: true
description: Module Monday 29
tags: showdev, opensource, webdev, javascript
cover_image: https://res.cloudinary.com/component/image/upload/b_rgb:f6f6f6,c_pad,h_370,w_880/v1550949608/gif-generator_j8sqy1.gif
canonical_url: https://guide.anymod.com/module-monday/29.html
---

## 5 open-source website modules you can use anywhere

Everything below is open source and free to use in any project you choose. [Anymod](https://anymod.com) lets you quickly add features to any website or web app.

Click a mod to see it in action along with its source code.

## Random gif generator

Uses the Giphy API to show a new gif every 10 seconds

<a class="btn btn-sm" href="https://anymod.com/mod/raakda?v=20&h1=31&h2=32">View mod</a>
<a href="https://anymod.com/mod/raakda?v=20&h1=31&h2=32">
  <img src="https://res.cloudinary.com/component/image/upload/v1550949608/gif-generator_j8sqy1.gif"/>
</a>

## Cloudinary upload widget v2

Upload to your Cloudinary account from a variety of sources.

<a class="btn btn-sm" href="https://anymod.com/mod/nkklnn?h1=33&h2=34&v=20">View mod</a>

<a href="https://anymod.com/mod/nkklnn?h1=33&h2=34&v=20">
  <img src="https://res.cloudinary.com/component/image/upload/v1550945879/cloudinary_eicv0f.gif"/>
</a>

## Team portraits

Show off your team members to the world.

<a class="btn btn-sm" href="https://anymod.com/mod/allonr">View mod</a>

<a href="https://anymod.com/mod/allonr">
  <img src="https://res.cloudinary.com/component/image/upload/v1550951780/team_sh64vf.gif"/>
</a>

## Pricing table

Ready-to-use pricing cards to showcase your product.

<a class="btn btn-sm" href="https://anymod.com/mod/mlldod?v=20">View mod</a>

<a href="https://anymod.com/mod/mlldod?v=20">
  <img src="https://res.cloudinary.com/component/image/upload/v1550976091/screenshots/pricing.png"/>
</a>

## Fade in quotation

A gentle fade in for any text you choose.

<a class="btn btn-sm" href="https://anymod.com/mod/baaokd">View mod</a>

<a href="https://anymod.com/mod/baaokd">
  <img src="https://res.cloudinary.com/component/image/upload/v1550947127/quotation_wkc0nx.gif"/>
</a>

<hr>

I post new modules [here](https://dev.to/tyrw) every (Module) Monday -- I hope you find them useful!

Happy coding ✌️
How to manage Local vs Dev vs Prod settings.py in latest Django RestAPI?
Tags: help, django, python, discuss
Published: 2019-02-25 20:31:34

---
title: How to manage Local vs Dev vs Prod settings.py in latest Django RestAPI?
published: true
description: as we have some common settings in both local and prod; how to manage the settings that are different from local vs dev vs prod; such as database connections, installed apps, etc...
tags: help, django, python, discuss
---

**Django Best Practices**

As we have some common settings in both Local, Dev, and Prod settings, and also have settings that are different from Local, Dev, and Prod; such as database connections, installed apps, etc...I would like to start my Django app with custom settings_<env>.py file for each environment so that we can have better visibilty in settings and also will not cause git conflicts....
Project Euler #4 - Largest Palindrome Product
Tags: projecteuler, challenge
Published: 2019-05-28 13:46:49

---
title: Project Euler #4 - Largest Palindrome Product
published: true
description: Solving problem #4 from Project Euler, largest palindrome product
tags: projecteuler, challenge
series: Project Euler
---

I'm bumping a "series" that I started last year, where we collectively work on problems from [Project Euler](https://projecteuler.net).

This is [Problem 4](https://projecteuler.net/problem=4), finding the largest palindrome product.

> A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
>
> Find the largest palindrome made from the product of two 3-digit numbers.
Blog post: Release 1.46 of Workflow (Perl)
Tags: perl, workflow, release
Published: 2019-06-05 10:18:56

---
title: Blog post: Release 1.46 of Workflow (Perl)
published: true
description: a release announcement
tags: perl, workflow, release
---
I have just released [Workflow](https://jonasbn.github.io/perl-workflow/) 1.46, a library for building simple state machines in Perl. The release contains a simple patch from an external contributor Oliver Welter.

Not much has happened with Workflow for a long time, [lastest release was back in 2017](https://github.com/jonasbn/perl-workflow/releases/tag/1.45). So it was a pleasant surprise to receive [a PR](https://github.com/jonasbn/perl-workflow/pull/16).

I had to address some issues with the Travis configuration to observe a successful build. The issue was due an issue with my [Dist::Zilla](http://dzil.org/) (`dzil`) configuration requiring a newer [Perl](https://www.perl.org/) than listed in the Travis configuration.

After some [yak shaving](https://en.wiktionary.org/wiki/yak_shaving), the second build demonstrated [an older known bug](https://github.com/jonasbn/perl-workflow/issues/10), which pops up once in a while as a friendly reminder that I have to find the time to address this particular issue. Anyway I was able to get a release shipped quite quickly, not because the bug was critical, but simply to avoid having PRs hanging around for too long and out of respect to the contributor - thanks again Oliver.

This brings me to emphasize some of the interesting aspects of _my_ software development life cycle ([SDLC](https://en.wikipedia.org/wiki/Software_development_process)), which was demonstrated with this release.

1. The ability to evaluate issue reports and change requests easily
1. The ability to build _swiftly_ and immediately
1. The ability release _swiftly_ and immediately

The first part was bound to the branching strategy and having an established [toolchain](https://en.wikipedia.org/wiki/Toolchain) meaning: reviewing and consolidating changes (merge) and testing, all this using Perl, Dist::Zilla, Git/GitHub and the marvelous Perl test libraries.

The ability to perform continuous integration (CI) of an incoming change from a branch (pull request) to a master branch, being _stable_ and always in a known state. Here using the same tools as listed above and Travis.

The third part, being packaging and releasing could be accomplished with ease. Using Dist::Zilla and [PAUSE](https://pause.perl.org/pause/query?ACTION=pause_04about)/CPAN.

If you want to read more about [my feedback loops](dev.to/jonasbn/blog-post-feedback-loops-1gm5) involved in the above process, I have written about it previously.
Right things to do after changing to better domain’s host
Tags: webhosting, domain
Published: 2019-06-26 13:11:59

---
title: Right things to do after changing to better domain’s host
published: true
tags: Web Hosting, domain, web hosting
canonical_url: https://kevinhq.com/things-to-do-after-changing-the-domains-host/
---

.Many things to do after pointing out the domain to another host for whatever reasons. Missing one of them may lead a disaster to your side. There are many things which usually we missed to do after changing the domain’s host. By changing the domain’s host, I mean when you pointed the domain you own… 

[Read More »Right things to do after changing to better domain’s host](https://kevinhq.com/things-to-do-after-changing-the-domains-host/)
Using Browser Custom Events
Tags: javascript, webdev, beginners
Published: 2019-06-26 18:35:08

A lot of times when writing things you may want want to react to certain events on your page.

We do this all the time with builtin ones like `click` or `keydown`

But we can also make our own custom events and have the browser handle all the work for us! Since it's part of the DOM API we get free event code without installing another lib or rolling our own buggy version.

[`CustomEvent`](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent) is what we will be using. We'll wrap it a little to make it a bit neater to use as well.

## Making a custom event

It's pretty simple

```javascript
const event = new CustomEvent("myevent", {details: {some: "data"}});

document.dispatchEvent(event);

```

Notice we had to put our own custom data in the `details` key of the event. This is just a quirk of how they work.

## Listening for a custom event

```javascript
function eventHandler(event){
	const data = event.details.data;
	console.lo(data);
}
document.addEventListener("myevent", eventHandler)
```

## Stopping listening

```javascript
document.removeEventListener("myevent", eventHandler);
```

Pretty easy stuff.

What's great is, we can also dispatch the event on an element so it doesn't bubble up to the dom. Keeping our code event more modularized. Just replace `document` with another element you have.


## A little wrapper.

Because it's a little bit cumbersome to have to write all that everytime you want to use an event. Let's wrap it just a little.

```javascript
function publish(eventName, data){
	const event = new CustomEvent(eventName, {details: data});
	document.dispatchEvent(event);
}
const events = [];
function subscribe(eventName, cb){
	const wrapper =  function(event){
		cb(event.details);
	}
	document.addEventListener(eventName, wrapper);
	
	events.push({
		cb, wrapper, eventName
	})
}

function unsubscribe(eventName, cb){
	events.forEach((event)=>{
		if(event.eventName === eventName && cb === event.cb){
			document.removeEventListener(eventName, event.wrapper);
		}
	})
	
}

export {subscribe, unsubscribe, publish};

```

### Usage

```javascript
function eventHandler(data){
	console.log(data);
}
subscribe("myEvent", eventHandler))
publish("myEvent", {some: "data"});
unsubscribe("myEvent", eventHandler);
```

Et voilà

If you like my stuff please check out my site https://dropconfig.com