teleren/devto huggingface dataset:
How to check Which Application is Draining Your Battery on Linux
Tags: linux, battery
Published: 2019-04-25 07:24:46

---
title: How to check Which Application is Draining Your Battery on Linux
published: true
description: How to check Which Application is Draining Your Battery on Linux
tags: linux,battery
---


 [Powertop](https://en.wikipedia.org/wiki/PowerTOP)  is a tool to diagnose issues with power consumption and power management to help set power saving settings.

### Installation
#### Arch Linux:

```
sudo pacman -S powertop
```

#### Debian based (Ubuntu, Mint, Raspbian ..etc):

```
add-apt-repository ppa:eugenesan/ppa
apt-get update
apt-get install powertop -y
```

PowerTOP has been installed, you can use the following command to know more about it.

```
powertop --help
```

### Profile battery usages
Following command will generate the HTML file called powerreport.html Open the report in your favorite web browser.

```
sudo powertop --html=powerreport.html
```


![result.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1556126934031/gYALxkPr_.png)

### Tuning

```
sudo powertop
```

The **Tuning** tab of the report shows the actual parameters suggested by the tool to apply to save power

For more information:   [https://wiki.archlinux.org/index.php/powertop](https://wiki.archlinux.org/index.php/powertop) 

This article published on [Hashnode](https://thamaraiselvam.hashnode.dev/how-to-check-which-application-is-draining-your-battery-on-linux-cjuvh57ly000ufls1xyejkmex)
Recommended way to securely connect to a GraphQL endpoint from a frontend application
Tags: nextjs, security
Published: 2019-04-25 06:51:00

---
title: Recommended way to securely connect to a GraphQL endpoint from a frontend application
published: true
description: 
tags: nextjs, security
---

I'd open a thread about a security issue when connecting to a graphql endpoint from a frontend app, due to sharing the token with the client in order to perform queries from the client itself at: https://spectrum.chat/next-js/general/recommended-way-to-connect-to-a-graphql-endpoint-using-next-js~ff2c45d6-626a-4aed-90b7-e590b5fcfa6a

I'm posting here in order to bring some attention from the GraphQL community on this, as Next.js is one of the most famous React frameworks out there and could use some good advices from experienced people. :)
Hi!
Tags: uncategorized
Published: 2022-08-30 21:24:17

---
title: Hi!
published: true
tags: Uncategorized
canonical_url: https://www.meganburleson.com/blog/megan-burleson/
---
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v6w9isovgwvj6a8317nj.png)

Hello! And welcome to the obligatory first post of a brand new blog!

First I will tell you a bit about myself -

I am a graphic designer and web developer residing in Michigan, where I live with my little family. I am a mom of two wonderful kids, and a pet mom of two dogs and two guinea pigs. My husband is also a software engineer - and we both work from home!

I was raised with science fiction movies, books, and video games - and I continue to be a big nerd who's into all of that and I like to bring that into my creative work as well. When I'm not designing and programming websites for clients, I am combining creativity and code to make art and coding fun interactive things.

When I'm not doing that, I am learning new things and leveling up my skills.

Also, feel free to follow me on all the social medias @creativityandcode on most platforms! Say hi!

Thanks for reading, and I'll See you around!
Job Search - Day 6 of 42
Tags: jobsearch, voluntoldvacation, readingrainbow, inboundmarketing
Published: 2019-04-25 04:42:46

---
title: Job Search - Day 6 of 42
published: true
description: Finished book Atomic Habits, inbound recruiting, big day tomorrow
tags: job search, voluntold vacation, reading rainbow, inbound marketing
cover_image: https://thepracticaldev.s3.amazonaws.com/i/udy7tmrsxdewzzh3n41w.jpg
---

I woke up to a missed call from an unknown number
Set up with a local opportunities as an **agile technical coach**

# Inbound Marketing

The best opportunity is one that comes to you
If you were a fishing lure, what value do you promise an employer?

Social media, networks, and conferences are compound investments
The rates compound and take years to reap the rewards
Two minutes today (1%), an atomic habit, is a 37x improvement over a year

![Preening](https://www.sciencealert.com/images/2018-04/BirdofParadise_600.gif)

# Atomic Habits

![Atomic Habits 1](https://thepracticaldev.s3.amazonaws.com/i/v1tus5gv58sybgkmabvc.png)

![Atomic Habits 2](https://thepracticaldev.s3.amazonaws.com/i/q2srxuwfjtubxqxp4a8q.png)

![Atomic Habits 3]
(https://thepracticaldev.s3.amazonaws.com/i/d62badlilhi07d3eoc73.png)

![Atomic Habits 4](https://thepracticaldev.s3.amazonaws.com/i/tn9edscia066w4yhlz6i.png)


# Closure

![Fight Club Walk Out](https://i.gifer.com/1xlV.gif)
Rainforest v.2
Tags: blockchain, opensource, microbitcoin, node
Published: 2019-04-25 04:26:44

---
title: Rainforest v.2
published: true
description: Rainforest v2 will be activated at block height 910000
tags: Blockchain,opensource,MicroBitcoin,node
---

Rainforest v2 will be activated at block height 910000 Estimated for May 2nd, 2019 at 14:00 UTC
Pools, exchanges, and all node holders update your daemon to the latest release


**Node Update**
[here](https://github.com/MicroBitcoinOrg/MicroBitcoin/releases/tag/0.16.6)

**Nomp pool**
[here](https://github.com/MicroBitcoinOrg/NodePool)

Yiimp pool (Work In Progress)
[here](https://github.com/MicroBitcoinOrg/Yiimp)

---
Introduce NoSQL Into Your Legacy LAMP Stack Projects With FireSql
Tags: php, showdev, opensource, webdev
Published: 2019-04-25 03:27:23

---
title: Introduce NoSQL Into Your Legacy LAMP Stack Projects With FireSql
published: true
description: 
tags: php, showdev, opensource, webdev
---

Tired of having to write schema update scripts every time you want to make a change to your MySQL data structure? Or do you have a client on Wordpress and you would like to introduce new data driven features but don't want to take the time to have to create and manage new MySQL tables and schemas to get your new functionality in place?

[FireSQL](https://github.com/ua1-labs/firesql) may be the solution you are looking for!

Within 10 minutes, you can can have FireSQL setup and working within your project. Ready to start interfacing with data objects. Forget about the schemas! Just start inserting objects like this:

    // connect to database
    $dns = 'mysql:host=localhost;dbname=test;port=3306';
    $username = 'username';
    $password = 'password1';
    $pdo = new PDO($dns, $username, $password);
    $db = new Fire\Sql($pdo);

    // get a collection
    $cars = $db->collection('Cars');

    // insert $car objects
    $cars->insert($car);

    // retrieve $car objects
    $fordCars = $cars->find('{"make":"ford"}');

With the latest release of 2.1.0 we've gone through and fully documented all source code and added a detailed README on how to use FireSQL.

Check it out on [Packagist.org](https://packagist.org/packages/ua1-labs/firesql)
How does one go about allowing custom domains to point to your application?
Tags: help
Published: 2019-04-25 03:09:21

I've been mulling over a web application idea and was wondering how does one go about allowing users to set up custom domains to point to their said profile/account on the application?

For example, folks can set up a custom domain or subdomain to point to their Medium account.

I haven't thought through the entire stack yet, but let's say it's either Rails hosted on Heroku or AWS using a static site set up. Is this feasible and how would one go about setting this up?

*Update* I've provided a crude example of what I'd hope to [achieve in this comment below](https://dev.to/michael/comment/abf0).
Testing React Hook State Changes
Tags: react, hooks, jest, enzyme
Published: 2019-04-25 02:08:07

---
title: Testing React Hook State Changes
published: true
description: How to test changes to your React Hook useState using Jest and Enzyme
tags: React, hooks, Jest, Enzyme
---

Edit (2020): I would recommend switching over to react-testing-library, and changing your testing approach to test how your component changes with state rather than that state changed. While this approach works, it is not the ideal solution to the problem. I originally came up with this solution because I started React work using class components and being able to use the enzyme helpers to directly test my values of state against what I expected. With hooks, the testing approach has changed and that is no longer ideal. We should be testing our full component and how the component responds to the state change, not that state has changed.

With the introduction of React Hooks, testing our components state changes is not as straight forward as it used to be. However, it is still possible to test these state changes directly. It just requires a little mocking. 🤠

## Testing state change with a class component

Previously, if you used a React Class Component, you could simply read and manipulate the component state from the shallow object enzyme provides us through shallow rendering.

{% gist https://gist.github.com/agiveygives/b291602f679ab275f5feee0acbd2fd0e %}

## Testing state change with hooks

However, with the introduction of hooks, you can now give state to functional components through [React.useState](https://reactjs.org/docs/hooks-state.html). This means that our enzyme shallow render object will not have a [state()](https://airbnb.io/enzyme/docs/api/ShallowWrapper/state.html) method.

Implementations I've found around this subject before talked about testing the repercussions of changing state. For example, state updates and we test that the displayed count value is what we expect, or we test that a function is called with the correct parameter from state, etc.

Which, I would say is a completely valid way to test your state change. However, it feels like it goes against the isolation we should consider when unit testing. 

If I'm testing my onClick event, all I really care about for my test is that is calls setCount with whatever variable it should. We trust that React works correctly; so, my test shouldn't rely on useState updating my state variable and re-rendering my component for my unit test.

So, why don't we mock it?

{% gist https://gist.github.com/agiveygives/721785723a23fe997ba2df21561f37e3 %}

## Conclusion

With this implementation, we are mocking React.useState to return an Array with the initial value passed to the method and a jest mock function. This will set the states setter to our mock function and allow us to test that it was called with the expected value to set state to.

Pretty neat! Now there is no need for us to dig through props to check that our state gets set correctly. 👌
First!
Tags: introduction
Published: 2019-04-25 01:40:58

---
title: First!
published: true
description: my first post
tags: introduction
---

Hello everyone. Nice to "meet" you all!

I am proficient in vanilla JavaScript and also know some C++. I am currently thinking about learning Kotlin.

Although I don't have anything against frameworks, I rarely use them because I somehow find pleasure in reinventing the wheel over and over again.

If you have any cool (or uncool) projects you need a helping hand with, please reach out!

If you are bored, then why not visit my <a href="https://www.codepen.io/nilkun">codepen</a> page? (Cure for boredom not guaranteed.)
Beautiful Web Apps. Coded in @React
Tags: react, webapps, appseed
Published: 2019-04-24 22:41:13

---
title: Beautiful Web Apps. Coded in @React
published: true
description: Designed by HTML5 Up, LekoArts, Creative-Tim
tags: react, webapps, appseed
---

Index of [6 React Apps](https://react-themes.appseed.us/) designed by amazing teams, coded by ... is not important. **Grab** the code. **Use it** in your next project. **Simple as that**. 


![React Web Apps](https://static.appseed.us/misc/web-apps-coded-in-react.jpg) 


Thank you!
Polycloud Storage in .NET Core
Tags: csharp, dotnet
Published: 2019-04-24 22:32:48

---
title: Polycloud Storage in .NET Core
published: true
description: 
tags: csharp, dotnet
---

Probably every .NET developer is working with some sort of remote storage, being it Azure Blob Storage, Amazon S3 and so on. This can be demonstrated in a comic I've drawn on a commute:

![](https://thepracticaldev.s3.amazonaws.com/i/nsdcjeto1omlcx8fog7k.png)

So I wrote an OSS library that solves this problem, meet [storage.net](https://github.com/aloneguid/storage)

I'm not really sure why there are so many similar storage providers performing almost identical function but no standard. Why do we need to learn a new SDK to achieve something trivial we've done so many times before? I have no idea. If you don't either, use this library.

It provides generic interface for popular cloud storage providers like Amazon S3, Azure Service Bus, Azure Event Hub, Azure Storage, Azure Data Lake Store thus abstracting Messaging, Blob (object store for unsturctured data) and Table (NoSQL key-value store) services.

It also implements in-memory and on-disk versions of all the abstractions for faster local machine development. Connection strings are supported too!

The current list of implementation is good, but growing too

![](https://thepracticaldev.s3.amazonaws.com/i/8108a45sqxopyiu5kzj2.png)
Which piece of code are you most proud of?
Tags: pride, learning, career
Published: 2019-04-24 22:28:10

---
title: Which piece of code are you most proud of?
published: true
description: 
tags: pride, learning, career
---

We sometimes talk about terrible code, especially when we talk about the code we ourselves wrote not too long ago.

But what piece of code were/are you particularly proud of? What did it do? And why are you so proud of it?

I’ll start off.

I’m still proud of writing some JavaScript some years ago, around 2011. There was a search field in a big page full of links (a famous Dutch portal website). This field could not just be used to search using Google but also visually show which links from the page were relevant.

I’m proud of the code because it had to run through a big data structure on every key press and filter out the unnecessary data in it. The first implementation was very slow because it did a lot of DOM operations. For the second version I created a crappy form of what you would now call a virtual DOM, do all operations and then do way less operations, making the feature fast enough for production.
Layout safe areas for iOS in Xamarin Forms
Tags: xamarin, ios, notch, space
Published: 2019-10-13 19:15:55

---
title: Layout safe areas for iOS in Xamarin Forms
published: true
date: 2019-04-24 22:11:08 UTC
tags: Xamarin,ios,notch,space
canonical_url: https://blog.torib.io/2019/04/24/layout-safe-areas-for-ios-in-xamarin-forms/
---

Since the launch of the iPhone X there is a notch at the top of the screen on iOS devices that tend to be annoying to work around. You would have to add some sort of margin to avoid your controls to be overlapped by it. The problem with this approach is that you would have to take into consideration wether or not the phone was in landscape or portrait mode.

![](https://blog.torib.io/wp-content/uploads/2019/04/Screen-Shot-2019-04-24-at-5.57.33-PM.png)<figcaption>Trying to show a label with the text “Some Fancy content”</figcaption>

To avoid these frustrations Xamarin Forms introduces a SafeArea flag that you can set on your Page Layout to ensure it’s content will automatically adjust the margin depending on the orientation of the device.

You can set it with C#

<script src="https://gist.github.com/eatskolnikov/1ce5057eb724fb219369e31d7b214127.js"></script>

Or using XAML, see the ios namespace declared bellow and then how we set the flag right after

<script src="https://gist.github.com/eatskolnikov/9d3a8185f1f0f49808806ece8e208720.js"></script>

And you will get something like this:

![](https://blog.torib.io/wp-content/uploads/2019/04/Screen-Shot-2019-04-24-at-6.11.05-PM.png)<figcaption>The text is at a healthy distance from the notch and you can clearly see it.</figcaption>

One **very important thing** to take into consideration is that you need to set this flag for every **Page** you have on screen. Say for example you have a MasterDetailPage that looks like this:

![](https://blog.torib.io/wp-content/uploads/2019/04/Screen-Shot-2019-04-24-at-5.57.45-PM.png)<figcaption>oh no! both the Master and the detail are being overlapped ):<br></figcaption>

To fix it you would have to set the safe area to both the Mater and the Detail Page as follows:

<script src="https://gist.github.com/eatskolnikov/a7926055194afb510103746ba89c1058.js"></script>

And now it will look like this:

![](https://blog.torib.io/wp-content/uploads/2019/04/Screen-Shot-2019-04-24-at-6.19.19-PM.png)<figcaption>No text is being overlapped! yey!</figcaption>

This is another short one but hopefully very useful. If you liked it please share it on social media or at your local church group if you are into that. I will really appreciate it. Have a good one.

The post [Layout safe areas for iOS in Xamarin Forms](https://blog.torib.io/2019/04/24/layout-safe-areas-for-ios-in-xamarin-forms/) appeared first on [Enmanuel Toribio](https://blog.torib.io).
A Type of Programming
Tags: book, haskell, types, functional
Published: 2019-04-24 22:10:02

---
title: A Type of Programming
published: true
description: 
tags: book, haskell, types, functional
---
I am writing a book called [A Type of Programming](https://atypeofprogramming.com), and I am sharing the first few chapters here. I hope you enjoy them :)
  
The book takes a rather different approach to teaching in that it emphasizes understanding the meaning of programs through types and functional programming. The book doesn't assume any previous programming knowledge from the reader, but it is intended both for newcomers and experienced programmers nonetheless.

As of today, 44 chapters are available for reading, covering the basics of what types and functional programming are about. More chapters will be published regularly.

Let me know what you think :)
To React or Not?
Tags: technology, ethics, choice
Published: 2019-04-24 21:30:47

---
title: To React or Not?
published: true
description: Should I let personal ethics dictate technology choices at work?
tags: Technology, Ethics, Choice
---

We're building a SaaS platform at <a href="https://www.60decibels.com" target="_blank">work</a> and have a choice of JS framework to make.

In my last two roles leading dev teams we had similar choices to make and shortlisted React, Angular and Vue. In both teams, we decided (democratically) to select React as our framework of choice and merrily cracked on with that.

I won't bore you with the reasons why, there are a million posts about which framework to choose, and we referred to some of these, set our own criteria of importance and then reviewed and rated each of the contenders before voting.

But, crucially, this was before Cambridge Analytica, the undermining of democracy and live streaming of murder.

Re: Angular, Google also has issues regarding some of its practices, (maybe this is just a defining characteristic of tech unicorns?), for example regarding content on Youtube, if you can monitor and take down copyright infringing content surely you can monitor content designed to spread hate and fear?

But, is it fair to level criticisms of the creators of these tools and frameworks at the tools and frameworks themselves? To put it another way, can you separate the creator from the creation?

What if we take an analogy from art? Whether or not you consider software development an art form (which is an interesting but wholly different topic, let's leave that for another day, or perhaps a dev discuss?) it doesn't matter for the purposes of this comparison; can you separate Michael Jackson's music from Michael Jackson?

It can be easily argued (especially given the recent documentary) that you can't, and there is a very clear case for boycotting his work, at least not providing further remuneration to his estate for this anyway. (Can you listen to a 2nd hand copy of one of his CDs though?)

Can the same be said for use of a software tool or framework? Even if that tool is open source by using it are you lending support to that software, and so by extension to its creator?

Can, or more importantly, *should* the behaviour and/or practices of the creator of a piece of technology be a criterion for selection of this technology?

And if we do, what weight do ethics have on selection, is this on an even footing with say community support, potential talent pool, extensibility, learning curve, or any other criteria you may choose?

From a purely pragmatic point of view, my head says weigh up the needs of the team, company and users and make the best practical selection, but it doesn't feel right, technology doesn't exist in a vacuum, it is increasingly interwoven in our lives and if we are concerned with improving user's lives through better technology, shouldn't we who are in a position of choice make an ethical one?


What are your thoughts on the ethics of software selection, am I just indulging myself, does this chime with anyone, would love to hear what the community thinks.


Thanks for reading,
James
What's the best way to host small websites for free?
Tags: help, hosting
Published: 2019-04-24 19:12:35

---
title: What's the best way to host small websites for free?
published: true
tags: help, hosting
---

Hello dev community! 👋

I'm working on a fun project where I'll need to host a few .html files and a good number of SVG images. I've been researching GitHub Pages and that seems like a good idea for relatively small sites, but I wasn't sure if that's the best way to go if I have ~1.5mB of SVGs to go along with it.

I'd be very grateful for any ideas or suggestions. Thank you!
Android Jetpack
Tags: androidjavakotlin
Published: 2019-04-24 19:18:51

---
title: Android Jetpack
published: true
description: 
tags: android java kotlin
---
#Android Jetpack (En Proceso...)

>Actualmente las apps que desarrollamos usando Android Studio como IDE y Lenguajes de programación Java o Kotlin. Utilizamos bibliotecas de soporte para agregar todo tipo de Widgets y la compatibilidad en dispositivos Android. Actualmente existen muchas bibliotecas de soporte como por ejemplo: **com.android.support:support-v4, com.android.support:support-v13,** etc.

![alt text](https://thepracticaldev.s3.amazonaws.com/i/tkrqamy5bx2700qsozmq.png "Logo Title Text 1")

>Entonces google ha decido crear un proyecto denominado **Android Jetpack**.
La cual proporciona componentes que forman una forma recomendada para diseñar nuestra aplicación.

>Jetpack se divide en cuatro áreas principales: **Arquitectura , Fundación , Comportamiento y UI**.

#1. Architecture Components
###1.1. Navigation
###1.2. Paging
###1.3. WorkManager
###1.4. Data Binding
###1.5. LifeCycle
###1.6. LiveData
###1.7. Room
###1.8. ViewModel

#2. UI

#3. Behavior

#4. Fundation

[Tutorial para dar formato](https://github.com/adam-p/markdown-here/wiki/Markdown-Here-Cheatsheet)
Securing Gatsby with Auth0
Tags: gatsby, react, javascript
Published: 2019-04-24 19:17:29

---
title: Securing Gatsby with Auth0
published: true
description: Learn how to set up Auth0 for identity management in a Gatsby static site.
tags: #gatsbyjs #reactjs #javascript
canonical_url: https://auth0.com/blog/securing-gatsby-with-auth0/
---

In this article, I'm going to take a slightly different path than our typical authentication tutorial. Ordinarily, I would have you build a sample application that includes styling and a source of data. Because Gatsby orchestrates things like GraphQL, CSS-in-JS, API data, and much more, it's incredibly easy to get lost in the weeds in a tutorial and lose track of what is specific to Gatsby.

[Continue Reading 🛠](https://auth0.com/blog/securing-gatsby-with-auth0/?utm_source=dev&utm_medium=sc&utm_campaign=securinggatsby_auth0)