teleren/devto huggingface dataset:
A tiny python log decorator
Tags: python, log, decorator, functools
Published: 2018-12-04 22:41:31

---
title: A tiny python log decorator
published: true
description: A tiny python log decorator 
tags: python, log, decorator, functools
---

This post is only a compilation from others posts that i read for create a log decorator.

Firstly, we need to configure a log properly, an good example can be found [here](https://docs.python.org/3/howto/logging.html)

```python
import logging
logger = logging.getLogger('decorator-log')
logger.setLevel(logging.DEBUG)

# create console handler and set level to debug
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)

# create formatter
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')

# add formatter to ch
ch.setFormatter(formatter)

# add ch to logger
logger.addHandler(ch)
```

Once log instance is configured, we create decorator using it.

```python

import functools
class LogDecorator(object):
    def __init__(self):
        self.logger = logging.getLogger('decorator-log')

    def __call__(self, fn):
        @functools.wraps(fn)
        def decorated(*args, **kwargs):
            try:
                self.logger.debug("{0} - {1} - {2}".format(fn.__name__, args, kwargs))
                result = fn(*args, **kwargs)
                self.logger.debug(result)
                return result
            except Exception as ex:
                self.logger.debug("Exception {0}".format(ex))
                raise ex
            return result
        return decorated
```
It's almost done, we need to decorate some functions to test it:

```python
## Start example
@LogDecorator()
def func(a, b, c):
    return a + b + c

@LogDecorator()
def crash(a,b):
    raise ValueError(str(a))

func(1,2,3)

try:
    crash(1,3)
except:
    pass
```
Our output will be:
```
2018-12-04 23:37:44,110 - decorator-log - DEBUG - func - (1, 2, 3) - {}
2018-12-04 23:37:44,110 - decorator-log - DEBUG - 6
2018-12-04 23:37:44,110 - decorator-log - DEBUG - crash - (1, 3) - {}
2018-12-04 23:37:44,110 - decorator-log - DEBUG - Exception 1
```
Tech Speak: Terminal Command Aliases
Tags: beginners, terminal
Published: 2018-12-04 22:35:31

---
cover_image: https://thepracticaldev.s3.amazonaws.com/i/vt9xsxum2ajge6r1lxdl.jpg
title: Tech Speak: Terminal Command Aliases
published: true
description: A quick overview of setting up command line aliases
tags: #beginners #terminal
<meta prefix="og: http://ogp.me/ns#" property="og:image" content="{link to image address}" />
---
Do you ever get tired of typing ../ to go up a level in your folder structure when navigating via the terminal? How about mkdir? Or even clear? If using the terminal for navigating your file structure is supposed to be quick and easy why not make it even easier by aliasing certain commands so that you use less key strokes and use more memorable terms to achieve the same result. 

To do this you will want to make sure that you set the aliases on a permanent basis otherwise each time you open a new terminal window you will have to set the aliases again. To set the alias permanently, you will need to create a file that the terminal will read each time it is loaded. 

In your terminal type the following commands...

    cd ~

This will take you to your root directory. 

    touch .bash_profile

This will create the file where your aliases are stored and will be read by your terminal each time it is loaded. 

    open -e .bash_profile

This command will open the new file in your default text editor. 

Now that we have the file open in your text editor we can start setting our aliases. In the text file you will create an alias by typing <em>alias</em> followed by the shortcut you want followed by the equal sign and finished up by the actual terminal command. 

    alias create=mkdir
    alias clr=clear
    alias .=../

Once you have your aliases, save the file and close it. Reload your terminal and test out your aliases. 

And that is how you can alias all of your most used commands to make navigating via the terminal easier. 

Until next time :)
What software development skills only come with experience?
Tags: discuss, career, productivity
Published: 2018-12-04 21:59:29

---
title: What software development skills only come with experience? 
published: true
description: 
tags: discuss, career, productivity
---

Some fresh-out-of-school grads are _really good_. Sometimes newer programmers have completely skipped over the hangups more experienced developers have gathered.

I'm often amazed at the skills of newbies.

But there are certain skills that literally can only be learned with experience. Let's talk about those.
A month of Flutter: continuous linting
Tags: flutter, testing, linting, tutorial
Published: 2018-12-04 21:48:57

