teleren/devto huggingface dataset:
How to check which version of PHP you are running
Tags: php
Published: 2020-03-16 09:49:00

When working on open source code, I like using the latest version of PHP. When developers that are not on the latest version use the package, they might see syntax errors.

You might ask why Composer doesn't protect against this? When composer.json requires the latest version, how do devs, not on the latest version, can even install the package?

Well, there seemingly are a lot of people that only upgrade the PHP version on the command line. For handling web requests, they are unknowingly using an older version of PHP. Here's how to make sure you are on the latest version of PHP on both the CLI and for handling web requests.

<!--more-->

On the CLI type this command to see your PHP version:

```bash
php -v
```

To check the PHP version that handles web requests, create a `.php` file with this content somewhere the public directory of your app.

```php
<?php

phpinfo();
```

Point your browser to that file. You will now see which version of PHP you are running. Don't forget to delete the file afterward.
Simplicity is a developer's best friend
Tags: simplicity, delivery, productivity
Published: 2020-03-16 09:36:57

---
title: Simplicity is a developer's best friend
published: true
description: The typical problems associated with software projects, cost overruns and delays are all closely related to the disregard for simplicity. 
tags: #simplicity #delivery #productivity
canonical_url: https://charlesagile.com/simplicity-is-a-developer-s-best-friend
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/p0nbze7wxof8uyssueju.jpg
---

You need to embrace simplicity if you want to achieve results today and stay successful tomorrow. Long term product quality, performance and development speed all rest on the simplicity of a system.

> Run with the minimum that achieves the business goals.

There are two kinds of complexity in any project: the inherent complications of the problem domain and the unnecessary, "incidental" or "accidental" complexity introduced by developers. The domain complexity is more or less fixed and has to be accepted as is. Dealing with it is the primary role of a developer.
Accidental complexity, on the other hand, has to be avoided and minimised at all cost.

Be frugal with code, processes and infrastructure. Everything you add today will have to be looked at and understood by you or someone else in the future. The more complicated your system is, the more resources people dedicate to learning it instead of implementing improvements and new features.

> Simple might seem boring at first - but it's the opposite: it's liberating. 

