teleren/devto huggingface dataset:
What do you eat at work?
Tags: health, workplace, discuss
Published: 2017-08-07 11:57:17

---
title: What do you eat at work?
published: true
tags: health, workplace, discuss
---
I've developed a terrible habit of eating fast food almost on a daily basis. The main reason is how convenient it is. I'd like to change this habit and was wondering what other developers usually have for lunch at work?
TrackballLabelTemplate in Syncfusion chart only works with a list
Tags: xamarinforms, syncfusion
Published: 2017-12-24 10:06:38

---
title: "TrackballLabelTemplate in Syncfusion chart only works with a list"
published: true
tags: Xamarin Forms,Syncfusion
canonical_url: https://blog.jonstodle.com/trackballlabeltemplate-in-syncfusion-chart-only-works-with-ilist-t/
---

After spending too many hours trying to figure this one out, I have to write it down to help any unfortunate soul that should come across this undocumented behavior. (Notice how I put all the important keywords in the title?)

While it's most often recommended to supply an `IList<T>` when setting the `ItemsSource` of a collection view in Xamarin.Forms or other XAML platforms, it's not required. You can just as well supply an or `IEnumerable<T>` and things will work fine.

The benefit if passing a list is that the system can do random access of items. In other words, it can use the `mylist[42]` syntax. This is a lot more efficient than trying to access a random item in an `IEnumerable<T>`.

You might think "but there's `ElementAt()` on `IEnumerable<T>`". Yes, but that's basically just skipping `n - 1` items before accessing the desired item. `myEnumerable.ElementAt(42)` is basically this: `myEnumerable.Skip(42 - 1).First()`.