_Originally published on [bendyworks.com](https://bendyworks.com/blog/a-month-of-flutter-continuous-linting)._

Yesterday I [configured CI](https://bendyworks.com/blog/a-month-of-flutter-configuring-continuous-integration). Today, in step with [@tpolansk's advice](https://twitter.com/tpolansk/status/1013320378939305984), lets set up [linting](https://flutter.io/docs/testing/debugging#the-dart-analyzer). For this project we'll start with the analysis options that the Flutter team uses. To download the file I'll run the following command within the root directory of the repository.

~~~bash
$ wget https://raw.githubusercontent.com/flutter/flutter/master/analysis_options.yaml
~~~

The `analysis_options.yaml` file tells the `dartanalyzer` tool the preferences to use when analyzing the codebase. You can now run `flutter analyze` to see everything in the app that can be improved. Your editor should use this file to show you inline feedback as well.

~~~bash
$ flutter analyze
Analyzing app...

   info • Prefer declare const constructors on `@immutable` classes • lib/main.dart:29:3 • prefer_const_constructors_in_immutables
   info • Prefer const with constant constructors • lib/main.dart:94:13 • prefer_const_constructors
   info • Prefer const with constant constructors • lib/main.dart:107:16 • prefer_const_constructors

3 issues found. (ran in 0.8s)
~~~

Linting is one of the tooling options you want to get into a project as soon as possible so you don't run into issues like @hillelcoren did.

> A bit depressing seeing the number of warnings go from 2 to 2,000 but better now than later...
>
> [@hillelcoren](https://twitter.com/hillelcoren/status/1013337198295441409)

But having linting set up in your app doesn't mean developers will run or follow the recommended patterns. So let's enforce it with the [CI we set up yesterday](https://bendyworks.com/blog/a-month-of-flutter-configuring-continuous-integration).

Add the following to `.travis.yml`:

~~~yaml
matrix:
  include:
  - name: Test
    env: COMMAND=test
  - name: Analyze
    env: COMMAND=analyze
~~~

And modify the `script` line to use `$COMMAND` instead of `test` like this:

~~~yaml
script:
  - ./flutter/bin/flutter $COMMAND
~~~

The [`matrix` option](https://docs.travis-ci.com/user/customizing-the-build#build-matrix) on Travis CI is very powerful. It lets you set up multiple test runs that will perform in parallel.

Now we need to make the suggested improvements. In this case it's as simple as adding a couple of `const`s where the analyzer says. Using `const` lets the Dart compiler [better optimize your code](https://stackoverflow.com/a/47996512/26406) and improve performance.

Come back tomorrow when I'll be doing talking about Flutter's [big announcement](https://developers.googleblog.com/2018/12/flutter-10-googles-portable-ui-toolkit.html).

## Code changes

- [#7 Run flutter analyze on CI](https://github.com/abraham/birb/pull/7)
A beginner's trap
Tags: beginners, coding, webdev, developer
Published: 2018-12-04 21:35:31

---
title: A beginner's trap
published: true
description: The path to follow 
tags: beginner, coding, webdev, developer
cover_image: https://thepracticaldev.s3.amazonaws.com/i/b2mq6sllzzx4oepoggv9.jpg
---

## Hey, Everyone!

So, I've been thinking about getting out here to the open and ask the questions that are in my head.

First off, english is not my native so apologies for any mistakes. :) 

I've started coding 2-3 months ago, went through some courses on **HTML**, **CSS** and now deep in **JavaScript**.

I have all the passion and motivation to code but sometimes I have this feeling when I sit down that I am going nowhere with the information I have.

I'm doing some **udemy** courses, **JavaScript30** and some side tasks.

My question is: is there any better way to improve my knowledge or continue this path?

I don't have unrealistic dreams, hence the reason I would only start looking for any job or freelancing projects in 3-6 months.

Any input, idea, advice is greatly appreciated.

Thanks for reading this post, guys.

P.S.: This community has helped me and keeps helping me staying in the flow. :) 


**P.P.S.:** Under 24 hours you have given me so much support and great ideas that I can't be thankful enough! **YOU GUYS ROCK!** Cheers
TIGL3D DevLog 5+6: Two whole new areas
Tags: gamedev, unity3d, devlog
Published: 2018-12-04 21:16:50

---
title: TIGL3D DevLog 5+6: Two whole new areas
published: true
description: These two updates cover the addition of two new areas.
tags: gamedev, unity, devlog
cover_image: https://thepracticaldev.s3.amazonaws.com/i/nrjsdx5542h96u4qdb5w.gif
---
In these two devlog updates for [The Indie Game Legend 3D](http://indiegamelegend.com/) from February 2018 I build out a whole new forest area of the game, then build tools to build out a new snow area:

{% youtube dOfgS8bgCTQ %}

{% youtube Y41trCTQVbw %}

Early access in 7 days!
New Screencast for Ethereum Dapp Development – EatTheBlocks Newsletter #18
Tags: ethereum, screencast, eattheblocks, dapp
Published: 2018-12-04 20:45:48

---
title: New Screencast for Ethereum Dapp Development – EatTheBlocks Newsletter #18
published: true
description: 
tags: Ethereum, Screencast, EatTheBlocks, Dapp 
---

[![](https://thepracticaldev.s3.amazonaws.com/i/a44d0a94czz483bdshrd.png)](https://youtu.be/i_GHI7nN-t0)

New Screencast for Ethereum Dapps & Smart Contracts, Hashed Time-Locked Contract Standard...

* [Video](https://youtu.be/i_GHI7nN-t0)
* [Post](https://eattheblocks.com/eattheblocks-newsletter-18-new-screencast-for-ethereum-dapps-smart-contracts-htlc-contract-standard)

Every week I send the 10 most interesting tutorials, tips & news for Ethereum Dapp developers: Solidity, Truffle, Web3, Ethereum protocol & Token standards. Sign up to the newsletter on https://eattheblocks.com and never miss an episode!
Computer Science (Undergrad) Research
Tags: discuss, computerscience
Published: 2018-12-04 20:03:38

Hello all,

Just curious about what the folks on this site think. I am currently finishing an undergrad degree for comp sci. I am interested in going to grad school and some of the programs I've looked into ask, and encourage, research as an undergrad. I'm doing school online so really connecting with a professor is a bit hard. Since most of the communication with my professor's is by email to, on the rare occasion, tell them I might be late getting in an assignment. 

Anyway, I have been contacting every one of my CS professors asking if they are conducting research I can assist with. So far none of them seem to be. They're all adjunct professors so maybe my school is a side hustle. 

Here is my question: Has anyone here had any experience doing computer science research? If I wanted to try and publish my own research, could I even do that? If so, how would I start? I'm just curious what the amazing community here thinks about it.
Must-See Talks from AngularConnect 2018
Tags: angular, javascript, angularconnect, frontend
Published: 2018-12-04 20:02:12

---
title: Must-See Talks from AngularConnect 2018
published: true
description: Auth0's Sam Julien had the opportunity to speak at AngularConnect 2018 in London.
tags: #angular #javascript #angularconnect #frontend
canonical_url: https://auth0.com/blog/must-see-talks-from-angularconnect-2018/
---

In this post, we take a look at a few of the can't-miss talks from AngularConnect 2018, covering topics like Ivy, Bazel, and why you might not need NgRx after all.

[Read on 🅰️](https://auth0.com/blog/must-see-talks-from-angularconnect-2018/?utm_source=dev&utm_medium=sc&utm_campaign=angularconnect_recap)

![Must-See Talks from AngularConnect 2018](https://thepracticaldev.s3.amazonaws.com/i/iz7axgcl7ah7x6oi9g7y.png)
Adding validation support for Json in Django Models
Tags: python, django, json, djangorestframework
Published: 2018-12-04 19:25:00

---
title: Adding validation support for Json in Django Models
published: true
description: Here's a quick way to add model level validation to your `JsonField` attributes in Django.
tags: Python, Django, json, DjangoRestFramework
---
![JSON image](https://cdn-images-1.medium.com/max/2000/1*4oKgO2xgHkBPATskGSMYig.jpeg "Some random JSON")

The contents of this post have now been moved to my blog and can be viewed [here](https://www.articulatepython.com/blog/adding-validation-support-for-json-in-django-models)
A short list of Data Science resources #5
Tags: python, datascience
Published: 2018-12-04 18:59:49

---
title: A short list of Data Science resources #5
published: true
description: 
tags: #python #datascience
---
Also this week I decided to gather some interesting resources, related to data science and Python, that I found in the last days. I hope that can be useful for someone else.

-"The 100 pages machine learning book", by Andriy Burkov, as the name itself says, collapses the basis of machine learning in just one hundred pages
http://themlbook.com/wiki/doku.php
- Neuron is a Visual Studio Code extension that aims to bring the visualization abilities of Jupyter Notebooks to VS Code that https://blogs.msdn.microsoft.com/uk_faculty_connection/2018/10/29/data-science-in-visual-studio-code-using-neuron-a-new-vs-code-extension/
- A nice intro on how to handle json data in Python https://realpython.com/python-json/
- Implement a basic neural network with Python to grasp better the theory behind https://towardsdatascience.com/how-to-build-your-own-neural-network-from-scratch-in-python-68998a08e4f6
- Three hint to build better data science presentations https://towardsdatascience.com/effective-data-science-presentations-caab621abc66

If you have any feedback or cool resources, please share them in the comments!
Don't Think Technology orientated - Think Solution orientated
Tags: technology, solution, junior, opensource
Published: 2018-12-04 18:35:50

---
title: Don't Think Technology orientated - Think Solution orientated
published: true
description: A Solution orientation thought process will bring your further as a (Junior) developer and expand your skillset
tags: Technology, Solution, Junior, Open Source
---

[Fist published on my homepage](https://lasseschultebraucks.com/life/work/2018/12/04/dont-think-technology-orientated-think-solution-orientated.html)

A problem I always had and I think every developer has is that the amount of diverse and interesting technologies out there is huge. It is BIG and you could literally jump from one to the other every day.

Yesterday I had a very interesting conversation with a senior developer. We talked about different things among others about technologies and the rapid change of technologies. I told him that I always have problems to keep on one project and I just jump after a couple of weeks after I have played and get started with a new technology like a framework or a new programming language and then jumped to another one. He responded that this is probably the wrong way and I should act more solution orientated rather than technology orientated.

What did he mean by that? Is it wrong to learn different technologies and different programming languages?

Of course not. But it is probably wrong to live technology driven instead of solution driven. I mean it is super nice to always keep up with technology and stay on the hype train, but once this is super hard and you will never become an expert in anything by that. The senior developer I talked to called himself a Full Stack, but not because he always keep up with the latest and different JavaScript frameworks. He applies new technologies to problems the want to solve and therefore builds real solutions instead of just playing with new technology.

Next he also suggested me to contribute on Open Source project if I have no idea for a own project. There a multiple reasons why you should contribute to Open Source software as a developer and I don’t want to go into detail here rather I want to point out some points. With your specific expertise you can make huge impacts, even it is a trivial and simple task for you. And you don’t also give your work to others you will learn a lot by contributing to Open Source.

All in all the conversation made two points clear for me: First think solution orientated rather than technology orientated. It will bring your skill set further even if you want to be a Full Stack developer. Next contributing to Open Source can be very important for you as a Junior Developer. It is basically a win win win situation. You will learn something new, you will create real value and your will create attention to potential employers.

This post should remind me about the points that got clear for me after the conversation. I hope this will help also other young developers who want to learn and grow.
Introducing our December 2018 sponsors
Tags: meta
Published: 2018-12-04 17:59:40

---
title: Introducing our December 2018 sponsors
published: true
description: Our wonderful sponsors are vital to the health of dev.to and it is great to work with companies contributing so much to the ecosystem.
tags: meta
cover_image: https://thepracticaldev.s3.amazonaws.com/i/9q6gamd74rxm9cfjt3xr.png
---

As we round out a wonderful year at [dev.to](https://dev.to), we want to give our final monthly sponsor thank you of 2018.

These three of these organizations have been multi-month sponsors. Their ongoing commitment to the community has been amazing and their commitment to great developer tooling just as much.

Please take a few minutes to check out their offerings and consider them for your company or next project.


## DigitalOcean

[DigitalOcean](https://try.digitalocean.com/performance/?utm_source=devto&utm_medium=display&utm_campaign=Devto_2018_Brand) is a much-loved cloud computing platform. I'm always impressed by how well-built _and well-documented_ the DigitalOcean core products are. It's easier said than done, and they've been able to stay ahead of the curve.

DigitalOcean has been our longest-running supporter to date, and we're extremely thankful for their consistent support.  Their commitment to the developer ecosystem is crystal clear.

## Twilio

[Twilio](https://www.twilio.com/?utm_source=devto&utm_medium=banner&utm_campaign=summer_awareness_campaign) has been a great friend of ours since early in the [dev.to](/) days. We are users of their APIs, and folks from our team are always excited to get involved in their community initiatives. It's great to have them as a sponsor!

I can personally say that we chose Twilio Video because it made really great use of native peer-to-peer browser technology while also offering Twilio's infrastructure for necessary use cases wrapped in the same API. The docs and examples were well-organized and getting up and running was a synch.

## Raygun

[Raygun](https://raygun.com/?utm_source=dev.to) is an error, crash, and monitoring software service. Their products center around real usability, including frontend performance issues that we are often blind to in our web observability practices.

Consistency and ease of service is critical in this domain, and Raygun has earned a great reputation. Definitely check them out if you are looking to improve your monitoring.



***

These organizations are helping us build the best community we can. I urge you to check out their offerings if you are in the market for their services.

Happy coding ❤️
Working with react dangerouslySetInnerHTML attribute
Tags: javascript, es6, react
Published: 2018-12-04 17:57:12

---
title: Working with react dangerouslySetInnerHTML attribute
published: true
description: Working with react dangerouslySetInnerHTML attribute
tags: #javascript #js #es6 #react
---

Post Link : <a href="https://www.skptricks.com/2018/12/working-with-react-dangerouslysetinnerhtml-attribute.html" >Working with react dangerouslySetInnerHTML attribute </a>

This tutorial explains how to use react dangerouslySetInnerHTML attribute inside react application component. dangerouslySetInnerHTML is React’s replacement for using innerHTML in the browser DOM. In general, setting HTML from code is risky because it’s easy to inadvertently expose your users to a cross-site scripting (XSS) attack. So, you can set HTML directly from React, but you have to type out dangerouslySetInnerHTML and pass an object with a __html key, to remind yourself that it’s dangerous.

 NOTE :Improper use of the innerHTML can open you up to a cross-site scripting (XSS) attack. Sanitizing user input for display is notoriously error-prone, and failure to properly sanitize is one of the leading causes of web vulnerabilities on the internet.

<a href="https://www.skptricks.com/2018/12/working-with-react-dangerouslysetinnerhtml-attribute.html" >Working with react dangerouslySetInnerHTML attribute </a>

<img src="https://1.bp.blogspot.com/-WIq-Rz2iXsw/XAS8h5qQhlI/AAAAAAAACNQ/Y8YCzIXG-yMLC3gi78j4WMEkf63nFdIYwCLcBGAs/s400/danger.png" />
JavaScript timers With Examples
Tags: react, javascript, es6
Published: 2018-12-04 17:54:36

---
title: JavaScript timers With Examples
published: true
description: JavaScript timers With Examples
tags: #react #js #es6 #javascript
---

Post Link : <a href="https://www.skptricks.com/2018/12/javascript-timers-with-examples.html" > JavaScript timers With Examples</a>

This tutorial explains how to use javaScript timers function. JavaScript features a handy couple of methods of the window object: setTimeout() and setInterval(). These let you run a piece of JavaScript code at some point in the future. If we want to delay the execution of  Javascript code, then we need to use the time interval functions. These time intervals are called timing events. The block of JavaScript code is executed synchronously. But there are some JavaScript native functions (timers) which allow us to delay the execution and we can create an async kind of behavior.

Lets see the different type of timer function in javascript :
setTimeout allows to run a function once after the interval of time.
setInterval allows to run a function regularly with the interval between the runs.
clearTimeout will stop the current running timer function.

<a href="https://www.skptricks.com/2018/12/javascript-timers-with-examples.html" > JavaScript timers With Examples</a>

<img src="https://4.bp.blogspot.com/-f-qK1wkIZvw/XAPKGv9PsXI/AAAAAAAACNE/KNc9nTMMZLY4OYHzmlN_p9w0zWKCVRIRwCLcBGAs/s640/timer.png" />
Understanding slice( ), splice( ), & split( ) methods in JavaScript
Tags: javascript, es6, react
Published: 2018-12-04 17:52:51

---
title: Understanding slice( ), splice( ), & split( ) methods in JavaScript
published: true
description: Understanding slice( ), splice( ), & split( ) methods in JavaScript
tags: #javascript #es6 #js #react
---

Post Link : <a href="https://www.skptricks.com/2018/12/understanding-slice-splice-split-in-javascript.html" >Understanding slice( ), splice( ), & split( ) methods in JavaScript </a>

In this tutorial, we are going to learn slice( ), splice( ), & split( ) methods in JavaScript with examples. This methods are mostly used in react and react native application development, so i though to share my knowledge and some real time examples :

 Point to remember : 
Slice( ) and splice( ) methods are used for arrays.
Split( ) method is used for strings.

<a href="https://www.skptricks.com/2018/12/understanding-slice-splice-split-in-javascript.html" >Understanding slice( ), splice( ), & split( ) methods in JavaScript </a>


<img src="https://3.bp.blogspot.com/-I-7m9rmehWw/XAOJXJ_iAaI/AAAAAAAACMc/892IjrKoYyQFCZDanjYj0m79p0zej7eQQCLcBGAs/s640/split.png" />