teleren/devto huggingface dataset:
Tips and Tricks for Programming Beginners
Tags: tipsandtricks, programming, tips, computerscience
Published: 2019-07-11 14:24:38

---
title: Tips and Tricks for Programming Beginners
published: true
tags: tips-and-tricks,programming,tips,computer-science
canonical_url: 
---

[![](https://cdn-images-1.medium.com/max/2600/0*rXXypb_bGBTqtUrM)](https://medium.com/@sid12.dubey/tips-and-tricks-for-programming-beginners-f22e0ce24516?source=rss-65edcdb268ba------2)

How not to lose your mind while coding

[Continue reading on Medium »](https://medium.com/@sid12.dubey/tips-and-tricks-for-programming-beginners-f22e0ce24516?source=rss-65edcdb268ba------2)
Learning NextJs - Day 9
Tags: react, nextjs, javascript
Published: 2019-06-29 18:59:40

NextJs by default allows you to bring your own static files (js, css, images, json, etc) without any extra configuration.
In order to do that you need an **"static"** folder inside your project.

So let's create the folder with that specific name

```bash
mkdir static
```

Now you can put an image there (or any other static file) and use it in your pages. Let's pretend you have the logo of your app inside the **static** under the creative name of **mylogo.png**.

You can use the following path to show the logo in an img tag

```bash
/static/mylogo.png
```

Let's create a **contact.js** page

```jsx
function Contact() {
  return (
    <img src="/static/mylogo.png" alt="My App Name" />
  );
}

export default Contact
```

And if you start your NextJs server and go to the url **/contact** you will see your logo.

### Custom Server

If you have integrated next with express, [hapijs](https://dev.to/eperedo/learning-nextjs-day-8-11) or any other web framework, you will need to declare that route on your web framework as well.

If you are using hapijs the route will look like this

```js
// other code omited 
// for reading purposes

server.route({
  method: 'GET',
  path: '/static/{p*}',
  handler: nextHandlerWrapper(app),
});
```

With this you are telling HapiJs to use the nextHandlerWrapper every time a request to the **static** folder is made.
Understanding SQL Injection and Prevention using Parameter Binding in PHP
Tags: webdev, sql, php, security
Published: 2019-10-27 12:22:29

---
title: Understanding SQL Injection and Prevention using Parameter Binding in PHP
published: true
date: 2019-06-29 18:22:43 UTC
tags: webdev, sql, php, security
cover_image: https://i0.wp.com/geekyminds.co.in/wp-content/uploads/2018/12/pexels-photo-735911-e1545757437332.jpeg
canonical_url: https://geekyminds.co.in/prevent-sql-injection-with-parameter-binding/
---

Happy Diwali 🎆 folks! When I learnt PHP for the first time, I wasn't really aware of the good practices regarding web security in PHP. Over the years, fuelled by my inquisitiveness and will for perfection, I put the effort in hours of research to figure out how exactly we can safely interact with the database in PHP.

If you try to do so yourself, you will realise that the experience of traversing the PHP documentation is not that convenient and there exist multiple ways of doing the same thing which is frankly very confusing to beginners. 🙄

Therefore, in this article, I decided to compile what I learnt and show you two ways of preventing most SQL Injection attacks in PHP (MySQLi and PDO) in a comparative fashion and explain their usage step by step. 🎉

### This is what I am going to cover:
* SQL Injection
  * Short explanation
  * A simple example
* Preventing SQL Injection
  * Using Parameter Binding in MySQLi
  * Using Parameter Binding in PDO
* MySQLi vs PDO

In my next article, I am going to dive deep into Parameter Binding with real-life examples.

[Continue reading "Preventing SQL Injection with PHP using Parameter Binding"](https://geekyminds.co.in/prevent-sql-injection-with-parameter-binding/)

The post [Preventing SQL Injection with PHP using Parameter Binding](https://geekyminds.co.in/prevent-sql-injection-with-parameter-binding/) appeared first on [GeekyMinds](https://geekyminds.co.in).
Some helpful docker links
Tags: docker
Published: 2019-06-29 17:33:02


It's been 1 year plus 2 month since i wrote my first docker-compose.yml file.
Every once in a while i stumble upon a docker feature that i didn't know existed.
here are some links that were helpful:

Learn docker youtube series:
- https://www.youtube.com/watch?v=YFl2mCHdv24
- https://www.youtube.com/watch?v=Qw9zlE3t8Ko
- https://www.youtube.com/watch?v=F82K07NmRpk

General docker tips:
- https://blog.cloud66.com/10-tips-for-docker-compose-hosting-in-production/

Caching dependencies or how can you speed up docker builds:
- https://www.sentinelstand.com/article/composer-install-in-dockerfile-without-breaking-cache
- https://medium.com/@stepanvrany/how-to-build-nodejs-docker-image-using-cache-c401137661d0

Using dev and prod docker-compose files:
- https://stackoverflow.com/a/53522670/5915221

Using .env for storing secrets:
- https://stackoverflow.com/a/50201232/5915221

A fully automated HTTPS server:
- https://github.com/SteveLTN/https-portal

CI/CD with docker and jenkins:
- https://hackernoon.com/deploying-frontend-applications-the-fun-way-bc3f69e15331
Dynamic DNS with Netlify
Tags: netlify, api, python
Published: 2019-06-29 15:56:42

---
title: Dynamic DNS with Netlify
published: true
description: Use Netlify's API to update DNS records for dynamic IP's
tags: netlify, api, python
---


I purchased a domain for remote access to my home a while ago, but it was just sitting there for about a year. So I decided to do something about it. 

Looking at the different dynamic DNS providers, I didn't really like what they offered, or it cost $$. And I'm sort of a cheap-skate. I had used Netlify for a side project and liked what they offer. So I looked into housing my DNS with them. Turns out, most, if not everything they do is available over API. Unfortunately their API spec (https://open-api.netlify.com) didn't have what I wanted. So I went digging 


I opened up the Chrome debugger and looked at the network requests that the page was doing to update DNS records, turns out it's pretty simple. The End point for DNS's is 
``` https://api.netlify.com/api/v1/dns_zones/example_com/dns_records ```



At this end point you can add new records following this convention
```
{
    dns_zone_id: "11111111111111111",
     errors: [],
     flag: null,
     hostname: "example.com",
     id: "1111111111111111111",
     managed: false
     port: null
     priority: null
     site_id: null
     tag: null
     ttl: 3600
     type: "A"
     value: "1.1.1.1"
}
```
And to delete a record all you have to do is to send a `DELETE` request to 
``` https://api.netlify.com/api/v1/dns_zones/example_com/dns_records/<id> ```


So with this new found knowledge, I wrote some python running as a cron job on my raspberrypi to update my DNS with my home IP. If you want you can check out the code here.

{% github grein007/netlify-dns-client %}



P.S. I've been a lurker on dev.to for about a year, and finally decided to write.  Hopefully everyone will enjoy this information!
Creating a New Spring Boot Project 
Tags: java, webdev, spring, springboot
Published: 2019-06-29 15:41:18

---
title: Creating a New Spring Boot Project 
published: true
description: Working with Spring Boot and Java
tags: Java, Web Development, Spring, Spring Boot
---


## Requirements 
* Browser
* An IDE Intellij, Netbeans or Eclipse
* Stable Internet Connection 

For this article, we would be focusing on only two IDEs Intellij and Netbeans. 


## For Netbeans IDE

### Step 1: Open your Browser and Navigate to [Spring Initializr](https://start.spring.io/)

![HomePage](https://res.cloudinary.com/dm9m9lutv/image/upload/v1561821657/Homepage_tqbsro.png)
 
### Step 2: Select your language 

### Step 3: Select the version of Spring Boot

### Step 4: Select Dependencies

Dependencies used depends on the Project. Select according to the project. For example, a simple registration form with Html and CSS will require the following major dependencies

* Spring Web Starter 
* Thymeleaf
* Spring Security
* Spring Data JPA
 
![Dependencies](https://res.cloudinary.com/dm9m9lutv/image/upload/v1561821618/Dependencies_zpa4lb.png)

### Step 5: Click Generate the Project at the Bottom of the page. 
This downloads a ZIP file that contains the dependencies just picked. 
 
![Download](https://res.cloudinary.com/dm9m9lutv/image/upload/v1561821638/Download_dxclgx.png)

### Step 6: Import the ZIP file in Netbeans
 
![import](https://res.cloudinary.com/dm9m9lutv/image/upload/v1561821696/import_vuacus.png)
 
### Step 7: Build the Project with dependencies 

![Build](https://res.cloudinary.com/dm9m9lutv/image/upload/v1561821728/Build_mw1n3l.png)
 
>This will take a few moments. 

>You must have a Stable Internet connection

## Once the downloads are done you are good to go!

---
---

## For IDEA Intellij IDE

### Step 1: Create a new Project in Intellij 

![Intellij](https://res.cloudinary.com/dm9m9lutv/image/upload/v1561821595/NewProject_xezjes.png)
 
### Step 2: Create a new Spring Initializr project 

![initializr](https://res.cloudinary.com/dm9m9lutv/image/upload/v1561821750/Initializr_leqa06.png)
 
### Step 3: Select language and other Metadata 
Just like on the Spring Initializr website, it has requirements.

![Requirements](https://res.cloudinary.com/dm9m9lutv/image/upload/v1561821595/Requirements_r1pvw0.png)
 
### Step 4: Select Dependencies required
 
![Pick Dependencies](https://res.cloudinary.com/dm9m9lutv/image/upload/v1561821676/Pick_rauoyl.png)

![Done](https://res.cloudinary.com/dm9m9lutv/image/upload/v1561821744/Done_vaoowq.png)

## Once the downloads are done you are good to go

>You need a Stable Internet Connection

>This will take a few minutes depending on the Speed of your Internet

# Happy Coding!!
State or this.state?
Tags: react, state, flatiron, javascript
Published: 2019-06-29 02:32:01

The original title of this blog post was "What does constructor actually do?" But as I struggled to get my thoughts down to 1 min or less, my dismal attempt at creating a poems app helped to crystalize the question I wanted to address. 

####If it's a question of what the constructor does, the answer is :
- to initialize your component

But why someone might use constructor versus initializing `state ={}` is less clear. Though I've researched the topic, I'm still grasping at the nuanced differences for <b>when</b> is the best time to choose one over the other

I personally like using class components without props because:
- it's simpler/shorter code
- it inherits methods from React.Component
- Also inherits constructor, which you won't <b>have to</b> write (though you can still choose to)

####Creating Component without props
```javascript
class MyComponent extends Component {
state = {

}
...
```

Surprisingly, many online resources use functional components or use class with props. This means you have to:
- write more lines of code
- create a constructor with props
- then pass the props value from constructor to super
- call `super(props)` in order to can use `this.props`
 

####Creating Component with props
```javascript
class MyComponent extends React.Component {
    constructor() {
        super();
        this.state={
            
        }
     }
...
```
Clearly, I need to read more on this topic. But since it's something I am having to spend more time on, it seemed like it might be helpful to share what I've learned.

As always, [here's a StackOverflow link](https://stackoverflow.com/questions/51118103/this-state-vs-state-in-react) I came across in my Googling
What Dev.to Theme Are You Using?
Tags: discuss, beginners, meta
Published: 2019-06-29 15:30:09

---
published: true
---

Did you know Dev.to has themes? Until recently, I definitely didn't. Now I can't live without Dev.to night theme, it even turns the "Write A Post" button into an awesome street sign.

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

## How to Use Dev.to Themes

1. Go to `Settings`
   
    ![](https://thepracticaldev.s3.amazonaws.com/i/ry2uw9yoegbbuj0uomxt.png)


2. Go to `Settings->Misc`

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


3. Scroll Down and Choose Your Theme

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

4. Even Transfers to Mobile!

    ![](https://thepracticaldev.s3.amazonaws.com/i/jv1k9404z7all5m8e9ls.jpeg)


**What Theme Are You Using?**


<a href="https://twitter.com/taillogs" rel="some text">
![Foo]
(https://thepracticaldev.s3.amazonaws.com/i/gmrz82bjwhej1f1iqb1e.png)</a>
imbalanced-learn 0.5.0 is out
Tags: machinelearning, python, datascience
Published: 2019-06-29 15:02:49

imbalanced-learn is your favorite python package that offers a number of re-sampling techniques commonly used in datasets showing strong between-class imbalance.


This is a small release that contains mostly bug fixes and is already available via pip and conda!

You can install it either by using pip
```
pip install imbalanced-learn -U
```
or by using the conda package manager
```
conda update imbalanced-learn
```

The changelog can be found [here](http://imbalanced-learn.org/en/stable/whats_new.html#version-0-5), while installation instructions, API documentation, examples and a user guide can be found [here](http://imbalanced-learn.org/en/stable/).

Happy hacking,
Chris
Why do developers use what they use?
Tags: discuss, adoption, frameworks, tools
Published: 2019-06-29 14:41:27

---
title: Why do developers use what they use?
published: true
description: Factors driving adoption of development technology
tags: discuss, adoption, frameworks, tools
---

I've been studying adoption of development frameworks, platforms, languages, standards, tools, and techniques and I wonder what are the factors that drive the popularity of certain technologies over others. I'd love to hear from the dev community. Looking forward to your comments!
Java EE is dead, why still using it?
Tags: java, microservices
Published: 2019-06-29 14:12:41

I've been working as a software developer for 3 years now. In those years, I worked with Java as the main web development language, primarily Spring Boot framework within micro-services architecture. 

I know that I barely have experience in the web development, but I still see some companies seek Java EE developers while they're adopting the micro-services architecture. I mean why would you do that! Do we need Java EE in the micro-services architecture? Should I know more about Java EE Servlets and Pages? and most importantly **Is Java EE dead** especially with all the hype of micro-services?

What do you think folks?
Daily Challenge #2 - String Diamond
Tags: challenge
Published: 2019-06-29 13:29:29

---
title: Daily Challenge #2 - String Diamond
published: true
series: Daily Challenge
description: Daily challenges for the DEV Community. Day #2.
tags: #challenge
---
Welcome to Day 2 of our challenge series. Today, you’ll be using some clean and polished code to create a clean and polished diamond.

Our challenge comes from user [_@jayeshcp_ on CodeWars](https://www.codewars.com/kata/5503013e34137eeeaa001648).

>Your task is to return a string that displays a diamond shape on the screen using asterisk (“*”) characters.
     
![](https://d1jfzjx68gj8xs.cloudfront.net/items/183I1R0r1D0I1E1a2q0v/Image%202019-06-25%20at%202.13.42%20PM.png?X-CloudApp-Visitor-Id=3416980)

>The shape that the print method will return should resemble a diamond. A number provided as input will represent the number of asterisks printed on the middle line. The line above and below will be centered and will have two less asterisks than the middle line. This reduction will continue for each line until a line with a single asterisk is printed at the top and bottom of the figure. 

>Return `null` if input is an even number or a negative number.

>Note: JS and Python students must implement `diamond()` method and return `None` (Py) or `null`(JS) for invalid input. 

Bonus points awarded for experimenting with any extra features.

Good luck!

***

_Thank you to [CodeWars](https://codewars.com/), who has licensed redistribution of this challenge under the [2-Clause BSD License](https://opensource.org/licenses/BSD-2-Clause)!_

_Want to propose a challenge for a future post?  Email **yo+challenge@dev.to** with your suggestions!_
Daily Challenge #1 - String Peeler
Tags: challenge
Published: 2019-06-28 19:59:27

---
title: Daily Challenge #1 - String Peeler
published: true
series: Daily Challenge 
description: Day 1 of the Daily Coding Challenge series.
tags: #challenge
---
Hey, everyone. We've decided to host a daily challenge series. We'll have a variety of challenges, ranging in difficulty and complexity. If you choose to accept the task, your goal is to write the most efficient function you can for your language. Bonus points for any features you add!

I’ll start you off with a simple, straightforward challenge. Our first one comes from user [_@SteadyX_ on CodeWars](https://www.codewars.com/kata/56bc28ad5bdaeb48760009b0).

>Your goal is to create a function that removes the first and last letters of a string. Strings with two characters or less are considered invalid. You can choose to have your function return null or simply ignore. 

The fundamentals are important, it only gets more difficult from here. 

Happy coding!

---
_Thank you to [CodeWars](https://codewars.com), who has licensed redistribution of this challenge under the [2-Clause BSD License](https://opensource.org/licenses/BSD-2-Clause)!_

_Want to propose a challenge for a future post?  Email **yo+challenge@dev.to** with your suggestions!_
Top 10 Programming Memes (pemes)
Tags: memes, programming, fun
Published: 2019-06-29 12:31:00


---
title: Top 10 Programming Memes (pemes)

published: true
description: A short humorous post to bring out the absurdity and hilarity present in the daily lives of programmers.
tags: memes, programming, fun
cover_image: 'https://www.apifonica.com/sites/default/files/programming-jokes-1-apifonica-blog.jpg'
---

Programming is hard, and things break constantly. Sometimes, it can get pretty stressful to clean up all the mess in time to go live on launch day. Nevertheless, programmers always find a way to see the humor in their everyday circumstances, and that's what I love about this fraternity. So let's check out some of the best programming memes I found on the web this week, or pemes as I like to call them. 😆

### When you have debugging issues 🐛
<img src="https://www.probytes.net/wp-content/uploads/2018/01/4-1.png">

### When you are educated, but not smart 👩‍🎓
<img src ="https://i.redd.it/m41loixjno811.jpg" style = "height:400px;width:100px">

### The journey of a programmer🌋
<img src = "https://pics.me.me/trying-to-learn-any-programming-language-100-just-a-little-7917454.png">

### Which one are you? 😏
<img src ="https://i.pinimg.com/236x/9f/7c/42/9f7c42a12a59e2706b144d62d9b67f4e--programming-humor-computer-programming.jpg">

### How programmers think of users 👤
<img src = "http://weknowmemes.com/wp-content/uploads/2013/10/how-users-see-the-programmers.jpg">

### Why dinosaurs are still as scary as ever 🐱‍🐉
<img src ="https://scontent-sin.cdninstagram.com/vp/1a166e2ac41895a4ca662816fb2aa47a/5D2E26E2/t51.2885-15/e35/49956551_456572501545139_1638838700846390092_n.jpg?_nc_ht=instagram.ffra1-1.fna.fbcdn.net&ig_cache_key=MTk2MzIwNjA4NTM5NzkzMDY3Nw%3D%3D.2">

### Programming ninja or overconfident prick? Perhaps both 🐱‍👤
<img src = "https://cdn-images-1.medium.com/max/1614/1*8BlqJ8lNVZzuRjAg1mZ50w.png">

### When a tester is allowed to fix their own reported bugs 🤷‍♂️
<img src ="https://cdn-images-1.medium.com/max/1600/1*nkWf1zVrZ3DCZgnsZAXLWg.jpeg">

### Being this good doesn't come easy 😎
<img src = "https://pics.me.me/200-line-if-else-statement-everything-in-main-undocumented-code-if-25999016.png">

### If I write enough if statements, the program will become sentient! 🤖
<img src = "https://i.imgur.com/1AraF4i.jpg"> 

## That's all for now!

If you had to describe your programming life in just one meme, what would it be? Tell everyone in the comments below!
And hey, don't forget to check out our Telegram group [Dev.to](https://t.me/bestofdev) where we share the best Dev articles and some great resources. It's almost 400 people strong now. 💪

See you in the next post!

<img src = "https://media.giphy.com/media/nykYpcW7FkRDG/giphy.gif">
An Issue with Learning JavaScript
Tags: javascript, selftaught, discuss
Published: 2019-06-29 05:33:51

---
title: An Issue with Learning JavaScript
published: true
description: 
tags: JavaScript, self-taught, discuss
---

I've been learning JavaScript for a few months now. I've purchased a few JavaScript courses (some of those advanced) from Udemy. Despite a few errors here and there, I generally find them useful. 

Andrew Mead's [The Modern JavaScript Bootcamp](https://www.udemy.com/course/modern-javascript) is probably my primary source for JavaScript. We are building both a notes app and a todo app with some appreciable functionality. 

I generally understand the concepts really well, but I have issues when it comes to coding some of this from scratch. Knowing not only why we place code but where we place it. And nested functions. This is my biggest challenge. 

From what I can discern from the Web my best bet to build up these complex apps is to simply start practicing on more projects. I have a few personal projects I'd like to work on, but I don't think I'm quite ready for them. 

I think I'll finish the JavaScript module from Free Code Camp and then start the projects associated with that module. 

Do you have any ideas about what kinds of small projects to start?
Boeing's 737 Max Software Outsourced to $9-an-Hour Engineers
Tags: discuss
Published: 2019-06-29 12:00:27

I just got my eyes on an article from Bloomberg about the recent Boeing crisis. It seems that in their effort to cut down costs and boost sales, Boeing laid off their own engineers and outsourced software development to companies that ended up using low-pay temporary workers to write the code.

It seems the problems are present not only in the currently-grounded 737 Max planes but also in older models.

I just hope Airbus doesn't do similar things. And I can't but wonder what other critical software is done in a similar manner?

[Boeing's 737 Max Software Outsourced to $9-an-Hour Engineers](https://www.bloomberg.com/news/articles/2019-06-28/boeing-s-737-max-software-outsourced-to-9-an-hour-engineers)
Why it’s absolutely better doing web development on Linux
Tags: webdev
Published: 2019-06-29 11:16:46

---
title: Why it’s absolutely better doing web development on Linux
published: true
tags: Web Development,web development
canonical_url: https://kevinhq.com/here-are-why-its-better-doing-web-development-on-linux/
cover_image: https://cdn.shortpixel.ai/client/to_webp,q_glossy,ret_img,w_930,h_512/https://kevinhq.com/wp-content/uploads/2019/06/Web-development-on-Linux-930x512.png
---

I start my journey into web development world using Windows and the popular XAMPP at the time. Years ago, as a beginner, I wonder why, why they do web development on Linux? Even my first job as a developer, when I got the laptop from the company, that’s running on Ubuntu 10.04.

[Read More »Why it’s absolutely better-doing web development on Linux](https://kevinhq.com/here-are-why-its-better-doing-web-development-on-linux/)
Umbraco 7 Set dynamic body class in body tag
Tags: umbraco, csharp, mvc
Published: 2019-07-02 11:35:12

---
title: Umbraco 7 Set dynamic body class in body tag
published: true
tags: #umbraco #csharp #mvc
canonical_url: https://theworldwidecode.com/blog/2019/umbraco-7-set-dynamic-body-class-in-body-tag/
---

Umbraco 7 Set dynamic body class in the body tag
some idea for an open source project
Tags: discuss, php, laravel, opensource
Published: 2019-06-29 10:08:17

---
title: some idea for an open source project
published: true
description: I was just wondering if someone has any cool idea to work on.
tags: discuss, PHP, laravel, open source
---

Hey All,

I was just wondering if someone wants to share any opensource idea to work on. I was more than willing to initiate some open source contribution to society. Please feel free to share in comments.

samgan