teleren/devto huggingface dataset:
Daily Challenge #130 - GCD Sum
Tags: challenge
Published: 2019-12-02 15:42:20

---
title: Daily Challenge #130 - GCD Sum
published: true
series: Daily Challenge
description: Given the sum and gcd of two numbers, return those two numbers in ascending order
tags: challenge
---

Given the sum and gcd of two numbers, return those two numbers in ascending order. If the numbers do not exist, return `-1`, (or return `NULL` in C).

*For example:* 
Given `sum = 12` and `gcd = 4`...

`solve(12,4) = [4,8]`. 
The two numbers `4` and `8` sum to `12` and have a gcd of `4`.

`solve(12,5) = -1`. 
No two numbers exist that sum to `12` and have gcd of `5`.

`solve(10,2) = [2,8]`. 
Note that `[4,6]` is also a possibility but we pick the one with the lower first element: `2 < 4`, so we take `[2,8]`.


Good luck.

   

***
_This challenge comes from KenKamau 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!_
Day16:String methods - 100DayOfRust
Tags: rust
Published: 2019-12-02 15:41:16

This article will cover some common methods of String.

Code:

```rust
fn main() {
    // integer to string
    let num = 123;
    let s = num.to_string();
    println!("s is {}", s); 

    // string to integer
    let num2 = s.parse::<i32>().unwrap();
    println!("num2 is {}", num2);

    // join
    let strlist = vec!["hello", "world", "from", "rust"];
    println!("joined: {}", strlist.join(", "));

    // trim
    let s = "  Hello world  ";
    println!("trimmed: {} length: {}", s.trim(), s.trim().len());

    // to lowercase
    println!("lowercase: {}", s.to_lowercase());

    // to upppercase
    println!("uppercase: {}", s.to_uppercase());

    // find
    println!("find e: {:?}", s.find("e"));
    println!("find d: {:?}", s.find("d"));
    println!("find z: {:?}", s.find("z"));

    // start & end with
    let s = s.trim().to_lowercase();
    println!("starts with: {}", s.starts_with("he"));
    println!("ends with: {}", s.ends_with("ld"));

    // replace
    println!("replaced: {}", s.replace(" ", "##"));

    // split
    let splitted: Vec<&str> = s.split(" ").collect();
    println!("Splitted: {:?}", splitted);
}
```

Result:
```
s is 123
num2 is 123
joined: hello, world, from, rust
trimmed: Hello world length: 11
lowercase:   hello world  
uppercase:   HELLO WORLD  
find e: Some(3)
find d: Some(12)
find z: None
starts with: true
ends with: true
replaced: hello##world
Splitted: ["hello", "world"]
```

### Reference

