teleren/devto huggingface dataset:
[Feedback] server-for-symfony-flex: version rush
Tags: php, versionrush
Published: 2019-12-05 11:30:14

---
title: [Feedback] server-for-symfony-flex: version rush
published: true
description: 
tags: #php, #versionrush
---

https://github.com/moay/server-for-symfony-flex/pull/42#issuecomment-562089136

maybe a softer approach, by reverting the php7.2 requirement (which is maybe not even required) instead of removing php7.1 from the matrix, would save some people from trouble (in this case it is not that problem because its and independed full app)

the rush for new versions it is really terrible for people which use the lts version of symfony. even 4.4, which was released a short time ago, [only requires php 7.1][1]

of course i know that people should update because php 7.1 is not supported any more but to be realistic, people still use php 5.6 because their apps are not compatible with higher versions and there is no time and/or budget to upgrade the app. Rasmus Lerdorf on phpday 2019 Verona May 10-11th, asking his audience who is using php 5.x (watch at least min 26:08-26:45)
https://www.youtube.com/watch?v=wCZ5TJCBWMg&t=1568

as far as i know debian (i only found [info about ubuntu after a quick search][2]) also backports php security fixes for their supported releases. stretch ships with php7.0 and debian stretch is supported until june(?) [2020][3]. [lts][4] for debian stretch runs [until june 2022][3]. 

maybe such things should be included in a decision if a php should be removed from the matrix or not. a [similar comment][5] i made at codeception :)

please don't get me wrong, thank you very much for your awesome work, i love the flex server as symfony sadly decided not to opensource theirs or make private recipes possible without gibhub or without the need of installing a github app.

with this comment i just want to aware developers that removing, even outdated versions, can really make people struggle but of course its your decision which version of php this app should support.

[1]: https://github.com/symfony/website-skeleton/blob/4.4/composer.json
[2]: https://askubuntu.com/questions/579002/are-all-php-security-upgrades-backported-to-ubuntu-12-04-until-2017
[3]: https://en.wikipedia.org/wiki/Debian_version_history#Debian_9_(Stretch)
[4]: https://wiki.debian.org/LTS
[5]: https://github.com/Codeception/Codeception/issues/5532#issuecomment-530741981
#7DaysJS: Primes Until n
Tags: javascript, challenge, beginners
Published: 2019-12-05 11:41:32

---
title: #7DaysJS: Primes Until n
published: true
date: 2019-12-05 11:16:00 UTC
tags: javascript, challenge, beginners
canonical_url: https://lautarolobo.xyz/blog/7-days-of-js-primes-until-n/
description: How can we know when a number is prime? And count how many primes are there until `n`?
cover_image: https://lautarolobo.xyz/images/7daysJS-7f7d8328.webp
---

Welcome to day 7 of 7 Days of JavaScript!

Today, on the last day of this challenge, we will tackle a hard one.

Write a function that takes a Natural number `n`, which returns all the primes from 0 to `n` and a string at the end with some phrase.

Example:

```javascript
primesUntil(7)
...
2
3
5
'Why the string?'
```

Hint: you may want to use a helper function.

Give it time. If you feel frustrated, go take a walk and then sit down to try it again.

