teleren/devto huggingface dataset:
Logging in AngularJS 1.x
Tags: angularjs1x
Published: 2018-02-20 17:08:05

---
title: Logging in AngularJS 1.x
published: true
description: 
tags: angularjs1.x
---

`console.log` can be easily oversighted and left in places before the code goes to production. Of course, in production, the console should be as clean as possible. But occasionally, it would be nice to temporary turn them on for a quick troubleshooting.

AngularJS already has a service called [`$log`](https://docs.angularjs.org/api/ng/service/$log) but its problem is that it does not show the correct file and line number.


![AngularJS $log](https://thepracticaldev.s3.amazonaws.com/i/dqpn8s67we7go10lgfif.png)


So here's a quick solution I came up with. Let's call this service `loggingService`. It contains a way that indicates whether logging is enabled or not. Because the service has to remember this even after users refresh the browsers, this cannot be a simple flag. Rather it has to be persisted to the `local storage`. Here's how the service implemented:


```javascript
(function () {
  'use strict';
  angular.module('myapp').
    factory('loggingService', ['$window',
      function ($window) {
        const storage = $window.localStorage;
        const debug = {
          debug: $window.console.debug.bind($window.console, 'debug: %s'),
          log: $window.console.log.bind($window.console, 'log: %s'),          
          info: $window.console.info.bind($window.console, 'info: %s'),
          warn: $window.console.warn.bind($window.console, 'warn: %s'),
          error: $window.console.error.bind($window.console, 'error: %s'),
        };        
        const noOp = {
          debug(){},
          log(){},
          info(){},          
          warn(){},
          error(){},          
        };
        return {
          setEnable(enabled) {            
            storage.setItem('enable_logging', enabled);
          },
          console() {
            return storage.getItem('enable_logging') === 'true' ? debug : noOp;
          },
          getEnable() {
            return storage.getItem('enable_logging') === 'true' ? true : false;
          },
        }
       }
      },
  ]);
})();
```

Then in other Angular services and controllers, I just have to inject this `loggingService` and wherever `console.log` is called, I just have to replace with `loggingService.console().log` or `loggingService.console().info` or `loggingService.console().warn` or other methods. It works just before with the correct file and line number. But even better than before, in the Developer Tools console, I can now also filter these messages. 

![Developer Tools filter](https://thepracticaldev.s3.amazonaws.com/i/dswsd1cb3h0sjrpvls7q.png)
Developing Web Apps with ASP.NET Core 2.0 and React - Part 2
Tags: react, aspnet, javascript, aspnetcore
Published: 2018-02-20 16:54:20

---
title: Developing Web Apps with ASP.NET Core 2.0 and React - Part 2
published: true
description: A practical tutorial showing how to setup and develop a modern Web application based on ASP.NET Core 2.0 and React.
tags: #reactjs #aspnet #javascript #aspnetcore
canonical_url: https://auth0.com/blog/developing-web-apps-with-asp-dot-net-core-2-dot-0-and-react-part-2/
---

This is the second part of the series about developing a Web application based on ASP.NET Core 2.0 and React. [In the previous post](https://auth0.com/blog/developing-web-apps-with-asp-dot-net-core-2-dot-0-and-react-part-1?utm_source=dev&utm_medium=sc&utm_campaign=aspnet2_reactjs), you built a secured Web API application that provides a list of books with ASP.NET Core 2.0. In this post, you will create a Single Page Application (SPA) client based on React to consume this API.

[Read on 💻](https://auth0.com/blog/developing-web-apps-with-asp-dot-net-core-2-dot-0-and-react-part-2/?utm_source=dev&utm_medium=sc&utm_campaign=aspnet2_reactjs)

![Developing Web Apps with ASP.NET Core 2.0 and React - Part 2](https://thepracticaldev.s3.amazonaws.com/i/ig8n4pch0uvscyf2ve6t.png)
splinterteal is launching new campaign
Published: 2018-02-20 11:45:50

---
title: splinterteal is launching new campaign
published: true
description: 
tags: 
---

---

splinterteal is launching new campaign targeted at aspiring web devs and designers alike

you can sign up at https://www.splinterteal.co.uk/contact

stay tuned for more 

peace

tags: web design, website, new website
---
Fun ways to learn a new programming language
Tags: discuss
Published: 2018-02-20 11:43:35

---
title: Fun ways to learn a new programming language
published: true
tags: discuss
---

Hey people!

There were a few discussions lately about what programming language one should learn, what's the best one for a particular use case, etc...

I'm starting to learn Go, and I want to move away from the: 'read the official docs and make a Todo app' thing. So, I was wondering if you learned a language using a different approach. So far, I came up with these:

- Read the official docs and tutorial

The most classic one. We've all been there. Not always fun, but most of the time, a solid choice.

- Open source

I've read a few articles recommending this. Just pick a open source project, start reading the code, pick an issue, and learn from there. Sounds fun, engaging, but quite complicated for newcomers.

- Games

Well, I started like that with Go. Solving puzzles and code katas is what I choose to do so far to learn this language. I have a Go documentation on the side to check if my syntax is correct. I'm not bothering about tools or compiling or anything else, just the code and the puzzles. Fun so far.


Any other fun and unconventional ways you learned a new language, or tool?
What is the architecture stack for dev.to?
Tags: technology, architecture, devops
Published: 2018-02-20 10:01:46

---
title: "What is the architecture stack for dev.to?"
published: true
description: I would like to know the architecture stack or the tweaks behind making this site so blazingly fast. It just amazes and makes surfing so smooth and fast.
tags: technology, architecture, devops
---

I would like to know the architecture stack or the tweaks behind making this site so blazingly fast. It just amazes and makes surfing so smooth and fast.
Do you code `if (foo == true) ` in Java?
Tags: discuss, java, programming
Published: 2018-02-20 09:23:31

---
title: Do you code `if (foo == true) ` in Java?
published: true
tags: discuss, Java, Programming
---

There posted the discussion that "Do you code `if (foo == true)` in Java?" on Qiita, Japanese tech blog. 

[https://qiita.com/ikemo/items/4f56a283f9e27cf98d81](https://qiita.com/ikemo/items/4f56a283f9e27cf98d81)

The auther argues that it's "No" because its verbose (`if (foo)` is enough), it may cause typo that `if (foo = true)` and it would increase the number of steps and run slower.

So, the code should be like this.

```java

if (foo) {
    // do something
}

boolean isBuzz = !obj.getFoo().getBar();
if (!isBuzz) {
    // do something
}

```

and not

```java

if (foo == true) {
    // do something
}

if (obj.getFoo().getBar() == false) {
    // do something
}
```

However, there posted many counter arguments that `!` operator can be easily overlooked, ` == true` is easy to understand, both ways are acceptable, etc.

Basically, I'm for the author's opinion. ` == true` doesn't provide any advantage for readability and simply `if (isSuccessful())` is comfortable to pronounce.

How do you think of this?

Thanks.
How to Add Custom Fields to Magento 2 Contact Page
Tags: webdev, beginners, php
Published: 2018-02-20 07:36:56

---
title: How to Add Custom Fields to Magento 2 Contact Page
published: true
description: 
tags: #webdev #beginners #php
---

Firstly create a module

create module.xml in app/code/Magenticians/Modulecontact/etc and put the code:

```
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magenticians_Modulecontact" setup_version="1.0.1">
</module>
</config>
```

For module registration, create registration.php in app/code/Magenticians/Modulecontact and put the code:
```
<?php
 
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Magenticians_Modulecontact',
__DIR__
);
```


Now override and add new field in Magento 2 contact form.

Copy form.phtml file from the vendor/magento/module-contact/view/frontend/templates and paste in app/code/Magenticians/Modulecontact/view/frontend/templates.
To add a new field to the contact form, open form.phtml file and add the following code:
```
<div class="field subject required">
             <label class="label" for="subject"><span><?php /* @escapeNotVerified */ echo __('Subject') ?></span></label>
             <div class="control">
                  <input name="subject" id="subject" title="<?php /* @escapeNotVerified */ echo __('Subject') ?>" value="" class="input-text" type="text" data-validate="{required:true}"/>
             </div>
        </div>
```

Complete Guide: https://magenticians.com/add-custom-field-in-magento-2-contact-page/
Front end challenges to become a better developer - codecorgi    
Tags: codechallenges, opensource, showdev
Published: 2018-02-20 03:33:29

---
title: Front end challenges to become a better developer - codecorgi    
published: true
description: codecorgi is an an open source platform to practice coding with non trivial codebases on your own terms, for front-end developers.
tags: code challenges, opensource, showdev
---

Hi! I finally put this in a state where is not super embarrassing to share, codecorgi is an idea I've had for over a year, where we present users with challenges that are non trivial codebases, no tutorials, no hand holding, just code and feature requests. Just like a regular job. 

Fork and clone the repos, run it locally, add the features or fixes needed, push to your github and submit your version to codecorgi so that other community members can give you feedback, like a code review at work. There are 7 challenges now, that go from super simple HTML and CSS to fetching data for a React application, and I plan to add new challenges every week or so, depending on time. 

There's also a profile page you can add your projects to http://codecorgi.co/profile/dvidsilva and showcase your skills, is still a bit rough, but as everything, It'll keep improving.

Also, this time around, all the code is open-source, https://github.com/corgicode/api https://github.com/corgicode/frontend-react if you'd like to checkout a codebase and see the progress of the application; and if you're looking for some projects to contribute I'd be happy to walk you through it and have some pairing sessions. Our roadmap is also open, you can see it on waffle, https://waffle.io/corgicode/frontend-react https://waffle.io/corgicode/api 


Feedback is welcome! looking forward to seeing your submissions. You can email me at david@codecorgi.co if you want to talk personally to me.



- David
Where to Learn Nodejs ?
Tags: node, discuss
Published: 2018-02-19 23:35:13

---
title: Where to Learn Nodejs ?
published: true
description: 
tags: nodejs, discuss
---


I am looking for good sources to learn nodejs.
I have already found a lot of things on youtube, udemy and so on, 
but I would like to know from the people who is already programing with that language.

Where did you learn and which topic should I pay more attention on?
External dependencies which read and act on environment variables?
Tags: discuss
Published: 2018-02-19 22:56:12

---
title: External dependencies which read and act on environment variables?
published: true
description: 
tags: discuss
---

We recently had an issue where a Ruby gem that was part of our project was taking action based on the value of an environment variable. This behavior was not mentioned anywhere in the documentation and completely tripped us up.

The behavior difference was subtle and totally silent.


At best the library was expecting us to follow an implied convention they were dictating, at worst it was a disaster waiting to happen.

Or is this a failure to exercise our code extensively enough and modify environment variables with more care? How would you guard against this sort of issue?
THE most exciting web tech war EVER
Tags: discuss
Published: 2018-02-19 18:44:56

---
title: THE most exciting web tech war EVER
published: true
description: 
tags: discuss
---

Ever been to some YouTube video page where you just wanted to like go through comment section and see people fighting over stupid things?

Well, this <a href="https://adambard.com/blog/you-write-php-because-you-dont-know-better/">blog post</a>, though posted over 4 years ago, has one of the the most amazing tech wars going on in its comment section (which, unlike the post, is updated).

<b>Title</b>: <i>You use PHP because you don't know better</i>
<b>Author</b>: <i>Adam Bard</i>
<small><a href="https://adambard.com/blog/you-write-php-because-you-dont-know-better/">Link to the blog</a></small>
Who is hiring? (February 2018) 
Tags: whoishiring
Published: 2018-02-19 18:14:37

---
title: Who is hiring? (February 2018) 
published: true
description: Members of the dev.to community sharing open job opportunities at their companies.
tags: whoishiring
---

We're going to start hosting a monthly thread where community members can share openings at their companies.

Here a few ground rules:
- Please only post if you are personally part of the hiring company (**no recruiting firms**)
- Please provide brief background on what your company does
- Only one post per company (you can list multiple openings in the post)

Consider using this template:

---

>Company Name | Job Title | Location | Remote or Onsite | (optional) Salary Range
>
>**About the company** — background, size, etc (1-3 sentences)
>
>**About the role(s)** — languages, requirements, etc (1-3 sentences)
>
>**How to Apply** — email or application link

--- 

We also wanted to share some quick careers-related notes from our fantastic Sustaining Sponsors.

### Triplebyte:
> **Triplebyte** now hires software engineers for top tech companies and hundreds of the most exciting startups like **Apple, Dropbox, Mixpanel, and Instacart**. They identify your strengths from an online coding quiz and let you skip resume and recruiter screens at multiple companies at once. It's free, confidential, and background-blind. [Apply here](https://triplebyte.com/?ref=devto_feb18_c2).

### Algolia:
> The **Algolia** engineering team is growing as we’re working on several new projects in 2018. Web, Mobile, Infrastructure, Analytics… Have a look at our [career page](https://www.algolia.com/careers) to see the open positions!

### Nylas:
> **Nylas** is building the future of business communications with our email, calendar, and contact sync API. We are dedicated to providing the best possible work environment for our team, and we value kindness, honesty, transparency, individual empowerment, and communication. We have [a lot of technical job openings](http://bit.ly/2npL4h0) right now and would love to chat if you're interested in learning more!
Poll: How old were you when you started to learn programming?
Tags: poll, programming, discuss, beginners
Published: 2018-02-19 17:42:20

---
title: "Poll: How old were you when you started to learn programming?"
published: true
description: 
tags: poll, programming, discuss, beginners
---

I would like to know when you first started to learn programming, how old you were, and what your first programming language was.

Please [take a short survey](https://goo.gl/forms/luQcUNHb1CjOP93i2) via Google Forms. I will post the stats overlaying the three data points when responses are closed.

You can share the link above or retweet:

{% twitter 965634828702896128 %}

This is a variation of the poll that [Sara Chipps](https://twitter.com/SaraJChipps) created:

{% twitter 965353170489761793 %}

After our exchanges:

{% twitter 965433184744652800 %}
Fight for the Architecture
Tags: architecture, career, team
Published: 2018-02-19 17:39:13

---
title: Fight for the Architecture
published: true
description: Developers are stakeholders too. Here's why you should fight for what you believe is right for the company
tags: architecture, career, team
canonical_url: https://www.yellowbrickcode.co.uk/fight-for-the-architecture/
cover_image: https://thepracticaldev.s3.amazonaws.com/i/yupyye15pfzfkxv5vt93.jpg
---

I’m currently reading [Clean Architecture by Uncle Bob](https://www.amazon.co.uk/Clean-Architecture-Craftsmans-Software-Structure/dp/0134494164). I’m still pretty early on in the book, but I just read a section that made me need to put it down and write this post!

## Developers are stakeholders too
In a section titled ‘Fight For The Architecture’, Bob talks about the ongoing struggle of fighting for what you as a developer and/or architect believe is right for the company. Just as the management team, marketing team etc also do. The part of this section that really stood out to me was this:

> [Effective software development teams] unabashedly squabble with all the other stakeholders as equals. Remember, as a software developer, *you are a stakeholder*. You have a stake in the software that you need to safeguard. That’s part of your role, and part of your duty. And it’s a big part of why you were hired.

This, so much this! I think this is something you don’t tend to recognise early in your career, at least I know I didn’t. I also think that if the company doesn’t recognise their development team as a stakeholder, it’s a steady slope to a product that will eventually fail. Without time spent on the architecture, you’ll end up with a product that’s more and more difficult to add to and maintain. You’ll have to add more people to the team, but your output won’t increase because the code base is harder to work in every day. Every line of code gradually gets more expensive to write, but your output will no longer match your investment. Eventually it’s going to need to be rewritten or abandoned. 

So for the developers reading this, remember, a software development team is definitely a stakeholder in the product they are developing. Sometimes we have to stand up for something for the good of the product and help make the other stakeholders understand why it’s important. We are in these positions because we understand the technical implications and because we’re good at what we do. If you sit back and let things go, you’re going to end up working in a mess of code that’s definitely not fun to work on and is challenging for all the wrong reasons!

<sup>Cover photo by sydney Rae on Unsplash</sup>

_[This was originally posted on my blog in January 2018](https://www.yellowbrickcode.co.uk/fight-for-the-architecture/)_
Say "hello world" your own way.
Tags: beginners, programming
Published: 2018-02-19 17:33:04

---
title: Say \"hello world\" your own way.
published: true
description: 
tags: beginners, programming
cover_image: https://thepracticaldev.s3.amazonaws.com/i/thu7pp50sk18gru2s5rw.png
---

When you're learning a new language, you start with, "hello world".

It's tradition, just a thing that you do - though most of us don't actually knuckle down and type it in. Instead, we skim that chapter and get on to the good stuff.

I have my own "hello world" program that I like to write in every new language I learn. It's simple enough to be simple and hard enough to mean I have to read a couple more chapters than I probably expected. Because it's personal to me, I can't cheat by writing something more along the lines of the tutorials I find online. Because it's the same thing every time, it means that if I only manage to sort-of finish it, I obviously haven't learned enough and I feel sad.

I encourage everyone to do this. You feel you're getting somewhere with the new language rather than wallowing in theory, and you find out that what took 50 lines in your favourite language up until now takes 10 in this new hipster script you're looking at. Maybe it's worth investing more time?

Mine's something that takes a word and works out how to write it using only the symbols available in the periodic table. It usually means a list type and some recursion.

You can choose your own. If you do, let me know :)

Cover image by [Pascal Bernardon](https://unsplash.com/@pbernardon) from [Unsplash](https://unsplash.com)
New Guy
Tags: welcome, programming, technology
Published: 2018-02-19 15:16:59

---
title: New Guy
published: true
description: Something about me
tags: welcome, programming, technology
---

Hi There.
Call me Zeus. I am new to programming. I want to learn web development, mobile and desktop apps, and software dev.I have started learning web dev at freecodecamp.org, still dealing with html and css.
I hope to learn from everyone here.
The 7 Most Popular DEV Posts from the Past Week
Tags: top7
Published: 2018-02-19 14:37:57

---
title: The 7 Most Popular DEV Posts from the Past Week
published: true
description: A round up of the most-read and most-loved contributions from the community this past week.
tags: icymi
cover_image: https://thepracticaldev.s3.amazonaws.com/i/xsr1z6iqv0pd7p3s6ns3.png
---

#1. This career is an absolute marathon

Lots of people feel the pressure to live and breathe code, but Ben explains why he doesn't think that should be the case. 

{% link https://dev.to/ben/its-perfectly-fine-to-only-code-at-work-dont-let-anyone-tell-you-otherwise--25i3 %}

#2. Can you recognize Cyrillic?

A hacker contacted Logan about a potential security vulnerability that led her into the world of homographs. In order to understand homographs, we also learn about ICANN, punycode, and more. 

{% link https://dev.to/loganmeetsworld/homographs-attack--5a1p %}

#3. Ideas, please 💭

A community sourced list of ideas for Raspberry Pi 3s.

{% link https://dev.to/michael/i-just-got-a-raspberry-pi-3-what-can-i-do-with-it--4ne1 %}

#4. Do no harm 🙈

Yos shares some highlights from [The Clean Coder](https://www.amazon.com/Clean-Coder-Conduct-Professional-Programmers/dp/0137081073), a code of conduct for professional programmers. 

{% link https://dev.to/yos/excerpts-from-the-clean-coder--2ddb %}

#5. Do things better

An easy-to-follow and detailed overview of the backdrop of Docker and it's associated technologies.

{% link https://dev.to/drminnaar/docker-guide---part-1--57c8 %}

#6. The Glass, Ice Cream Scoops, Whipped Cream, and Cherries

CSS positioning is usually met with hours of trial and error, often leading to no real understanding of the concept. In this post, Kevin ends our confusion and makes us drool all at the same time 🍦😛 

{% link https://dev.to/kbk0125/css-positioning-explained-by-building-an-ice-cream-sundae--3e86 %}

#7. Get Gaming

K shares four game engines based on JavaScript for those of us who have always dreamed of building games. 

{% link https://dev.to/kayis/gaming-javascript--294 %}

_That's it for our weekly wrap up! Keep an eye on dev.to this week for daily content and discussions...and if you miss anything, we'll be sure to recap it next Monday!_
Sublime 3 Plugin recommondations
Tags: tools, sublime, productivity, discuss
Published: 2018-02-19 12:03:51

---
title: Sublime 3 Plugin recommondations
published: true
description: SublimeText3, subl
tags: Tools,Sublime,productivity,discussion
---

Hey, I wanted to take a deeper look into Sublime Text 3 and I was wondering which Plugins you enjoyed and recommend! Mainly I'll work with PHP and Symfony but feel free to share any other language/ framework specific Plugin with me. Love to hear your opinions.