In the [Xamarin.Forms documentation it actually explictly tells you to provide a list](https://developer.xamarin.com/guides/xamarin-forms/user-interface/listview/performance/#Improving_ListView_Performance) if you can, for performance reasons.

###### Back to _SfChart_ by Syncfusion:

Apparently there's a limitation in _SfChart_ when it comes to `IEnumerable<T>` as the `ItemsSource`: **If you specify a custom `TrackballLabelTemplate` for your chart, it will be ignored if you don't use an `IList<T>`.**

This had me stuck for quite a while.

I usually provide a list when binding to `ItemsSource`, but in this instance I was using `Where()` in the view code-behind to filter out some unwanted items. Since `Where()` returns an `IEnumerable<T>` things didn't work. Putting a `ToList()` after the `Where()` clause fixed it all.

This wasted more hours than I want to admit to figure out...

If you stumble upon this post via Google; you're welcome :)

Happy coding!
Is there anywhere to propose new JavaScript features other than es-discuss?
Tags: discuss, javascript
Published: 2017-08-07 07:37:33

---
title: Is there anywhere to propose new JavaScript features other than es-discuss?
published: true
description: 
tags: discuss, javascript
---

I always found it interesting that the group spear-heading the progressiveness of the web into the future still uses email as its main contact medium.

----

Aside: I had this idea along the idea of `'use strict'` where a dev could use `'use js 2015'` or something similar to tell JS runtimes that the program was requiring a VM that was capable of a minimum JS environment of what they specified as a rudimentary way to add version metadata to JS files. Thoughts?
Day 1: Exploring #AndroidThings
Tags: raspberrypi, androidthings, thingscamp
Published: 2017-09-27 16:04:42

---
title: "Day 1: Exploring #AndroidThings"
published: true
tags: raspberry-pi,android-things,thingscamp
canonical_url: https://medium.com/@nitya/day-1-exploring-androidthings-598bde257f51
---

_Reporting on my first day of #FearlessCodingâ€Š–â€Šfor more about that see_ [_this post_](https://dev.to/devfestnyc/30days-of-fearless-coding-temp-slug-9463444)_â€Š–â€Šand what I explored&nbsp;today.._

So its 10:20 pm and I have a 4:00 am start so consider this a placeholder to be filled in with details on what I worked on today. With 2 hours of commute time tomorrow, I should be able to update this with more&nbsp;details.

#### Focus: Android&nbsp;Things

So I decided to focus on AndroidThings for my first fearless coding adventure. Two reasons&nbsp;why.

1. I am hosting the [GDG NYC meetup](https://www.meetup.com/gdgnyc/events/234963772/) tomorrow focused on this topic and this seems a good time to get my feet wet, given there will be a few experts and ideas around tomorrow, for me to kick things up a notch later this&nbsp;week.
2. I have always shied away from hardware. Its stupid but the reason is that software always felt more _flexible_ and _safe_ to work with. I lived in eternal fear of “bricking” my expensive hardware board or peripheral by doing something without understanding all the implications or knowing all the underpinning concepts. But that is exactly what fearless coding is meant to overcome right? _Am I curious about this space?_ **_Check._** _Am I going to persist and keep going till I build something?_ **_Abso-betcha-lutely!_** _And am I going to share my mistakes as I learn?_ **_I kinda think that will be the norm not the exception here&nbsp;:-)_**

Where I’m&nbsp;at:

1. AndroidThings exploration requires [AndroidStudi](https://developer.android.com/studio/index.html)o and some [dependencies installed](https://developer.android.com/things/training/first-device/create-studio-project.html)as pre-requisities. I am currently running the updates on the background on this machine. I am already tearing my hear out as AndroidStudio spits out ominous messages about being unable to patch some things&nbsp;…&nbsp;_hmmm._
2. AndroidThings exploration requires a compliant [Developer Board](https://developer.android.com/things/hardware/developer-kits.html) and optional [Peripheral Kits](https://developer.android.com/things/hardware/developer-kits.html#featured_peripherals). I had purchased an Intel Edison board and peripherals kit earlier from Sparkfun, and have an AndroidThings-compliant kit using Raspberry Pi 3 from Adafruit. And then I happened to pick up an NXP Pico kit from IO 2017. So I am ready with that&nbsp;bit..

Hopefully the software installs will complete tonight and I can get to work on image downloads (to dev boards) and setting up for my first project tomorrow..

Till then&nbsp;.. _bonne nuit&nbsp;.._
JavaScript array push, pop, shift, unshift: how to remember the difference
Tags: javascript, beginners, webdev, tutorials
Published: 2017-08-07 00:05:25

---
title: "JavaScript array push, pop, shift, unshift: how to remember the difference"
published: true
description: Quick, easy ways to remember the differences among shift, unshift, push, and pop in JavaScript arrays
tags: javascript, beginners, webdev, tutorials
canonical_url: https://simplestepscode.com/array-push-pop-shift-unshift/
cover_image: https://thepracticaldev.s3.amazonaws.com/i/0ubeyu59y6v2mrqbvqgl.png
---


When you're adding and removing stuff from the beginning and end of a JavaScript array, it can be tough to remember which method does what. Here are some tips:

- **Unshift** and **shift** make the whole array **shift** sideways (by adding and removing items from the beginning).

- **Push** and **pop** do NOT make the array shift sideways (because they add and remove items at the end).

- In each of those pairs (push/pop and unshift/shift), **the longer word makes the array longer**.

If you're curious, I made [a quick animation to illustrate these points](https://simplestepscode.com/array-push-pop-shift-unshift/).

I hope this helps!

----

Note that this is more of a memorization trick than a full explanation, so feel free to check out MDN for full details and examples of [push](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push), [pop](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop), [shift](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/shift), and [unshift](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/unshift).
Breaking Encapsulation with traits in PHP
Tags: php, traits, oop
Published: 2017-08-06 22:20:24

---
title: Breaking Encapsulation with traits in PHP
published: true
description: An example of how to break encapsulation using traits in PHP
tags: PHP, Traits, OOP
---

Traits in PHP are dangerous because they allow the accidental breaking of encapsulation, for no real gain. In this example you can see an example of traits vs an invokable class, you could use any `callable` type here for the same effect. You can avoid this by being careful and not setting any member variables in traits, but everyone makes mistakes, so why risk it, when the encapsulation comes for free with `callable` types?

```php
<?php

declare(strict_types=1);

use PurpleBooth\EncapsulationTraits\ExampleClass;

require_once __DIR__.'/vendor/autoload.php';

$instance = new ExampleClass();

echo sprintf("%s:\t%s\n", 'new', $instance->getName());
$instance->changeNameTrait();
echo sprintf("%s:\t%s\n", 'trait', $instance->getName());

$instance = new ExampleClass();
echo sprintf("%s:\t%s\n", 'new', $instance->getName());
$instance->changeNameInvokable();
echo sprintf("%s:\t%s\n", 'anonf', $instance->getName());

```

```php
<?php

declare(strict_types=1);

namespace PurpleBooth\EncapsulationTraits;

class ExampleClass
{
    use ExampleTrait;

    private $name = 'Initial';
    private $changeNameInvokable;

    /**
     * ExampleClass constructor.
     */
    public function __construct()
    {
        $this->changeNameInvokable = new ExampleInvokable();
    }

    public function changeNameInvokable(): void
    {
        call_user_func($this->changeNameInvokable);
    }

    public function getName(): string
    {
        return $this->name;
    }
}

```

```php
<?php

declare(strict_types=1);

namespace PurpleBooth\EncapsulationTraits;

trait ExampleTrait
{
    public function changeNameTrait(): void
    {
        $this->name = 'I broke encapsulation';
    }
}

```

```php
<?php

declare(strict_types=1);

namespace PurpleBooth\EncapsulationTraits;

class ExampleInvokable
{
    public function __invoke(): void
    {
        $this->name = 'I do nothing';
    }
}

```

```shell
$ php run.php 
new:	Initial
trait:	I broke encapsulation
new:	Initial
anonf:	Initial
```

Code in easier to run form [on github](https://github.com/PurpleBooth/encapsulation-traits)
How to store an email archive?
Tags: discuss, question
Published: 2017-08-06 20:40:50

---
title: How to store an email archive?
published: true
description: Can you help me out in finding the best way to store emails?
tags: discuss, question
---

I am going to be developing an application which stores emails but I'm wondering what would be the best way to store them?

I would like to be able to search through them which makes storing them in separate files very inefficient. So I was wondering which DB is the best for this solution.

SQL? NoSQL?
PostgreSQL? MongoDB?

What do you think?
Usando Emacs, los primeros 5 dÃ­as
Tags: emacs, productividad, programacion
Published: 2017-08-05 23:09:06

---
title: Usando Emacs, los primeros 5 dÃ­as
published: true
description: Mis primeros 5 dÃ­as usando Emacs.
tags: Emacs, productividad, programacion
---

**Nota:** Esta publicaciÃ³n ya tiene mÃ¡s de 2 meses de antigÃ¼edad, la traje de mi antiguo blog. Fecha original de la publicaciÃ³n: 2 de junio de 2017

**Note:** This post is already more than 2 month old, it comes from my old blog. Original post date: June 2nd 2017. And yeah, it's in Spanish.

***

Como competencia sana entre compaÃ±eros de trabajo decidimos probar Emacs. Algunos de ellos usan Vim, de hecho lo hacen realmente bien, y yo lo habÃ­a usado anteriormente.
Nuestros primeros pasos fueron leer sobre Emacs y la clÃ¡sica y antigua [“Editor war”](https://en.wikipedia.org/wiki/Editor_war). Lo tomamos como el punto de partida, para darle mÃ¡s diversiÃ³n aÃºn al asunto. Una serie de tweets y un grupo de discusiÃ³n en WhatsApp lo hicieron aÃºn mÃ¡s divertido.
Y asÃ­ es como empezÃ³ mi lunes. DescarguÃ© Emacs, le di un par de vueltas y comencÃ© a usarlo. AprendÃ­ que era un buffer y que iba a usar el Control y el Alt bastante seguido. EmpecÃ© a buscar charlas y artÃ­culos sobre Emacs. Ya para el dÃ­a martes tenÃ­a mi primera configuraciÃ³n, un archivo .emacs en mi carpeta de usuario del sistema operativo que no sÃ³lo estaba desordenado, sino que era inentendible.

![Emacs user](https://thepracticaldev.s3.amazonaws.com/i/5c8mgc5l2zfef1xhfn3t.jpg)

MiÃ©rcoles fue diferente. EmpecÃ© a reordenar mi configuraciÃ³n para que quede legible y funcional y la subÃ­ a un repositorio aunque no la pude usar a la primera, ya que me faltaban ciertas claves importantes, que tenÃ­a que trasladar desde ese .emacs. Para jueves mi configuraciÃ³n estaba lista para ser usada, mi idea de hacer la carpeta de Emacs (.emacs.d) un repositorio fue realmente buena, ya que todas las modificaciones que hacÃ­a las tenÃ­a inmediatamente en mis otras estaciones de trabajo.
Hoy se cumplen 5 dÃ­as en los que sÃ³lo uso Emacs como editor, y de a poco voy usÃ¡ndolo para otras cosas, prÃ³ximamente escribirÃ© este blog desde ahÃ­.
How do you tag (Github) issues?
Tags: discuss
Published: 2017-08-06 15:40:13

---
title: How do you tag (Github) issues?
published: true
tags: discuss
---

How do you tag issues, and how do they fit into your workflow? One that I've been thinking about recently, is the "help wanted" tag that github adds to repositories by default. But, at some level, help is wanted on any issue. I think "Good first contribution" is a better tag for the purpose of giving new contributors a place to start.
Mongo services down
Published: 2017-08-06 12:06:38

---
title: Mongo services down
published: true
description: 
tags: 
---

I'm trying to register here https://modulus.io/register
May the site is down. Same for <strong>mongolab</strong> :(

Can anyone suggest another service that I can use for mongodb may be?

Thanks in advance.
Cheers!
My Go (Golang) Adventure
Tags: go, programming
Published: 2017-08-06 03:20:54

---
title: My Go (Golang) Adventure
published: true
description: My first steps with Golang
tags: golang, go, programming
---

It's been three days I started with Go. I got caught with it because some chit-chatting with a friend, which is almost the only way I start with this kind of things (probably because my lack of creativity, I need a trigger).

Can't really say much with 3 days of programming but I've been having lots of fun with the code, even though there are some things that I don't like (but they are just code styling like the lack of semi-colons and the fact that standard is "use the tab character") but then I've got used to it.

## Setting up Emacs

Spent some time Friday afternoon to setup my Emacs for Go. It was quite easy, specially because [the godoc page](https://godoc.org/github.com/maraino/goofimports) already explains it.

## My first program

I started with the all famous "hello, world" but then, right away, implemented the `http` package and doing requests to different APIs. Started to play with the `os` package and the `Stdin` as well as the arguments passed to the program. All these because I already know what I want.

I want to create a terminal application to navigate through Twitter inspired on [Michael Lazar's rtv](https://github.com/michael-lazar/rtv) (which is a reddit terminal browser). I used to use [twittering-mode](https://github.com/hayamiz/twittering-mode) on Emacs but I'm starting to move all these perks outside Emacs now so I need a way to read my Twitter feed.

## Then, I got distracted

I found some bindings for OpenGL and the SDL library and had some fun opening windows and rendering funny quotes from the foaas.com API *(warning, strong language)*. Well, the weekend is to have fun, right?

## The Go Programming Language

![The Go Programming Language book](https://images.gr-assets.com/books/1426831830l/25080953.jpg)

I immediately bought Donovan's and Kernighan's **The Go Programming Language** and doing great progress so far. Not too much deep into reading but I find it fun and easy to read. It goes super-well with my the approach I take when learning a new language.

## Moving forward

I'm liking Go a lot! I'm looking forward to deep learn this language and have my terminal Twitter app up and running. I already got my hands on **termbox** ;)
Service Workers are coming to WebKit and Safari. Thoughts on the impact this will have?
Tags: webdev, pwa, browsers, discuss
Published: 2017-08-06 00:48:07

---
title: Service Workers are coming to WebKit and Safari. Thoughts on the impact this will have?
published: true
description: 
tags: webdev, pwa, browsers, discuss
---

![](https://pbs.twimg.com/media/DGSiPAiVYAE1a5A.jpg)

[Webkit Feature Status](https://webkit.org/status/#?search=service%20worker)
Bash Aliases (aka part 1 of 2000 of how to get more done in less time)
Tags: programming, timemanagement, bash, shortcuts
Published: 2019-05-31 17:31:28

---
title: "Bash Aliases (aka part 1 of 2000 of how to get more done in less time)"
published: true
tags: programming,time-management,bash,shortcuts
canonical_url: https://dev.to/aniketsmk/bash-aliases-aka-part-1-of-2000-of-how-to-get-more-done-in-less-time-3lp6
---

Speed.

It’s one of the most important things in life. Don’t get me wrong, some things must be done slow to be done right. You want to carefully consider choices and decisions but what about the inbetween?

What if you just wanted to know if the internet was down (again)&nbsp;?

> ping 8.8.8.8

What if you wanted to see what your debug key signature is for the millionth time?

> keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass&nbsp;android

Fond embracers of the terminal will be the first to snort approval that the fastest way to do most things, is via the terminal.

However, for the very common commands, you’d hardly want to keep typing them out every&nbsp;time.

Enter the bash&nbsp;aliases,

The most used of my aliases&nbsp;are:

> alias e=‘exit’

This tells bash that whenever you type e by itself and press enter, you want it to run the command&nbsp;‘exit’.

Pretty much anything that can be written in bash, an alias can made&nbsp;for.

### TLDR;

Save this file to your home folder and thank me later. The letter after alias, is what you type to run the command after&nbsp;equals.

{% gist https://gist.github.com/AniketSK/aab626b5465799bd65c975a1fce96f75 %}

What will you be putting in your aliases file? Comment below or reach out to me on twitter at [@AniketSMK](https://twitter.com/aniketsmk)
The downfall of HTML Imports is upon us (to me)
Tags: html, imports, javascript
Published: 2017-08-04 21:24:46

---
title: The downfall of HTML Imports is upon us (to me)
published: true
description: HTML Imports came out at the same time along with Web Components and they're being phased out. And they should not.
tags: html, imports, js
---

> [Deprecation] Styling master document from stylesheets defined in HTML Imports is deprecated, and is planned to be removed in M65, around March 2018.

I just read this in my console today after my Chrome browser just updated to M61. And it's the saddest news all I've read all day. The next step in the downfall of HTML Imports. And I can't believe it's happening because it is the *perfect* delivery method for CSS/JS libraries, frameworks, and of course, Custom Elements.

I first noticed the beginning of the end when I saw this:

{% github https://github.com/w3c/webcomponents/issues/645 %}

It's a proposal to make an amendment to HTML Imports to add the functionality through Javascript instead of through `<link rel="import">`. While I'm not totally against the idea of being able to import `<template>` elements and such inside JS, I hate the idea of it *replacing* the HTML way.

I *love* the idea of Custom Elements and it's honestly my favorite feature I've seen added since I started web dev. I have a repository dedicated to custom elements where I make a bunch. The most notable section of which is a folder with a bunch of [Fluent Design](http://fluent.microsoft.com/) inspired elements.

And the whole project can be used in one line.

```html
<link rel="import" href="https://rawgit.com/Nektro/custom-elements/master/fl/fl.html">
```

That one file sets some basic CSS, and imports all the other elements. However, Chrome is the only browser that has [native support](https://caniuse.com/#feat=imports). Everyone else has to use a bodged polyfill because every other browser isn't even interested in implementing it for some reason.

In the end, I hope this HTML based feature stays supported in HTML.
A question from a Rookie to all the JavaScript Marvels out there 
Tags: javascript, webdev, beginners, discuss
Published: 2017-08-04 15:48:05

---
title: A question from a Rookie to all the JavaScript Marvels out there 
published: true
description: Just want to know where's a good place to read/learn these "code examples" so I can try figure out the talked about problem further down.
tags: javascript,webdev,beginners,discuss
---

So here are the basics. The following bit of code refers to a reaction game where the user clicks on a randomly appearing object as they show up in the browser it then out puts the time it took them to click on it.

```javascript
function appearAfterDelay() {
		setTimeout(makeShapeAppear, Math.random() * 2000);

	}

	appearAfterDelay();

		document.getElementById("shape").onclick = function() {
			document.getElementById("shape").style.display = "none";

			var end = new Date().getTime();

			var timeTaken = (end - start) /1000;

			document.getElementById("timeTaken").innerHTML = timeTaken + "s";

			appearAfterDelay();
	}

```
(and if any of you know of shorter or cleaner way to write code that you see me posting here or in future posts please let me know, since I am new I'd like to know if what I'm doing is clean and readable or not, and if there is a faster way to do it, then I'm all for it)

Back to the Main topic though.
I've been looking around to find code that will allow me to capture their fastest time (in a time limit of, lets say 2 minutes for the user to try their luck) and then store it in a side bar as a record allowing them to enter in their name along side, once the timer ends, and also (lets say it holds the top ten records) to compare it to those ten and if it beats one or more of them to then position it correctly and get rid of the record that would then move to the eleventh spot.

So if you have ideas on this or know of a place where I can read up about this please let me know or am I just trying to do something that isn't possible? Because in the the places I know to look I haven't come across anything that I can see that would help (although that's probably because I just don't know what exactly one would call such pieces of code any way)

Any hints,tips and ideas would be much appreciated. Thanks.
Explain elasticsearch - pros and cons
Tags: elasticsearch, explainlikeimfive, discuss, search
Published: 2017-08-04 11:25:42

---
title: Explain elasticsearch - pros and cons
published: true
description: 
tags: [elasticsearch, explainlikeimfive, discuss, search]
---

Hi, I'm working with search in my work project right now and I'm stuck on thoughts about the best way of its' realisation. Â¯\\_\(ãƒ„)\_/Â¯  There will be many search options such as time, different id and serial numbers, location, names etc.

Sooo... What does elasticsearch do? And is it better than just db querying?

Thank you for any reply and supporting information :]