Continue reading [Simplicity is the best ally in the long run](https://thekarel.gitbook.io/best-practices/the-big-picture/principles/simple) on my [Best Practices on GitBook](https://thekarel.gitbook.io/best-practices/)
What Would You Use When Starting a New Company/Project?
Tags: discuss, question
Published: 2020-03-16 09:04:08

---
title: What Would You Use When Starting a New Company/Project?
published: true
cover_image: https://unsplash.com/photos/SYTO3xs06fU
description: If you're starting a new project for yourself with plans to make it a business, what should you use?
tags: discuss, question, 
---
Hello everyone! I want to start a discussion about technologies that you would use if you're starting a new project or building up a new tech company.

If you're starting a new tech company what languages, technologies, platforms, etc. would you use and why? Say your tech company is doing some  web and app development and you're developing to setup a new e-commerce site or a social networking site.
React Work Phases
Tags: javascript, react
Published: 2020-03-15 18:03:24

To make a great user experience updating the page, React split its internal processes into two phases: "render"  and "commit". Both phases run synchronously and make sure, that user sees already calculated styles, layout and updated UI.

## Render Phase

When the time comes to render a page, usually caused by a change of component's state or props, React does a process, called reconciliation.
First, it creates a virtual DOM by recursively calling components render functions down the tree until all React elements are returned. Second, it compares that virtual DOM with the last render looking for differences. If there is a change then it updates the DOM.

This is a slower process comparing to the "commit" phase. Because when comparing the next render with the previous, React checks if element types and order are the same. If element types are the same, then the same element instances in the DOM will be used. Same goes for the order, if it changed, then the sub-tree of elements will be recreated. To tell React that it is the same elements regardless of the order we are giving unique "key" attributes for components.

The following lifecycle methods are called during the render phase:
- componentWillMount  
- componentWillReceiveProps
- componentWillUpdate
- getDerivedStateFromProps
- shouldComponentUpdate

These methods can be called even a couple of times during the render phase (because of errors or interruptions), so it is important to not have side-effects, like changing the UI or calling external services, to avoid problems and memory leaks.

## Commit Phase

This is a second and fast phase where React applies changes. Now that render phase produced result how the DOM should look like, commit phase inserts new, updates existing or removes unnecessary DOM nodes. 

During this process, the following lifecycle methods are called:
- componentDidMount
- componentDidUpdate
- componentWillUnmount
- componentDidCatch

These methods are called only once and side effects are permitted. If the state or view changes as a side-effect, the render phase will be triggered safely again.

## Summing Up

React works in two phases, render and commit. During the render phase, it calls a render method and performs a comparison to the previous render. And the commit phase is where the changes are directly applied to the DOM. After that, the webpage is updated and presented to the user.
is chrome a must-use for developers
Tags: discuss
Published: 2020-03-16 08:43:58

---
title: is chrome a must-use for developers 
published: true
description: 
tags: discuss
---
Last time was having a meeting with my brother in messenger video call, we were discussing an application that we are building , for a moment he needed to share his screen to show me a piece of code in the app , I asked him to use messenger new screen share option which require a chrome extension to do so , but unfortunately he was using opera browser , right then we had a small argument about using chrome as been a developer from not using it , so just wanna guys hear your thoughts about that .
Loading libraries in C++ on Linux
Tags: cpp, programming
Published: 2020-03-16 08:23:30

---
title: Loading libraries in C++ on Linux
published: true
description: 
tags: #cpp #programming
---

This is that kind of code that we don't write all the time, so let's remember the different ways to load and create libraries on Linux

There are 3 ways a library can be used by an application

- Importing a static library
- Static linking a shared library
- Dynamic loading a shared library

We are going to show all the forms in this article

Read the full post here:
[Thiago Caf&eacute; - Loading libraries in C++ on Linux](http://www.thiago.rocks/view/20200315_dynamic_loading)
Community Lockdown - and what to do NEXT
Tags: career, learning
Published: 2020-03-16 08:08:20

---
cover_image: https://images.unsplash.com/photo-1483058712412-4245e9b90334?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=750&q=80
---
Cover Photo by Carl Heyerdahl on Unsplash

## COVID - 19

Currently, the world is facing a pandemic called the COVID-19 

It's spreading like wildfire, in order for control, some countries are establishing Community Lockdown, up to Total Lockdown.

In my place we are having a Community Lockdown, starting today until April 13, 2020, and if only the pandemic gets under control.

I'm currently undergoing an internship, which has pushed their employees to WFH(Work From Home). But apparently interns are strictly not allowed to WFH. 

Interns either get terminated early or had to wait for 1 month until things get controlled.

## Plans
So I have around 1 month of free time. and this might be the best time for me to be productive (and you). To not waste time, as this - is an opportunity, a head start of being someone better later on the path. 

I'll be constantly reminding myself to work hard, by uploading weekly updates, and daily tweets.

## Links

Twitter: [https://twitter.com/dylan_balagtas](https://twitter.com/dylan_balagtas)

Dev.to: [https://dev.to/dylan_balagtas](https://dev.to/dylan_balagtas)

### Reasons why I'll post updates

1. To enforce me to work productively every day.
2. Document on the achievements and learning.
3. and maybe, just maybe, I might inspire someone to ride along. 

I'll be starting today and hopefully, won't lose track, but hey :

> it's not about how you WIN or LOOSE, but it's about how you stand up every time you fall down.

Let's not waste time and push ourselves toward the upgraded person we want to be.
The Front End Podcast - Episode #3
Tags: career, podcast, frontend
Published: 2020-03-16 08:04:22

I'm pleased to introduce Episode 3 of [The Front End](https://thefrontendpodcast.site). We've shined and polished and it's ready for your beautiful ears to receive via the following platforms:

- Apple Podcasts > https://podcasts.apple.com/gb/podcast/the-front-end/id1499349107
- Pocket casts > https://pca.st/osul2zsa
- Spotify > https://open.spotify.com/show/4GuAxptrtY8Es5iHwp09dT
- Anchor > https://anchor.fm/the-front-end

## About episode 3

In episode three we have [Chris Bertrand](https://twitter.com/DesignPuddle), a senior fullstack developer with [Aldermore bank](https://www.aldermore.co.uk/). 

Chris has a wealth of coding experience across different technologies and is filling us in on static code analysis, code linting and software development policies; what they are, why they're a good thing, and how you can implement them in your own organisation.

## Listening direct

Want to listen directly from here?

{% spotify spotify:episode:12VJpa3Zoq8HnsuAbwN5ix%}

## Want to be a guest or sponsor the show?

I'm definitely looking for guests to talk about a range of different development topics from careers to origin stories, learning and professional growth, frameworks and more.

Similarly, we're looking for sponsors to fill promotional slots within the show. 

You can find out more here:

- [Being a guest](https://thefrontendpodcast.site/guests)
- [Sponsorship information](https://thefrontendpodcast.site/sponsorship)

Thanks for listening!
How to use hexadecimal colour strings in Flutter
Tags: flutter, dart, programming, mobile
Published: 2020-03-16 07:41:10

---
title: How to use hexadecimal colour strings in Flutter
published: true
description: Use hexadecimal colours in the Flutter App
tags: flutter, dart, programming, mobile
cover_image: https://mightytechno.com/wp-content/uploads/2020/01/text.png
canonical_url: https://mightytechno.com/hexadecimal-color-strings-in-flutter/
---
Flutter natively not supported by setting colors as a hex string value. But we can implement a simple method to do that job.

#Method to convert a hexadecimal string to colour

These are the steps need to follow when converting hex string to int colour.

1. Remove the # value
2. Add 0xFF to the front of the string if the colour doesn't have opacity value.
3. If the colour string has opacity value, discard the FF and append-only 0x.
4. Convert to Color.


```dart
       Color colorConvert(String color) {
            color = color.replaceAll("#", "");
            if (color.length == 6) {
              return Color(int.parse("0xFF"+color));
            } else if (color.length == 8) {
              return Color(int.parse("0x"+color));
            }
          }
```
![hexadecimal colour strings in Flutter](https://mightytechno.com/wp-content/uploads/2020/01/Screenshot_1579138012-576x1024.png)


Originally published at [mightytechno](https://mightytechno.com/hexadecimal-color-strings-in-flutter/)

Connect with me - [Instagram](https://www.instagram.com/mighty_techno) |[Blog](https://mightytechno.com/) |[Twitter](https://twitter.com/mightytechno)
Reordering elements on an HTML form using Vanila JS: what's the best practice in terms of performance? 
Tags: javascript, webdev, html, frontend
Published: 2020-03-16 07:19:00

I got this take home assignment last year when I was applying for a front end engineer position at some big Japanese company.

The question is about making a form with a button to make table rows randomly rearrange every second, and a button to sort rows based on some criteria. The way I rearrange the rows in the form is to manipulating the JSON object and regenerate the dom element as a whole

This has to be implemented via pure JS without using any JS libraries.

I put the code on codesandbox, here is the link
https://codesandbox.io/s/dawn-water-l2m7g 

Basically the way I rearrange the rows in the form is to manipulating the JSON object and regenerate the DOM element as a whole.

Here is an important piece from my code

```js
let list = TABLE_DATA; // from the JSON file
...

function startRandom() {
  timer = setInterval(function() {
    list = list.sort(randomSort);
    renderList(list);
  }, 1000);
}

function renderList(list) {
  const res = list
    .map(item => {
      return renderRow(xssFilter(item));
    })
    .join("");

  tbody.innerHTML = res;
}

function renderRow(item) {
  return `
    <tr>
        <td>${item.id}</td>
        <td><img src="${item.thumbnailUrl}" /></td>
        <td>${item.name}</td>
        <td>${item.price}</td>
    </tr>
    `;
}
```

The form worked. And I fulfilled the two functionalities i.e. shuffle and sort. However I didn't pass the first round. Because they also asked to think about the performance and avoid any unnecessary reflow and repaint. So I guess the reason I got rejected was because my stuff wasn't great performance-wise. Every time `renderList` is invoked, the whole `tbody` is going to be destroyed and recreated again. 

I hope someone can take a look at it and make some optimizations based on the functionalities it has now. Even though I ended up working at some other big company here in Canada, to this date I'm still wondering how this could be improved.
designing database
Tags: mongodb, database, help, discuss
Published: 2020-03-16 07:15:54

I am new to database architecture though familiar with queries and aggregation in MongoDB.
At present working on a project where I have to store different user depending upon the type/role. There are few fields similar in the user model, would it be correct to create a separate collection for each role or just create separate schema then reference it i.e only a single collection.
In the future, more roles can be added with more information.
Any other approach is welcome.

Below is the mock models
Eg:
*customer = 
{firstname,lastname,email,address,mobileno,password,role}
*sales = {firstname,lastname,email,address,mobileno,password,role,attachments,experience,
education}
*marketting = 
{teamName,email,address,mobileno,password,role,members,attachments}
How to set up NDK in Android Studio ?
Tags: androidstudio, programming, tooling, howto
Published: 2020-03-18 06:31:28

---
title: How to set up NDK in Android Studio ?
published: true
date: 2020-03-16 07:00:00 UTC
tags: Android Studio,Programming,Tooling,HowTo
canonical_url: 
---

Hi dear reader, I’m Xavier Jouvenot and in this article, we are going to talk about how to set up NDK in Android Studio.This is directly related to the blog post about "[Setting up Android Studio with C++ on Windows](https://10xlearner.com/2020/03/16/setting-up-android-studio-with-c-on-windows/)", since this is a problem I faced when installing Android Studio on my machine

## A little bit of context

When syncing your project with Gradle Files, you may have encountered an error stating that you need some version of the NDK (for information, _NDK_ stands for _"Native Development Kit"_). At least, I did, when I first installed Android Studio.

So this post will be available here for anyone facing the same problem or for my future self 😉

## The process

To set up the right NDK for you, you must first know which version of the NDK you want, or have to install.For me, it was easy, because when I sync my project with Gradle Files, the error displayed the version of the NDK required.

Once you have this information, open the SDK Manager by clicking this icon ![](https://github.com/Xav83/Xav83.github.io/raw/master/res/Android%20Studio%20Installation/09%20-%20SDK%20Manager%20Icon.png "SDK Manager Icon"), or in the menu `Tools &gt; SDK Manager`.

On the SDK Manager window, select the SDK Tools tab.

![](https://10xlearner.files.wordpress.com/2020/03/10-sdk-tools.png?w=1016)<figcaption>SDK Tools</figcaption>

(Side note : on this Windows, you can edit the android sdk location if, like me, you are too short on your main C: hard drive)

Now that you are on the SDK Tools tab, you should see a `NDK (Side by side)` checkbox.Before selecting it, you must first select the checkbox `Show Packages Details`, to display all the version available of the packages.And now, you can select the version of the `NDK (Side by side)` that you want.Personally, the version required for me was the version `20.0.5594570`.

## Conclusion

Now, you and I know how to install whatever NDK package we may need in the future, and we know a little bit more about Android Studio.I hope this post helped you a little in your Android Studio journey. 🙂

Thank you all for reading this article,And until my next article, have an splendid day 😉

## Interesting links

- [Setting up Android Studio with C++ on Windows](https://10xlearner.com/2020/03/16/setting-up-android-studio-with-c-on-windows/)
- [How to modify your Android Sdk folder](https://chrisrisner.com/Changing-the-SDK-Path-with-Android-Studio)
- [How to modify your Android emulators folder](https://www.mysysadmintips.com/windows/clients/761-move-android-studio-avd-folder-to-a-new-location)
How to make performance testing?
Tags: performancetesting
Published: 2020-03-16 06:57:05

Performance testing is software testing that focuses on how the system will perform under a particular load. It will give organizations the diagnostic info they need to remove bottlenecks. It's an important aspect of running a web application. In this article, you will find insights and scenarios on software testing from a business point of view. 

How Performance Testing Helpful to Your Business

IT enterprise divided into two divisions: IT and business. Because of this, the whole series of positions present to help these groups communicate. Performance testing is really very important to the business.

 Issues in Performance Testing 
 Anyone working in a software development company understands how bugs and errors on their website can ruin their work. If we have to deal with these bugs, we should have good knowledge about how to fix and confirm that the problem has been fixed or not.
Performance issues usually don't generate any kind of prediction, because they don't directly involve the software behavior. It might occur because the developer has done some mistakes while designing the website or maybe there must be some other reason.

Why You Need Performance Testing

Basically, web testing is a way to tell how the system will behave in different situations. It is the operation of determining the speed, responsiveness, and stability of a computer, software program, network or device under a heavy workload, that is why we need performance testing. We have to deal with some types of performance tests listed below are the major ones.

Process of Performance Testing
Examine and identify the cause of testing
Understand the variety of load situations according to the performance test structure.
Testing the scripts at the API and user interface level.
Implement performance testing
In-depth test result analysis for overall improvement.
Overall <a href="https://www.testingxperts.com/services/performance-testing/">performance testing in Canada</a> is used to authenticate the responsiveness, scalability, reliability and other important feature of application <a href="https://www.testingxperts.com">software testing</a>. It allows us to rectify all the errors before releasing the software.
Lack of default constructor is hurting Go
Tags: go, opinion
Published: 2020-03-16 06:55:01

How many times have you written a factory function just to initialize a struct with proper default value?

For example:

```go
// PagingOption ...
type PagingOption struct {
    Page int
    Size int
}
```

We usually want **BOTH** to have default values. Let's say `page=1&size=25`, but anywhere we want to use `PagingOption` we are either 
1. Write and use a factory function which properly build a `PagingOption`
2. Write and use an `Init` function which properly build a `PagingOption`
3. Instantiate using object literal and fill it with default value
4. Validate `PagingOption` in every consumer and fallback to default value if necessary

---

- Option `1` forces all developer to remember not to use `new(PagingOption)` or `PagingOption{}`.
- Option `2` forces all developer to remember calling `.Init` after initializing `PagingOption`
- Options `3` forces all developer to know what is the agreed default values.
- Options `4` forces all developer to remember checking default value before using the `PagingOption`

All options contribute to human error which can be mitigated just by having a proper constructor.
Sandeep Reddy-Digital Marketing Executive
Published: 2020-03-16 06:38:46

Hey, <a href="https://sandeepreddyl.blogspot.com/">Sandeep Reddy</a> here. I'm working as a Digital Marketing Executive in <a href="https://www.brandnexa.com/">Digital marketing Company</a> at Hyderabad. Having Deep Knowledge of SEO, SMM, SEM During my 5+ years Digital Marketing professional career, I have worked on diverse projects consisting of SEO, <a href="https://www.districtsinfo.com/">Blogging</a>, Copywriting, Local Search Marketing, Lead Generation, Inbound Marketing, Screen Casting, YouTube SEO and more.
If you use a Google Map API Key, don't you need to put it in JavaScript and anybody can see it and use it too?
Tags: googlemap
Published: 2020-03-16 06:34:20

The Google Map API needs an account with billing to be able to try it. That mean we need to have an account with a credit card or with Google Play credit.

But once you try it on a website, doesn't it mean anybody can look at the JS source code and use that API key?  How do you prevent your account from being charge for usage that wasn't yours?
EP27: Data Science, Machine Learning and Artificial Intelligence in that order
Published: 2020-04-03 08:05:57

---
title: EP27: Data Science, Machine Learning and Artificial Intelligence in that order
published: true
date: 2020-03-16 06:29:46 UTC
tags: 
canonical_url: https://anchor.fm/code-cast-zm/episodes/EP27-Data-Science--Machine-Learning-and-Artificial-Intelligence-in-that-order-ebgbs6
---

In this episode, we speak to Data Scientists Sipho Muyangana and Yasin Musa Ayami on the practical use cases for Machine Learning & Artificial Intelligence on society. They explain more on concepts surrounding Data Science, Machine Learning and Artificial Intelligence especially key differences and tools.

**Links and Info:**

- Sipho Muyangana: [LinkedIn](https://www.linkedin.com/in/sipho-muyangana-038242b5/) | [Facebook](https://www.facebook.com/sipho.muyangana.5)[  
](https://www.linkedin.com/in/ACoAAAhye20Baa0EoBkqdOzhHoTGTacCUTpz7MU/?lipi=urn%3Ali%3Apage%3Ad_flagship3_detail_base%3Br70YxQiIShqLFNu%2Bmvy16Q%3D%3D)
- Yasin Musa Ayami: [LinkedIn](https://www.linkedin.com/in/yasin-musa-ayami/) | [Twitter](https://twitter.com/esentialbrother)[  
](https://www.cybersource.com/)

Leave us a review on[<u><strong>iTunes</strong></u>](https://podcasts.apple.com/us/podcast/codecast-zambia/id1442693166?mt=2) to let us know what you think about the show

--- Send in a voice message: https://anchor.fm/code-cast-zm/message