* [&str methods](https://doc.rust-lang.org/std/primitive.str.html)
* [String methods](https://doc.rust-lang.org/std/string/struct.String.html)
* [Converting &str: to_string vs to_owned (with two benchmarks)](https://medium.com/@ericdreichert/converting-str-to-string-vs-to-owned-with-two-benchmarks-a66fd5a081ce)
Motivating interview about one person's Web Dev journey
Tags: career, python, webdev
Published: 2019-12-02 15:22:10

This is an interview by Mahtab and Max with one of the Chingus - Nellie from Michigan. She is a passionate Software Engineer with a lot of enthusiasm and power. She tells us about her adventure in development so far and the dream to improve her life with software development.

https://www.youtube.com/watch?v=3H9wbsz4Y0g
Developing Appreciation
Published: 2019-12-02 15:10:33

# Thank you

In this time of thanks and reflection, it's always good to let people know what they mean to you and how they've improved your life. This post is going to be one of my shorter ones, but I just wanted to take a minute to thank the people and teammates that have made this year a good one. 

First, I have to thank my manager and the entire management team at DealerOn. I can be a bit eccentric and tend to push back on tasks and things that, being the person closest to the work being done, don't make sense to me from a strategic, logistic, or technical debt perspective. At past companies, that behavior was frowned upon and actively discouraged. It wasn't about producing the best work we could, it was just about getting it out on time. Here, my manager and crew respect my drive to do it right and will listen to my reasons if I push back on something. It's not an immediate _"just get it done"_ shutdown, it's a discussion, and that makes me immensely grateful to be working with and for people that will step away from the hard business line from time to time and look at what's best for the road and destination we're traveling towards. 

Second, I need to thank my teammates. You guys keep me honest. It's great to work with people that take time to learn the whats and whys of the work we're doing, and it's great to have people that will push back against _my_ ideas when they disagree. I don't expect that I have the best idea every time, so having people that aren't afraid to say _"well, I think it should be this way, and here's why"_ is paramount for producing the best work we can from our team. You all are talented, motivated, and determined to raise the bar every day, and you do. 

Third, I want to thank my cow-workers (inside joke, puns for days). All of you make coming to work day after day so much more enjoyable. There's an eclectic variety of personalities, interests, experiences, and expressions of life that fill this workspace with so much energy. You all are what makes this a place worth coming to, and one of the reasons I love coming into the office even if I could work from home. 

So, I just want to say thank you to everyone. You help make my days better and I hope I in some way provide the same for you. You help me grow, keep me honest, and provide a worthwhile environment for me to feel like the best me. Thank you.
File Path Handling in D
Tags: dlang, tutorial
Published: 2019-12-02 15:08:32

Working with file paths is very annoying, especially on Windows where it supports both separators most of the time.

Aside from deciding which slash to use there are a couple of areas to consider. 

* Home directory 
* Relative vs absolute

D provides quick work of these. 


[std.path](https://dlang.org/phobos/std_path.html) 

```dlang
import std.path;
buildNormalizedPath("foo/bar/../peas"
            .absolutePath.expandTilde);
```

However trying to build a path by adding slash separators is not the best choice for building a path from variables. 

```dlang 
auto a = "foo";
auto b = "bar";
    
assert([a, b].joiner("/").equal(a.buildPath(b)));
```

And further work can be done on extensions. 

```dlang
assert("file.ext".extension == ".ext");
assert("file.ext".setExtension("gif") == "file.gif");
assert("file.ext".stripExtension == "file");
```
Creating A Document Fragment
Tags: javascript, webdev, string, html
Published: 2019-12-02 14:54:13

---
title: Creating A Document Fragment
published: true
description: Using Vanilla JavaScript, I was looking to simplify some of the general coding patterns that I've used for years. I envisioned something easier than taking an array of some content, converting it to a string, and then including it on the DOM.
tags: JavaScript, WebDev, String, HTML
series: JavaScript Details
cover_image: https://thepracticaldev.s3.amazonaws.com/i/c4ot53tdto2y6rtongrz.png
---

On a recent project, using [Vanilla-JS](http://vanilla-js.com/), I was looking to simplify the general coding patterns I've used for years. I was taking an array of content and converting it to a longer string for inclusion on the DOM.

For example ...

```javascript
var html = [
  '<div>First</div>',
  '<div>Second</div>',
  '<div>Third</div>'
].join('');
```

While this pattern works, to some degree, if there is any nesting it can get rather tedious to deal with.

## Template Literal
## HTML Template
## Wrapping Up

So, here we can see a clear pattern to allow for content to be created and appended as a child to some element.

What is not included is how the string gets converted into an HMTL fragment ...

```javascript
function fragmentFromString (stringHTML) {
  let temp = document.createElement('template');
  temp.innerHTML = stringHTML;
  return temp.content;
}
```

This solution came from the following ...

{% stackoverflow 25214113 %}

## Adding The Document Fragment To The DOM

The final step is pretty straight forward; using ***.appendChild*** to a DOM element allows the fragment to be placed into the DOM.
Use defaultdict() to handle missing keys in a dictionary
Tags: python, backend, programming, data
Published: 2019-12-02 14:45:27


Sometimes you have a bunch of data into a dictionary and you don't know for sure if all the keys will be in there.

... and you'll be handling this with:

```python
data_dict.get('key1', 'missing')
data_dict.get('key2', 'missing')
data_dict.get('key3', 'missing')
data_dict.get('key4', 'missing')
...
...
...
```
In the code above, if any of those keys does not exist in the dictionary it will return a `missing` string.

A better approach for this could be the use of `collections.defaultdict()`


```python
from collections import defaultdict

data = {'name': 'Victor', 'lastname': 'Inojosa', 'year': 1985}

def _get_default_error():
	return "Oops! MISSING"

#data = (lambda: "MISSING", data)
data = defaultdict(_get_default_error, data)

if __name__ == "__main__":
	print(data['name'])
	print(data['gender']) # Oops! MISSING
	print(data['city']) # Oops! MISSING
```

`defaultdict` requires a callable object (a method without invoke). As you can see you could also use an anonymous lambda function to return a simple string.

I hope this could help you in your projects! Bye!
Support for 64-bit Android App Development in DAC for Delphi
Tags: android, delphi, dataaccess, applicationdevelopment
Published: 2019-12-02 14:43:13

---
title: Support for 64-bit Android App Development in DAC for Delphi
published: true
description: Devart introduced updated Data Access Components for Delphi. Besides new versions of RDBMS, they will now support 64-bit Android App Development.
tags: Android, Delphi, Data Access, Application Development
---
*Devart introduced updated Data Access Components for Delphi. Besides new versions of RDBMS, they will now support 64-bit Android App Development.*

Devart, the leading provider of database management software and developer tools, released the new version of its data access components for Delphi. The key feature of the recent update is support for 64-bit Android app development, following the release of RAD Studio 10.3.3 that includes a new Delphi compiler for the ARM platform. 

The update will be of particular use due to the fact that starting August 1, 2019, all the apps published on Google Play need to support Android devices with 64-bit architectures. 

The release also includes such key enhancements as: 

- The support of new versions of RDBMS: PostgreSQL 12 in PgDAC, Oracle 19c in ODAC, and InterBase 2020 in IBDAC.
- The support of the latest Lazarus version 2.0.6, a free IDE for rapid application development using the Free Pascal compiler.
- MySQL and PostgreSQL data providers now support OpenSSL 1.1, a library that implements TLS and SSL protocols to secure communications between a client and a server.
- TLS 1.2 was supported in Direct mode in SDAC. It is a security protocol that provides privacy and data integrity for client-server applications that exchange data over a network.
- Also, the 6-field limitation in the trial version of data access components for macOS and Linux was removed. Users now can execute the test code against a large database to make sure everything works as intended.

Learn more about Data Access Components for Delphi on the Devart official website - https://www.devart.com/dac.html

**About Devart**

Devart is one of the leading developers of database tools and administration software, ALM solutions, data providers for various database servers, data integration and backup solutions. The company also implements Web and Mobile development projects.
For additional information about Devart, visit https://www.devart.com/.
The 7 Most Popular DEV Posts from the Past Week
Tags: top7
Published: 2019-12-02 14:38:35

---
title: The 7 Most Popular DEV Posts from the Past Week
published: true
description: A round up of the most-read and most-loved contributions from the community this past week.
tags: icymi
cover_image: https://thepracticaldev.s3.amazonaws.com/i/sfwcvweirpf2qka2lg2b.png
---
Every Monday we round up the previous week's top posts based on traffic, engagement, and a hint of editorial curation. The typical week starts on Monday and ends on Sunday, but don't worry, we take into account posts that are published later in the week. ❤️


#1. Huzzah

Markus discovers a renewed enthusiasm for Wordpress and shares what you can look forward to with this fun stack. 

{% link https://dev.to/markbloomfield/finding-joy-in-wordpress-again-with-react-gatsby-graphql-303j %}

#2. Motion In Design

In this post, we consider the implications of animation, when and what to animate, and how to be responsible with it.

{% link https://dev.to/iamschulz/animation-for-developers-c4b %}

#3. Passion Projects

Sylwia shares a list of potential projects for new developers to work on - organized by categories: helping others, sustainability, practicality, and social justice. Not your average weather app!

{% link https://dev.to/sylwiavargas/33-app-ideas-for-bootcamp-students-code-newbies-3n28 %}

#4. The Essentials

Andreas shows us how to create CSS animations, define different animation states, use multiple animations and create custom timing functions. 

{% link https://dev.to/devmount/learn-css-animation-by-creating-pure-css-loaders-3lm6 %}

#5. Off The Beaten Path

Erik shares five books with underlying lessons that deserve more recognition. Check them out!

{% link https://dev.to/erikwhiting88/5-great-programming-books-rarely-mentioned-in-great-programming-books-articles-4l5j %}

#6. Power Of Partials

If you're writing TypeScript and you don't know what Partials are...this post is for you.

{% link https://dev.to/nickraphael/typescript-partial-t-where-have-you-been-my-whole-life-4ig4 %}

#7. Single Subjects

Miroslaw share six of their favorite resources on github that focus on single-subject repositories ranging from effective engineering to interview advice. 

{% link https://dev.to/mfarajewicz/6-github-repos-for-instant-knowledge-boost-3mo0 %}

_That's it for our weekly wrap up! Keep an eye on dev.to this week for daily content and discussions...and if you miss anything, we'll be sure to recap it next Monday!_
Emojiflix - I built a React app to try SVG
Tags: react, webdev, showdev
Published: 2019-12-02 14:29:22

Hi reader!

I've been building this simple web app with React over the weekend to see what SVG can do. I'm amazed by how this tech can help us speed development up and the support it has.

This simple website will let you choose from a variety of options to create your own emoji so feel fry to try it.

Here's the url:
https://emojiflix.now.sh

And here you can check the source code:
https://github.com/guidovizoso/emojiflix

_Edit: I've added the ability to download your custom emoji as SVG!_

Want to give it a look and tell me what do you think about it?

Thanks for reading and have a great week!
The programmer mindset; prototype vs production; & staging environment
Tags: todayilearned, programming, beginners
Published: 2019-12-02 14:15:30

*TL;DR style notes from articles I read today.*

### [The programmer mindset: main debug loop](http://bit.ly/34iHMjl)

- What the author calls a ‘main debug loop’ is a natural tendency most programmers develop over time: Write a small piece of code. Run the code. Fix what’s not working. Repeat. 
- Validating small pieces of code you write while you write them (in-application validation) is better for code quality & for speed of the overall project than using only testing as a validation method. 
- However, in many cases this approach may consume a lot of developer time due to the latency in the file system, the runtime loading the change you just made, and your own time interacting with the newly updated application. 
- There is a correlation between large codebases, service architecture, and a retreat to test validation as the primary debug loop. 
- Staging environments can help solve these local machine resource problems, if any, and also alleviate the burden of maintaining a local data set for testing while writing code. 

*[Full post here](http://bit.ly/34iHMjl), 9 mins read*

---

### [Prototyping vs. production development: how to avoid creating a monster](http://bit.ly/35qebV8)

- The ability to rapidly iterate, receive quick feedback, and keep costs relatively low are the three main priorities during the prototype phase.
- Even in the prototype phase, write tests for vital pieces of code. 
- If your prototype starts turning too buggy, slow down and tighten your code. If you are constantly missing deadlines, simplify your code to improve the pace.
- In the production phase, it is all about keeping the user, their needs and their environment in mind. 
- Users want products to be flawless and fast. Have well-defined code standards, review processes, and quality assurance testing process. 
- Be thorough with your documentation if you don’t want considerable code rewrites.

*[Full post here](http://bit.ly/35qebV8), 16 mins read*

---

### [Staging environments are too important to be overlooked: here's why](http://bit.ly/2pLsOTO)

- Data sets tested locally are usually an unrealistic representation of what is in production and can expose users to potentially breaking changes. 
- Staging environments can reduce the errors occurring due to unmet dependencies.
- They reduce the chances of incorrectly merged changes getting deployed to production and save you from potentially rolling changes back or hotfixes.
- They reduce the impact or number of errors in your product and result in indirect cost savings. 
- Using staging environments can result in a higher degree of quality assurance.

*[Full post here](http://bit.ly/2pLsOTO), 7 mins read*

---

*[Get these TL;DR style notes directly to your inbox every weekday by signing up for my newsletter, in.snippets(), here.](https://mailchi.mp/appsmith/insnippets?utm_source=devto&utm_medium=post08&utm_campaign=is)*
Day 16 of⚡️ #30DaysOfWebPerf ⚡️: Image CLI tools
Tags: webperf, images, performance, webdev
Published: 2019-12-02 14:11:41

{% twitter 1201494377522225153 %}

---

This article was originally published on [sia.codes](https://sia.codes/). Head over there if you like this post and want to read others like it, or sign up for my [newsletter](https://buttondown.email/sia.codes) to be notified of new posts!
Reactjs - useEffect
Tags: react
Published: 2019-12-02 14:05:50

Hi, I have some questions about reactjs useEffect hook.

if in my function component I write something like this:

const [myValue, setMyValue] = useState("initialValue");
useEffect(() => { console.log("Call this one time"); }, []);
useEffect(() => { console.log("Call when data changed"); }, [myValue]);

When I render component for first time I get both console logs. But WHY? When I pass empty array react knows that it should execute this callback once. Why it checks passed array values in initial rendering? Now it is not possible to execute second effect only when data has changed...
CSS Grid homepage widget layout
Tags: codepen, css, html, cssgrid
Published: 2019-12-02 13:58:19

<p>Been playing about with CSS Grid; here's a little test of using it for a homepage layout!</p>

<p>This layout will allow you to create a flexible grid based widget layout that snaps down nicely to a mobile friendly stacked layout.</p>

<p>It takes advantage of the fact that CSS Grid can allow elements to flow naturally but also provides some colspan classes to allow content to be positioned easier.</p>

<p>If you wanted you could use media queries to specify different span rules for different resoutions, but this will be largely dependent on your content needs.</p>

<p>Using homapage block elements you can also add different styles to provide different coloured blocks for highlighting call to action areas.</p>

<p>Have fun!</p>

{% codepen https://codepen.io/abeeken/pen/gOOVeWO %}
How A lot Is A Data Scientist's Wage?
Published: 2019-12-02 13:57:20



This is a comprehensive online instructor led course that prepares you for various skillsets required in a Information Scientist profile that embody Statistics, Instruments and Enterprise Expertise. Additionally, publish completion of ExcelR's information science programs in bangalore you do not have to take up any further course because the course curriculum itself is comprehensive and covers all the necessary topics like programming in Python and R, data wrangling, statistics and probability, machine studying fashions with Python, deep learning using TensorFlow, data visualisation utilising matplotlib and tableau and handling Large Knowledge with Spark.

Loads of this is because of the proliferation of self-service infrastructure and tools designed to automate most of the technical however repetitive tasks concerned with knowledge cleansing, preparation and analytics. The demand for Knowledge Science consultants is excessive and is rising each day, which presents our students with incredible profession alternatives within the area of Information Science.Looking for Information Science Certification Training in Bangalore has never been so easy.

Apply elementary knowledge analytics rules, aligning data and enterprise processes to create correct, actionable insights. To Study Live On-line Information Science Training Globally and Data Science Coaching in Bangalore using Class Room enroll right this moment at ExcelR. 4. If the numbers and algorithms intrigue you and you love doing coding, then pursuing data science as a profession option is the most effective resolution to your life.

This programme intends to equip the individuals with applicable data to utilise Information Science as a device and resolution in their area space and stand up in the corporate ladder. Opportunities for data scientists-certainly one of immediately's hottest jobs-are rapidly growing in response to the exponential amounts of information being captured and analysed.

Programs utilised toward undergraduate or graduate degrees at different establishments (non-JHU) aren't eligible for switch or double counting to a Data Science master's degree or put up-master's certificate. Matters :This real-world mission will provide you with a palms-on expertise on the information science life cycle.Data Science That is the half the place machine learning and business acumen comes to use.

For more Information regarding data science course 
https://www.excelr.com/data-science-course-training-in-bangalore