And then, read the solution [here](https://lautarolobo.xyz/blog/solution-to-day-7-of-7-days-of-js/ "Solution to the last day of 7 Days of JS").
#KotlinConf 2019 - interviews coming
Tags: kotlin, kotlinconf
Published: 2019-12-06 14:11:13

Velkommen from Copenhagen, Danemark for the third Kotlinconf

https://kotlinconf.com/

Kotlinconf is the best conference in the year to meet fellow Kotlin enthusiasts. 

I met for the first time a lot of people that I had before only interacted with via Slack. 

It was really nice to put a face and a personality behind a slack handle. 

And so I thought I will do a series of interviews here, as a pretext to get to know them better. 

By the way, if you have your own articles, make sure to use the `#kotlin, #kotlinconf` tag so that you are easy to find. 

{% tag kotlin %}
{% tag kotlinconf %}
Daily Challenge #142 - Parts of a Whole
Tags: challenge
Published: 2019-12-23 17:00:17

---
title: Daily Challenge #142 - Parts of a Whole
published: true
series: Daily Challenge
description: Break apart a number and return the sum.
tags: challenge
---

Given a long number, write a function to return all possible pairs of addends and the sum of each pair. 

For example, `12,345`: all of the addends from that number are:
`[ 1 + 2, 1 + 3, 1 + 4, 1 + 5, 2 + 3, 2 + 4, 2 + 5, 3 + 4, 3 + 5, 4 + 5 ]`

Therefore the result must be:
`[ 3, 4, 5, 6, 5, 6, 7, 7, 8, 9 ]`

**Test Cases**
`156`
`81596`
`3852`
`3264128`
`999999`

Good luck!
***
_This [challenge](https://www.codewars.com/kata/every-possible-sum-of-two-digits) comes from Zorianff9 on CodeWars. 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 idea for a future post?  Email **yo+challenge@dev.to** with your suggestions!_
Fetch Data with React.useEffect()
Tags: react
Published: 2019-12-07 08:09:35

Things happen outside of React.
It's just a fact of life.

React gives us a single function for connecting to all of the events and effects that React doesn't automatically manage.

It's named `React.useEffect()` and you invoke it with a function.

```js
React.useEffect(() => {
  // doStuff();
})
```

One of the things we use this function for is fetching data.

```js
React.useEffect(() => {
  fetchPokemon(1);
})
```

This function will fire every single time the component is rendered.
That includes re-renders by `React.useState`.

In our Pokemon app, our "Next" button calls `setPokemon()`, re-rendering and re-running our `React.useEffect()` function.

```jsx
function App() {
  let [index, setIndex] = React.useState(0);
  let pokemon = collection[index];

  return (
    <div>
      <button type="button" onClick={() => setIndex(index + 1)}>
        Next
      </button>

      ...
    </div>
  )
}
```


### Give it a try
Use the Code Sandbox below to give this lesson a try directly in the browser.

{% codesandbox 30n40 %}

**Assignment**

1. Call the `React.useEffect()` function in the `App` component
1. Give `React.useEffect` a function that calls `fetchPokemon(index)` for data
1. Chain a `.then()` onto `fetchPokemon(index)` that logs out the returned json


---

Follow the 🧵 on Twitter:
{% twitter 1203086405934571521 %}

Subscribe on YouTube:
{% youtube DppJLdioMjg %}
I'm trying to use Reactjs in Visual Studio Online(browser)
Published: 2019-12-07 11:49:32

I imported 'react-router-dom' in VSonline terminal and tried to use to make SPA web-application. However, when I tried to render it by using 'npm start' in terminal, this error comes up..

SecurityError: Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS.
./node_modules/react-dev-utils/webpackHotDevClient.js
node_modules/react-dev-utils/webpackHotDevClient.js:60
__webpack_require__
/home/vsonline/workspace/learnreact2/webpack/bootstrap:785

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/5agvx2hijnpentpg6py5.PNG)

I have to use visual studio online through browser for some reason, and need to use react-router-dom. If anyone can hand a solution for this problem, it will give a big help to coding beginner :( ..
git grep in subdirectories
Tags: zsh, xargs, todayilearned
Published: 2019-12-07 18:33:15

---
title: git grep in subdirectories
published: true
description: git grep in subdirectories
tags: zsh, xargs, til
---

git grep in subdirectories, then show the result of git grep + base directory name. 

for mac:
```
for dir in */; do (cd $dir; git grep -n Gemfile| tr -s '\n' '\0'|xargs -0 -I {} printf "$(basename $(pwd))/{}\n") done
```

```
(snip)
ruby-saddler-reporter-text/.gitignore:3:/Gemfile.lock
ruby-saddler-reporter-text/README.md:59:Add this line to your application's Gemfile:
ruby-saddler-reporter-text/bin/console:9:# (If you use this, don't forget to add pry to your Gemfile!)
ruby-saddler-reporter-text/example/Gemfile:1:# A sample Gemfile
ruby-text_to_checkstyle/.gitignore:3:/Gemfile.lock
ruby-text_to_checkstyle/README.md:47:Add this line to your application's Gemfile:
ruby-text_to_checkstyle/bin/console:9:# (If you use this, don't forget to add pry to your Gemfile!)
ruby-uri-ssh_git/.gitignore:3:/Gemfile.lock
ruby-uri-ssh_git/README.md:65:Add this line to your application's Gemfile:
ruby-uri-ssh_git/bin/console:9:# (If you use this, don't forget to add pry to your Gemfile!)
```
Gotcha! It’s the trailing slash
Tags: clojure, luminus, day6
Published: 2019-12-08 18:14:41

---
title: Gotcha! It’s the trailing slash
published: true
date: 2019-12-06 07:00:00 UTC
tags: clojure,luminus,day 6
canonical_url: https://alexanderoloo.com/blog/2019/12/06/gotcha-its-the-trailing-slash.html
---

_You’ve discovered the [Luminus framework](http://www.luminusweb.net/). You’ve reached unparalleled levels of productivity. You can build a web app at the drop of a hat. You can’t believe no-one told you about this before. You’re life is perfect except for one small thing._

_Every now and then an existing route returns a 404. It doesn’t make sense. The error only occurs some of the time. Should that even be possible? You want to pull you hair out…_

**GOTCHA! It’s the trailing slash!**

Luminus relies on the awesome routing library by [reitit](https://github.com/metosin/reitit). And reitit uses exact route matching. So `/apply` and `/apply/` are two different routes. Therefore depending on how your end user enters the url, they may or may not get a 404.

Here’s how I fixed it:

```clojure
(mount/defstate app
  ...
      (ring/routes
        (swagger-ui/create-swagger-ui-handler
          {:path "/swagger-ui"
           :url "/api/swagger.json"
           :config {:validator-url nil}})
        (ring/create-resource-handler
          {:path "/"})
        (wrap-content-type
          (wrap-webjars (constantly nil)))
        ; Here is it is => 
        (ring/redirect-trailing-slash-handler {:method :strip})
        ;<= and you're good to go
        (ring/create-default-handler
  ...

```

You can learn more about handling the trailing slash [here](https://cljdoc.org/d/metosin/reitit/0.3.10/doc/ring/slash-handler).

_May your build always pass._

_Alex_

This post is part of the ["Advent of Parens"](https://alexanderoloo.com/blog/2019/12/01/advent-of-parens.html).

_Today’s post is late courtesy of our wonderful electricity provider Eskom. Loadshedding is the best!_
I made a game to help people learn the notes on their guitar. It's free and mobile-friendly 🎸
Published: 2019-12-07 20:29:14

Hi everyone!

I was working these past few weeks on a cool side project, and since I haven't been publishing anything lately, I decided to go ahead and share this with you 😁
Link of the app: [https://guitar-fretboard-learning.web.app/](https://guitar-fretboard-learning.web.app)

# Context

I have been playing guitar for 5 years now and never have I learned the notes of the fretboard correctly. Add to that that I don't have the *musical ear* so I was playing the notes without knowing which notes I was playing.
So, as any developer that struggles with something, I decided to build an app for that!


# Game modes

In this app you can learn the fretboard (guitar notes) either by locating the notes (where) or by identifying them (which). Also, you could explore your fretboard or your favorite scale in any tuning you want.



### Locate the note
In this game mode, you have to locate the note on the fretboard and click on it.

### Identify the note
In this game mode, you have to identify the note highlighted on the fretboard.


### Explore the fretboard 
In this game mode, you can explore the fretboard, show or hide the notes as you wish in any tuning.





# Stack

I used Angular, Ionic, and Ngxs (state management) to build the app. It's 100% free and open source. here's the [link to the repo](https://github.com/TheAngularGuy/guitar-fretboard-learning) if you want to have a look into the code or give a star to the repo 💝🥺.

Lighthouse scores:
![pwa score](https://thepracticaldev.s3.amazonaws.com/i/4vvhudei842dk8e5kldg.png)




# Future steps

- Unit testing & E2E testing
- Create a user account and track progress
- more game modes
- ...







If you have any feedback or suggestions the [DMs are open 😁](https://twitter.com/TheAngularGuy)




---

That's it for this post. I hope you liked it. If you did, please share it with your friends and colleagues. Also you can follow me on twitter at [@theAngularGuy](https://twitter.com/TheAngularGuy) as it would greatly help me.

Have a good day !


---

### What to read next?


{% link https://dev.to/mustapha/css-grid-illustrated-introduction-52l5 %}
Converting PNG to JPG image files in C#
Tags: csharp, tutorial
Published: 2019-12-08 01:03:19

If you are a programmer and you have hundreds of *PNG* files occupying your storage disk, you can save some space by converting *PNG* to *JPG* files, provided that you're not concerned about reducing some non-visible quality.

Here are the steps you can code that program in C#.

In bash/console terminal,

```csharp
mkdir png2jpg
cd png2jpg
dotnet new console
dotnet add package System.Drawing.Common
code .
```

Add new *using* statements in *Program.cs*,
```csharp
using System;
using System.IO;
using System.Drawing;
using System.Drawing.Imaging;
```

Add the following code in *main* program.

```csharp
            var folder = @"/Users/PNGs/";
            int count = 0;

            foreach (string file in Directory.GetFiles(folder))
            {
                string ext = Path.GetExtension(file).ToLower();
                if (ext == ".png")
                {
                    Console.WriteLine(file);
                    string name = Path.GetFileNameWithoutExtension(file);
                    string path = Path.GetDirectoryName(file);

                    Image png = Image.FromFile(file);
                    
                    png.Save(path + @"/" + name + ".jpg", ImageFormat.Jpeg);
                    png.Dispose();

                    count++;
                    File.Delete(file);

                }
            }

            Console.WriteLine("{0} file(s) converted.", count);
            Console.WriteLine("Press any key to exit.");
            Console.ReadLine();
```

What this code does is it will get the path to the *PNG* directory. It will check the files one by one whether it has a *PNG* extension. When the *PNG* file is found, it will split the name and the path of that file. And save the file with the extension, *JPG* and its format. Then it will finalize the image and **delete** the *PNG* accordingly.

If you are using *macOS*, you may need to install `mono-libgdiplus`. If I've missed some *Exception Handling*, please let me know. Thanks for reading.
Day 8 of the Visual Studio Tips Advent Calendar is now live
Tags: visualstudio
Published: 2019-12-08 07:56:20

Day 8 of the Visual Studio Tips Advent Calendar is now live. Enjoy! 

There's been just over a weeks worth of tips shared now, but still plenty to go, don't you worry!

https://visualstudiotips.co.uk/calendar/

#VisualStudio #DevDecember #VsTipsAdvent #Advent
Percentages in CSS: you're using them wrong
Tags: css, webdev
Published: 2019-12-08 12:56:08

... *if* you do one of the things I'm going to explain.

The motivation for this post came after a colleague wrote something like this:
```css
.foo {
  background-position: 83% 10%;
}
```
and I was like: "Huh, what?"

Of course, I had no clue of what was going on there. Only after I launched the project I had a hunch of the *intent* of the code: they were finely positioning an image in the middle of the right half of a container... and 10% from the top, because why not.

This led me to give them an advice I usually give to novices:

> If you're using a percentage different from 100% and 50%, there's probably a better approach.

The point is that "100%" is commonly intended as "all the way" and "50%" as "half-way". (Note: I'm not including 0% as you should probably use 0 instead, but the idea is the same.) *Any other value* - including something apparently "easy" like 25%, 33% or 10% - is more difficult to recognize *and understand*.

## What if I *need* that value?

Of course, that value could be totally legitimate and the result of a well conceived computation - although in my experience it's usually the result of trial and error 😅 (i.e.: "Does this value look good? Mmm, not quite, I'll add 1% more...").

Fortunately we have plenty of tools to write clearer code and convey the correct meaning. If you're using a preprocessor like SASS or LESS, you can avoid [magic numbers](https://en.wikipedia.org/wiki/Magic_number_(programming)) altogether with a fine use of meaningfully named variables.

In the case above, the goal was to center horizontally an image on the right half of the container, with a with of 25% of the container. And that 10% was roughly the height of the header. So, ideally, the code would have been something like this:

```scss
$header-height: 8rem;
$image-width: 25%;

.foo {
  $bg-position-x: 100% - 50 * $image-width / (100% - $image-width);
  background-position: $bg-position-x $header-height;
}
```

This still could be improved (the way background images are positioned isn't as simple as one can imagine), but at least it's clear that the position depends on the image's width. *And* provides the correct value (83.3333...%).

If you're not using a preprocessor, you can still use plain-old CSS, as `calc` and CSS custom properties are now widely supported:
```css
:root {
  --header-height: 8rem;
  --image-width: 25;
}
.foo {
  --bg-position-x: calc(100% - 50% * var(--image-width) / (100 - var(--image-width)));
  background-position: var(--bg-position-x) var(--header-height);
}
```

And if you need to support Internet Explorer... why aren't you using a preprocessor? 😱

## Conclusion

Please use variables with meaningful names and have mercy on those who will maintain your code 😄
backflow incense burner
Tags: bestbackflowincenseburner, backflowincenseburner
Published: 2019-12-08 20:31:08

Welcome to Culture and You. We are leading Indian handicrafts manufacturers, suppliers and exporters. We are basically situated in Noida, India and operate throughout the world
Get Best Backflow Incense Burner visit - https://www.cultureandyou.com/
Logging on the cheap
Tags: java, slf4j, logging, log4j
Published: 2019-12-10 01:26:55

_To log or not to log?_ 

Writing new code is a relatively small part of application development. A much larger part of a software engineer's life involves supporting and maintaining existing systems. First and foremost, this requires the right level of insight — understanding what exactly the system is doing, particularly when this isn't quite what you (and your customers) were expecting. Logging, tracing, remote debugging, and application performance monitoring are essential in attaining the level of observability required to comfortably operate and support a modern application suite.

When building conventional applications, the question of whether an action should be logged or not is rarely a subject of rigorous debate. (By 'conventional', we mean most e-commerce applications with fairly routine non-functional requirements concerning throughput, latency, availability, and so forth.) Occasionally, we come across a class of applications that breaks that mould. Sometimes particular modules of an otherwise conventional system might be subject to very stringent constraints around their performance. An application might perform an expensive calculation in a tight loop, or it may be required to respond (on average) within a tight time frame. Invasive instrumentation of these applications changes their timing behaviour — even simple log calls carry an overhead that might cardinally impact the customer experience. In these sorts of scenarios, the question posed at the beginning of the article — _To log or not to log?_ — becomes a real point of debate. Do you sacrifice break-neck performance for observability, or is performance the coveted money-maker that dwarfs every other concern?

***

# Introducing Zerolog?
This article is going to explore [Zerolog](https://github.com/obsidiandynamics/zerolog) (abbreviated to Zlg) — an ultra-low-overhead logging façade for performance-sensitive Java applications. The objectives of Zlg are twofold —

1. **Ultra-low overhead for suppressed logging.** In other words, the cost of calling a log method when logging for that level has been disabled is negligible. Furthermore, it is possible to invoke Zlg in such a way as to reduce these costs to absolute zero.
2. **Uncompromised code coverage.** Suppression of logging should not impact statement and branch coverage metrics. A log entry is a statement like any other — if it's worth writing, it's worth testing.

[Read the rest of the article on Medium.](https://itnext.io/logging-on-the-cheap-568674fa6387)
What technology are you planning to learn in 2020? 💡
Tags: codenewbie, discuss, javascript, programming
Published: 2019-12-09 09:44:12

It's almost 2020 and I am planning to dive deep into PWAs this coming year. 
A little late to the party, I know 🤓. 

#PWA: Progressive Web Apps 🔥
PWAs are regular web apps (HTML/CSS/JS) but have a native feel as far as experience, layout and functionality.

* Looks great on all devices
* Offline content with service workers
* Must be HTTPS
* Reliable, fast and engaging

## So, What do you plan to learn in 2020? 🚀 


This is inspired from @emmawedekind's [post] (https://dev.to/emmawedekind/what-technology-do-you-want-to-learn-in-2019-dfh) from last year.
#Tip Use local Azure Storage emulator in Remote Containers
Tags: azurevscodedocker
Published: 2019-12-09 12:10:03

---
title: #Tip Use local Azure Storage emulator in Remote Containers
published: true
description: How to access to local resources from a development container?
tags: azure vscode docker
cover_image: https://thepracticaldev.s3.amazonaws.com/i/l4y5tt258qbseaj1o4nl.png
canonical_url: https://www.maneu.net/blog/use-local-storage-emulator-remote-container/
---

I LOVE [Remote Development Extensions](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack&wt.mc_id=localstoremu-devto-chmaneu) for Visual Studio Code. It allows me to simply pack all my technical stack in one docker container, while getting me everything I need to run and debug things.

## Everything, this includes `localhost`, right?

Ehmm.. that depends! This morning, I was doing different things with Azure Functions SDK for [25 days of serverless](https://25daysofserverless.com/), and for that I needed to access the local Azure Storage Emulator, the one on my local machine - not within a Docker container.

How can I possibly access local resources - who are neither on Internet or within another container - from a container?

## 3 magic words
`host.docker.internal`. That's all you need _within_ your container to access your "real" localhost, and everything hosted on it. Like my Azure Storage Emulator :). With that bit of magic, I was able to replace the usuel local connection string `UseDevelopmentStorage=true;` by the following :

```
UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://host.docker.internal
```

Et voilà! I'm now able to use the benefits of Remote Containers development while using all my local hosted tools, including the Azure Storage Emulator :)