teleren/devto huggingface dataset:
Area of intersecting circles
Tags: trigonometry, highschoolmath, python, circle
Published: 2018-03-08 11:34:37

---
title: Area of intersecting circles
published: true
description: Calculate area of two intersecting circles given distance between centers, radii of the two circles
tags: #trigonometry, #highschoolMath, #python, #circle
---
A few days ago, my daughters wanted to know how to find out the bounded area of two intersecting circles. This program is an attempt to teach them both Trigonometry as well as computer science. We started off doing only the basic condition when both circles play nice and intersect with the distance between centers parallel to the horizontal axis. Slowly, we extended the code to cater for other cases where the circles only touch at one point, may not touch at all or one circle is completely inside the other circle.

Basically, the input takes three parameters -> the distance between the centers of the two circles and the radii of the two circles in question. The common area is the output of the program.

Looking for ways to make this a more optimal program as I'm new to python.


```python
import sys
import math

# Return the area of the smaller circle
def smallercirclearea(r1, r2):
    radsmaller = min(r1, r2)
    return math.pi * radsmaller * radsmaller

def calcAreaIntersectingCircles(d, rad1, rad2):
    rad1sqr = rad1 * rad1
    rad2sqr = rad2 * rad2

    #if the circle centers are the same
    if d == 0:
        print ('\nCircles have the same center. Intersecting area will be area of smaller circle')
        return smallercirclearea(rad1,rad2)

    angle1 = (rad1sqr + (d * d) - rad2sqr) / (2 * rad1 * d)
    angle2 = (rad2sqr + (d * d) - rad1sqr) / (2 * rad2 * d)

    # Check to see if the circles are overlapping
    if ((angle1 < 1 and angle1 >= -1) or (angle2 < 1 and angle2 >= -1)):
        theta1 = (math.acos(angle1) * 2)
        theta2 = (math.acos(angle2) * 2)

        area1 = (0.5 * theta2 * rad2sqr) - (0.5 * rad2sqr * math.sin(theta2))
        area2 = (0.5 * theta1 * rad1sqr) - (0.5 * rad1sqr * math.sin(theta1))

        return area1 + area2
    elif angle1 == 1 and angle2 == 1:
        print ('\nCircles touch at a single degenerate point and do not intersect\n')
        return 0
    elif angle1 < -1 or angle2 < -1:
        print('\nSmaller circle is completely inside the larger circle. Intersecting area will be area of smaller circle')
        return smallercirclearea(rad1,rad2)
    else:
        print ('\nImaginary touch points\n')
        return -1

#Read the distance and radii from the command line
if len(sys.argv) == 4:
    distance = int(sys.argv[1])
    radiusCircle1 = int(sys.argv[2])
    radiusCircle2 = int(sys.argv[3])
    if distance < 0 or radiusCircle1 < 0 or radiusCircle2 < 0:
        print('Values cannot be negative. Goodbye')
        exit(1)

    print('\nThe intersecting area of the two circles is', round(calcAreaIntersectingCircles(float(distance), float(radiusCircle1), float(radiusCircle2)), 2), 'square units\n')
else:
    print('\nNEED 3 VALUES IN THE INPUT!!\n')
    exit(1)
```
Nevertheless, Lisa Coded
Tags: wecoded
Published: 2018-03-08 11:28:30

---
title: Nevertheless, Lisa Coded 
published: true
tags: shecoded
---

## I began/continue to code because...

I was forced to! At my school, we didn't just learn how to use computers, but how to program them. I think this may have been a fortunate misunderstanding on the part of the school administration ("we must teach the kids computers!"), but it was great. By the time I built my first game (at eleven years old!) I was hooked. You can type commands and the computer will do what you told it to, how cool is that? 

## I recently overcame...

Deployment. If you'd have asked me about deployment a few months ago, that was "someone else's job" and I had only a vague idea of how they were putting my application online. I'm still learning but now I can do it myself! 

## I'm an expert at...

Nothing. Seriously. I'm not a "rockstar programmer", I don't have all the answers, and I don't know anything inside and out completely. And that's totally ok. You don't have to be an expert to code.

## My advice for allies to support women and non-binary folks who code is....

Remember that you're talking to someone who was told that they couldn't do this, that they're not good enough, that this isn't for them. Be compassionate about that, and be supportive, and encourage them when they doubt themselves.
What's the best way to communicate with a Go executable from frontend?
Tags: help, grpc
Published: 2018-03-08 11:16:48

---
title: What's the best way to communicate with a Go executable from frontend?
published: true
description: lul
tags: help, grpc
---

I'm working on a Twitch bot and I want to allow the user to easily configure it without editing config files etc. What technology should I use to create a communication layer between my Go executable and a Vue app? I'm looking at gRPC right now.
How Samsung Phones Secretly Spy On Your Location
Tags: mobilesecurity, samsung, cybersecurity
Published: 2019-06-20 09:17:00

---
title: How Samsung Phones Secretly Spy On Your Location
published: true
tags: mobile-security,samsung,cybersecurity
canonical_url: 
---

While working on a mobile application security project for a client, I had to investigate all HTTPS calls made by an app using a “man-in-the-middle” technique essentially pushing all traffic from the test Samsung Galaxy S5 smartphone through an intercepting proxy. And I stumbled upon something really strange.

Every now and then the phone would send a POST request to the following URL:

[https://ew.disaster-device.ssp.samsung.com/quloc](https://ew.disaster-device.ssp.samsung.com/quloc)

What was interesting was in the payload. This was not a usual POST request, it contained the following 45-byte string:

{“lat”:51.5xxxxx,”lon”:-0.1xxxxxx,”dv”:”01"}

which was the phone’s precise location! I obfuscated the exact digits with xxxx in the above example.

So, it appears that Samsung phones periodically “call home” and report their location to Samsung. Why this data collection happens? I will continue to investigate, but wanted to publish this information in case if somebody else comes across this mysterious “disaster-device” URL.

ThreatCrowd shows a bit more information about the target domain and associated subdomains:

[https://www.threatcrowd.org/domain.php?domain=ew.disaster-device.ssp.samsung.com](https://www.threatcrowd.org/domain.php?domain=ew.disaster-device.ssp.samsung.com)
one week as a develubber
Published: 2018-03-08 07:58:52

---
title: one week as a develubber
published: true
description: 
tags: 
---

I wrote this on 01-21-17, one week after I started calling myself a develubber aka engineer.

##one week as a develubber

Jeff sent me this [blog post] (https://www.vikingcodeschool.com/posts/why-learning-to-code-is-so-damn-hard "blog post"). I got to read it this morning and it made me feel better about my progress over the last week.

In the past week, I read a react book. I think I understood 50% of it. I tried to apply my learning to fixing some bugs in wizard and failed (but learned). And then, I got to apply what I learned about react to help build our new citations feature. 

I got the opportunity to pair with Jeff Tuesday to Friday. I felt like I learned the most during the time spent working with Jeff. I think on the first day I felt that I understood 40% of what we were doing. On Wednesday I felt like I understood 20% of what we were doing. On Thursday because on Wednesday I felt like I was more lost, I was less optimistic. But then on Friday I felt like I understood 90% of what we were doing.

I think one of the biggest things that is holding me back is I don't feel safe with code when Jeff is not around, but that started to change on Friday when we split and we started to work on the same problem in parallel. Yay!

One thing that really helped me was when Jeff showed me how he writes comments outlining breaking down the bigger feature into smaller bite sizes. I believe I fully understand what needs to be executed, I just don't know how to write it in the language of code, in this case javascript.

I think one of the biggest things holding me back is my own self confidence and the fact that I'm not familiar with specific languages. When asked to write an if then statement in javascript, my mind literally pulls a blank. I can explain the concepts of what needs to happen in English, but I cannot translate that English into javascript. I want to work on that. I think if I work on understanding the syntax of specific languages we use, I can get past this problem of self confidence.

My general feeling right now is that I conceptually understand what steps are involved in building the things we try to build, but I lack the foundational knowledge of how all the tools function because of my lack of experience. This is a good thing because I get a good idea concrete steps I can take toward improving my foundational knowledge (e.g. learn javascript syntax, use the CSS resources online to become familiar with common properties used, etc.).

Don't give up. Don't get too discouraged. Keep practicing. Practice makes perfect.
Infographic: 10 Ways to Improve Your Website Design
Tags: webdesign, infographic
Published: 2018-03-08 07:45:33

---
title: Infographic: 10 Ways to Improve Your Website Design
published: true
description: What is a good website design? Let's find out...
tags: web-design, infographic 
canonical_url: https://kolosek.com/10-ways-to-improve-your-website-design/
cover_image: https://thepracticaldev.s3.amazonaws.com/i/y9dpp7zja1i5zrzz3opt.png 
---

Nowadays, a company’s website is similar to the first handshake with someone—it represents the good (or the bad) start of a potential cooperation. However, a handshake is more than a form of greeting.

A handshake establishes trust while giving you the power to diminish the negative first impression. The same thing goes for a website.

**A website should be as strong as a CEO’s handshake.** What does this mean?

No matter the market, companies are becoming more and more competitive and customers/consumers more and more impatient. Your visitors need great content to sweep them off their feet.

In a study *[Web design: A key factor for the website success](https://www.researchgate.net/publication/220419456_Web_design_A_key_factor_for_the_website_success)* from 2009, authors Carlos Flavián, Raquel Gurrea and Carlos Orús put an emphasis on the importance of the website design.

Authors stated that a good website design has **an impact on online consumer's perception and behavior**. Furthermore, authors defined originality and creating a website from demand's perspective as one of the key factors of a website design.

There are many **benefits** of putting an effort into improving your website design:
* customers are able to recognize your brand in all forms of communication,
* building trust among your consumers,
* a chance to differentiate amongst all the other content e.g. use [the gradient](https://kolosek.com/everything-you-need-to-know-about-gradient/).

If you are interested in making a good first impression, be sure to follow these 10 steps.

Want to share this image on your site or/and social media? Just copy and paste the code below.

```
<textarea onclick='this.focus();this.select()' style='width:700;height:400'><p><strong>Please include attribution to kolosek.com with this graphic.</strong><br /><br /><a href='https://kolosek.com/10-ways-to-improve-your-website-design/'><img src='https://kolosek.com/content/images/2018/02/Infographic-main.png' alt='Infographic-website design' width='720' border='0' /></a></p></textarea>
```


Or the horizontal version:

```
<textarea onclick='this.focus();this.select()' style='width:700;height:400'><p><strong>Please include attribution to kolosek.com with this graphic.</strong><br /><br /><a href='https://kolosek.com/10-ways-to-improve-your-website-design/'><img src='https://kolosek.com/content/images/2018/02/Infographic-horizontal.png' alt='Infographic-website design' width='1101' border='0' /></a></p></textarea>
```

![Infographic-website design](http://kolosek.com/content/images/2018/02/Infographic-main.png)

This post is originally published on [Kolosek blog](https://kolosek.com/10-ways-to-improve-your-website-design/).
Nevertheless, Vesna Coded
Tags: wecoded
Published: 2018-03-08 07:39:08

---
title: Nevertheless, Vesna Coded 
published: true
tags: shecoded
---

## I began/continue to code because...

Write your response here!

## I recently overcame...

Write your response here!

## I want to brag about...

Write your response here!

## My advice for allies to support women and non-binary folks who code is....

Write your response here!
Nevertheless, cindy Coded
Tags: wecoded
Published: 2018-03-08 07:06:01

---
title: Nevertheless, cindy Coded 
published: true
tags: shecoded
---

I started coding when I took a CS course during undergrad, but it took me 10 years before I started calling myself an engineer. I should have started calling myself an engineer from the start.

As part of #shecoded I decided that I would publish my private journal entries from when I first started seriously teaching myself to code.

[one week as a develubber](https://dev.to/cindywu/one-week-as-a-develubber--37g1)
[four weeks as a develubber](https://dev.to/cindywu/four-weeks-as-a-develubber--cdj)
[three months as a develubber](https://dev.to/cindywu/three-months-as-a-develubber--335n)

## I began/continue to code because...

science needs more coders to build products that make science move faster.

## I'm currently hacking on...

experiment.com

## I look up to...

people who consistently make time to learn new skills.

## My advice for allies to support women and non-binary folks who code is....

ask us what we need to succeed. Be aware that sometimes the best way to help is to get out of the way.

## My advice for other women and non-binary folks who code is...

if you're just starting, do not give up. Break down your project into the smallest possible parts and tackle one part at a time. Surround yourself with other coders who are supportive and encouraging. When you want to give up, persist. You will succeed if you do not give up.

If you're an expert make yourself available to noobs. Noobs learn from your successes and your failures. Write openly about your experiences for the younger you.

## I'm excited about...

a world where everyone can code. A world where everyone can science.
Sabrina Mokerji, girl who likes to code.
Tags: wecoded
Published: 2018-03-08 06:53:50

---
title: Sabrina Mokerji, girl who likes to code.
published: true
tags: shecoded
---
![image](https://thepracticaldev.s3.amazonaws.com/i/95344ki4zkd4hb1f071i.jpeg)

## What do you do?

I’m a Full Stack Developer for a tech company that creates cloud based software for the mortgage lending industry.

Before this, I worked at an e-commerce company. I worked on 15+ Magento stores. At that time, I worked with the LAMP stack. My focus has since shifted to newer front end JavaScript technologies.

## Why did you start coding?

Writing code is my form of art. I have always been the creative type. I could never draw, but I always had ideas. As soon as I took a web programming class in college, I was hooked. I could finally create what I was envisioning in my head and have it look and function exactly how I imagined.

People may not think that developers are very artistic, but programming is actually a highly creative professsion. It’s logic based creativity.

I love being around so many intelligent minds every day. We are creators. We can take ideas and make them a reality. We can change the future. Possibilities are endless in this field and it’s exhilarating.

## What are you currently learning?

I’m currently diving into using TypeScript with React/Redux. TypeScript has come a long way in a short time and I’m really enjoying what I’ve been learning so far. 

I’m also starting to use Ava for unit testing. I’m hoping to get more into React Native and PWA’s soon.

## Have you ever felt challenged as a female in this field?

The honest answer is yes. I did not experience this until I got further into my career though. At the beginning, people were excited to give me a chance because I was something new and interesting.

Things changed a bit when I began to apply for more senior roles. People were more nervous to trust me. I was something different, something risky. Some people go with what they are comfortable with... but smart people go with raw talent.

If you ever feel like you are not being treated fairly because of your gender, move on. If they don’t see you, someone else will. I promise you that. There are far too many opportunities waiting for you in this industry to be treated like less than you’re worth.

## Any advice for other women or non-binary folks in STEM?

Don’t be afraid to speak up and be yourself! I cannot stress this enough. Doors will open for you when you show the world what you’re made of. 

And some advice to developers of all genders - share your ideas and collaborate with others. Don’t fear the unknown. Challenge yourself. Surround yourself with people who are smarter than you and learn from them. Keep your passion alive!
How good is Meteor when compared to MEAN stack?
Tags: discuss, meteor, express, mean
Published: 2018-03-08 05:57:37

---
title: How good is Meteor when compared to MEAN stack?
published: true
tags: discuss #meteor #express #mean
---
I know it might be an unfair comparison but I see meteor as a better tech to work on for a web application in place of the MEAN stack. It is real-time in nature and to my knowledge it offers more when compared to the MEAN stack. It might have a less learning curve though.

I would like to hear from you people. 🔥

Thanks.
New Attempt on GitHub Pages!
Tags: post, githubpages, github, jekyll
Published: 2018-03-08 17:11:51

---
title: New Attempt on GitHub Pages!
published: true
tags: post, githubpages, github, jekyll
canonical_url: 
---

Life is about adventures and explorations!

JENG JENG~

![](https://cdn-images-1.medium.com/max/387/1*YKUkn4pXb2NmVAFHS5mtQw.png)

### What I did?

As usual, register fo an account, and get your email verified.

Next, follow this step by step

[GitHub Pages](https://pages.github.com/)

#### **_Step 1: Create a repository with the naming format as indicated._**

![](https://cdn-images-1.medium.com/max/1024/1*TRHCHuuX-hLeX5trZHzv6Q.png)<figcaption>Step 1 from Github pages.</figcaption>

![](https://cdn-images-1.medium.com/max/1024/1*Lh4nTvPTNqG7H6teyP9VqQ.png)<figcaption>Warning: Do change your user name or organisation name with dash!</figcaption>

If you need to make a change on the name, do visit [https://help.github.com/articles/changing-your-github-username/](https://help.github.com/articles/changing-your-github-username/)

#### **_Step 2 — 4 : Follow Step 2- 4 as mentioned in_** [https://pages.github.com/](https://pages.github.com/).

**_Clone your repository, create and push your initial page content with the Git client you are familiar with. I used GitX._**

### **ALRIGHT! STEP 5! Hold your breath!**

![](https://cdn-images-1.medium.com/max/1024/1*ZsapO39h7Jv7YlVUfv1xfw.png)<figcaption>Note: Change the path to the username that you set. For my case, https://syaceypyee.github.io</figcaption>

### 3…2…1! Tada!

![](https://cdn-images-1.medium.com/max/768/1*xUVT5xRA4nNXvC0IzaAIhQ.png)

ORZ…

[orz](http://knowyourmeme.com/memes/orz)

### OH NO!! What went wrong?!!

![](https://cdn-images-1.medium.com/max/1024/1*Wivm-dBDbk3VN8SmI8n-BQ.png)<figcaption>No more clues</figcaption>

I did a search on line and found

[My new Github page isn't showing up](https://stackoverflow.com/questions/20895543/my-new-github-page-isnt-showing-up)

Basically you can ignore the comments until the last one!

![](https://cdn-images-1.medium.com/max/821/1*mZ4rId8nxhqtSJ-spH60rw.png)

**\_config.yml is the key!**

### Step to overcome!

So I went back to my repo and go for Settings

![](https://cdn-images-1.medium.com/max/1024/1*NCx6wcGum8AL1aft6r7x2w.png)

**Scroll down further until you reach “GitHub Pages” session, select a theme!**

![](https://cdn-images-1.medium.com/max/794/1*-mSGGXNVIS9KrfU1IGnNTw.png)

And now

### 3…2…1…

![](https://cdn-images-1.medium.com/max/387/1*YKUkn4pXb2NmVAFHS5mtQw.png)

You will eventually found… \_config.yml inside your repo!

![](https://cdn-images-1.medium.com/max/1024/1*Pfx7Wj-8YlGtNVDJZEC73Q.png)<figcaption>Here is our friend!</figcaption>

P/S: I used to use Blogger.com as my testing playground for HTML learning.

The purpose of this attempt is to setup a place for me to jot down my learning progress. Yea, we need to jot and SHARE~

**_Do not bury what you have experience in the past._**

Let’s see what we can do with this. Do share your insights, better options or channel for sharing, if you have any. :)

Happy exploring!

Resources: Github, Stack Overflow
Global helper in React, React Native
Tags: react
Published: 2018-03-08 05:16:19

---
title: Global helper in React, React Native
published: true
description: 
tags: react
---

It is common situation that we would like to define some global functions in any projects.

Without global function, we should write `import` statement every time.

But is this against react philosophy? Don't worry, I found the following code in  the real world project.

```js
// make the i18n function "t" global so we don't have to import it in basically every file
import { t, jt } from "c-3po";
global.t = t;
global.jt = jt;
```

https://github.com/metabase/metabase/blob/ed83df6d939b94b8193601e74676ec32b46a989a/frontend/src/metabase/app.js#L10

I defined a global function `_` (lodash) in current React Native project and I don't have any problems.

# How to

Very easy.

Write this in your bootstrap file (e.g. `app.js`)

```js
import _ from 'lodash'

global._ = _
```


Then you can use `_` everywhere without `import` explicitly.


```jsx
<Text style={styles.title}>
  {_.truncate(someText, { length: 22 })}
</Text>
```

# Tell ESLint

ESLint will regard global function as error. So let's add the following config to `.eslintrc`:


```js
{
  //...
  "globals": {
    "_": false
  },
  //...
}
```


Note that a lot of global functions might cause readability, dependency and testability problems.
Nevertheless, She Coded
Tags: wecoded, womenwhocode, womeninstem
Published: 2018-03-08 05:04:18

---
title: Nevertheless, She Coded 
published: true
tags: shecoded,womenwhocode,womeninSTEM
---

## I began/continue to code because...

When I kept running into the Catch-22 of being unable to hire a tech team to build Click2Fit’s AI software without significant funding, I started learning everything I needed to know to build it myself — from artificial intelligence, cognitive neuroscience, and physics to creating the algorithms and developing the software. Fast forward to the present, and Click2Fit’s about to start beta testing its automated expert recommendation software, and I became a full-fledged software engineer along the way.