teleren/devto huggingface dataset:
Android ADB Commands (Part 2) Alarms
Tags: android, mobile, testing
Published: 2019-05-04 10:30:26

---
title: Android ADB Commands (Part 2) Alarms
published: true
description: Better product, easier debugging with adb commands
tags: android, mobile, testing
---

# ADB Commands

Previous post: [PART I](https://dev.to/neokleoys2005/android-adb-commands-part-1-3219)

According to documentation:

> Android Debug Bridge (adb) is a versatile command-line tool that lets you communicate with a device. The adb command facilitates a variety of device actions, such as installing and debugging apps, and it provides access to a Unix shell that you can use to run a variety of commands on a device.

[Link for more info.](https://developer.android.com/studio/command-line/adb)


2) Check if alarms are set and when they are scheduled to trigger
> adb shell dumpsys alarm

The command is extremely verbose, I will recommend to filter with grep such as

> adb shell dumpsys alarm | grep com.package.name

**Tip 1:** If you are not going to use **grep** or something similar use **cmd+F** or **ctrl+F** to find your app by searching the package name.

**Tip 2:** If your terminal's buffer size is not big enough, and you are not using the grep command, it might better to output into a file. 

i.e `adb shell dumpsys alarm > AlarmsOutput.txt`

The output looks like: 
```
Batch{28b15ce num=18 start=60346095 end=65172917 flgs=0x8}:

    RTC #17: Alarm{ae74957 type 1 when 1491279601728 com.package.name}

      tag=*alarm*:Alarm_Intent

      type=1 whenElapsed=+11h57m57s410ms when=2019-04-04 07:20:01

      window=+8h59m59s997ms repeatInterval=0 count=0 flags=0x0

      operation=PendingIntent{d1cec44: PendingIntentRecord{d3307ba com.package.name broadcastIntent}}

```
As you can see from above the **when=** tells us when is set to get triggered.

This is extremely helpful for debugging and verifying AlarmManager's behaviour.


An excellent SO answer on **how-to read** the output, [check it out](https://stackoverflow.com/a/31600886/3330058)


Stay tuned for the third part soon!
Maths for Programmers - Rearranging Equations
Tags: maths, equations, pdf
Published: 2019-05-04 09:26:49

---
title: Maths for Programmers - Rearranging Equations
published: true
description: Straight forward instructions on how to rearrange algebraic equations, all wrapped up in a nice free PDF to download. Don't fear maths or algebra again!
tags: Maths,Equations,PDF
series: Maths for Programmers
cover_image: https://thepracticaldev.s3.amazonaws.com/i/4zi8zqlzw8gya9od05v4.png
---

## Become better at maths!
Are you able to write perfectly functional code, but find the language of mathematics somewhat confusing and hard to make sense of? Are you
someone who can look at code like this:

```cpp
int total = 0;
for (int i = 0; i < 10; i++) {
    total += i * 10;
}
```

but have a complete failing of understanding when presented with equations like this ![](https://sausage-factory.games/post/maths-for-programmers-1-rearranging-equations/equation.gif) or can take an equation such
as `speed = distance / time` and use it, but have problems when needing to rearrange the equation to work out the distance travelled?

Me too, and it's annoying. So what I'm doing is (re)learning some basic maths and creating pretty documents explaining it. The first one can be found behind the link below. It explains how to rearrange equations, including how to deal with fractions. Using this should help you in rearranging simple algebraic equations so that they give the answers you need.

As I learn more maths concepts, they'll be turned into PDFs and put up here too. I'm not a mathematician, I'm a programmer so where possible this will be explained with the minimum of maths jargon. I'll translate it into computing jargon instead. However, over time I'm sure the maths jargon will start to make sense.

[![](https://sausage-factory.games/post/maths-for-programmers-1-rearranging-equations/big-thumb.PNG)](https://sausage-factory.games/post/maths-for-programmers-1-rearranging-equations/RearrangingEquations.pdf)

This post has been taken from my website [Sausage Factory Games](https://sausage-factory.games/post/maths-for-programmers-1-rearranging-equations/)
Stop using inline CSS (praise utility classes!)
Tags: css, bootstrap, html, webdev
Published: 2019-05-04 09:08:08

---
title: Stop using inline CSS (praise utility classes!)
published: true
description: 
tags: css, bootstrap, html, webdev
---

You've heard it all before — code-style evangelists preaching from the heavens about `Separation of Concerns` and `Clean Code`. It's often hard to argue with them. HTML is for layout, and CSS for styling. Well, mostly, anyway. So we've collectively decided as a species to stop writing code like this:

```html
<p style="font-weight: bold; text-align: right;" />
```

and this

```html
<div style="display: flex; padding: 1rem; margin: 1rem;" />
```

and this

```html
<img style="border-radius: 50%;" src="cat.gif" />
```

And instead moved to the totally different `UTILITY CLASSES` so our code can look like this!

```html
<p class="font-weight-bold text-right" />
```

and this

```html
<div class="d-flex p-1 m-1" />
```

and this

```html
<img class="img-rounded" src="cat.gif" />
```

I would like to personally thank each and every one of you for your efforts in cleaning up the web and ensuring HTML and CSS never mingle again
Decode StreamBuilder
Tags: flutter
Published: 2019-06-29 16:01:20

---
title: Decode StreamBuilder
published: true
tags: flutter
canonical_url: https://medium.com/flutter-community/decode-streambuilder-e60948629d8e
---

[![](https://cdn-images-1.medium.com/max/901/1*o6UWEkkgUDeXQ25wPzI74g.png)](https://medium.com/flutter-community/decode-streambuilder-e60948629d8e?source=rss-64fbd8c9e171------2)

An in-depth look at Flutter’s StreamBuilder Widget

[Continue reading on Flutter Community »](https://medium.com/flutter-community/decode-streambuilder-e60948629d8e?source=rss-64fbd8c9e171------2)
Introducing Learning Flutter
Tags: flutter, ios, android
Published: 2019-05-04 08:48:40

---
title: Introducing Learning Flutter
published: true
description: 
tags: flutter,ios,android
---



# Introducing [Learning Flutter][1]

I've been using Flutter for the past 6 months developing prototypes and basic mobile applications for fun and to explore this new framework.

Learning Flutter was born from my passion to share this journey and what I learned with others. But why stop there?

Surely there are other people that would like to both learn and share their own tutorials and tips on Flutter. That's why Learning Flutter is open for everyone to [contribute][2].


If you're not familiar with Flutter here's a short introduction on it:

> Flutter allows you to have one codebase and deploy applications to both iOS and Android devices.
>
> > Fundamentally, Flutter is for users that want beautiful apps, with delightful motion and animation, and UIs with character and an identity all their own.

If you're new to Flutter and would like to learn to create your first application with it we have hand crafted an [easy route to follow][3].
If you're instead already familiar with Flutter and want to try something more challenging you can try [building a markdown note taking app from scratch][4].
If you're more interested in learning about [what Flutter brings to the table and why I love it among so many others you might be interested in What Is Flutter and Why Should You Use It?][5].

Let me know if you have any questions or tips!


Learning Flutter is not officially endorsed by or affiliated with Google.

[1]: https://learningflutter.net/
[2]: https://learningflutter.net/contribute/
[3]: https://learningflutter.net/welcome-learn-flutter/
[4]: https://learningflutter.net/flutter-markdown-editor
[5]: https://learningflutter.net/what-is-flutter/
Hamburger Menu in Minimal Javascript
Tags: javascript, html, css
Published: 2019-05-04 08:44:35

---
title: Hamburger Menu in Minimal Javascript
published: true
description: 
tags: javascript, html, css
---

A few minutes ago I posted a tutorial on building a hamburger menu in pure CSS. 
https://dev.to/jacobmparis/hamburger-menu-in-pure-css-mga

While it's a fun experiment and there's a lot to learn following the implementation of it, the truth is that in any production environment you're already going to be using javascript for a large portion of the site.

In that environment, you can get much cleaner code by driving the menu animation with javascript rather than relying on a checkbox and CSS sibling selectors. 

https://codepen.io/anon/pen/YbKjxo

```html
<button id="sidebar__trigger" class="sidebar__button">CLOSE</button>

<ul id="sidebar" class="sidebar">
    <li>Home Page</li>
    <li>Example 1</li>
    <li>Example 2</li>
    <li>Example 3</li>
    <ul>
        <li>Example 1</li>
        <li>Example 2</li>
        <li>Example 3</li>
    </ul>
    <li>Example 1</li>
    <li>Example 2</li>
    <li>Example 3</li>
</ul>

```

We need a basic button with an ID so we can reference it in javascript, and a sidebar with an ID for the same reason. 

```scss
.sidebar {
  background: #333;
  color: white;
  max-width: 200px;
  transition: transform 0.5s;

  &.isClosed {
    transform: translateX(-100%);
  }
  
  &__button {
    width: 300px;
    border: 1px solid #ddf;
    padding: 1rem;
    border-radius: 0.25rem;
  }
}
```

Here the styles are all written in SCSS so we can take advantage of nesting. This saves a lot of repeated code, but requires that we precompile the CSS before serving it to the browser. 

The `&` refers to the parent selector, so once this compiles out the `.isClosed` class will look like this:

```css
.sidebar.isClosed {
  transform: translateX(-100%);
}
```

This class translates the sidebar by its width to the left. Add the class, sidebar hides. remove the class, sidebar appears. Simple!

```js
const sidebar = document.getElementById("sidebar");
const sidebarTrigger = document.getElementById("sidebar__trigger"); 
```

Our first step is to select both of our elements so we can use them in our Javascript.

```js
sidebarTrigger.addEventListener('click', () => {
    if(sidebar.classList.contains('isClosed')) {
        sidebar.classList.remove('isClosed');
        sidebarTrigger.innerText = "CLOSE";
    } else {
        sidebar.classList.add('isClosed');
        sidebarTrigger.innerText = "OPEN";
    }
})
```

Here we add an event listener for the `click` event. Every time we click on the `sidebarTrigger`, the function we specify here will run. 

If the sidebar has the `.isClosed` class, remove it and change the button text to `CLOSE`. Otherwise, add it and change the button text to `OPEN`.

And that's it! CSS handles all the animation and all the javascript has to do is toggle a class.

https://codepen.io/anon/pen/YbKjxo
What if my child wants to become a programmer?
Tags: discuss, healthydebate
Published: 2019-05-04 08:23:07

---
title: What if my child wants to become a programmer?
published: true
description: What if my child wants to become a programmer? Thoughts about how we have the responsability to build a better IT world for our kids of tomorrow.
tags: discuss, healthydebate
cover_image: https://thepracticaldev.s3.amazonaws.com/i/2ob9imdlunkq0crp13s9.jpg
---

I often look into my son's eyes, staring at them completely fallen in love. No surprise though; that's my beautiful child and of course i wish him all the best: a good life, good friends, a true love and, possibly, a good job.

**But hey, what if my child wants to become a programmer?**

![sada](https://media.giphy.com/media/l0CRCmMBYQbL7dCmI/giphy.gif)

Maybe it's too early to answer a question like this, just because within almost 20 years our IT world will probably be shaken from the grounds. Maybe the Web will be completely tranformed, but one thing i know for sure: there will be programmers. Lots, of programmers.

And just because of that i think that we now have the responsability to build a better IT world for our kids of tomorrow, even becoming more responsable and aware that what we do today, as coders, will have an impact on the society of tomorrow.

The question, however, still remains: would you recommend this job to your child? Will you maybe discourage him? And also, don't you think we should start judging software, tools and programming languages based on their potential impact on the future rather than on immediate needs, acknowledging some sort of social responsibility on what we do?


Just `let` me know DEV people :)

---

*This article was written while listening to* [La Casa Elettrica #01](https://soundcloud.com/lucagrandicelli/sets/la-casa-elettrica-01).{% soundcloud https://soundcloud.com/lucagrandicelli/sets/la-casa-elettrica-01 %}

*Cover image by* [Paul Nong](https://www.artstation.com/artwork/0XnQlE)
What the heck is certificate issue that messed up our add-ons
Tags: firefox, addons, mozilla
Published: 2019-05-04 08:18:28

---
title: What the heck is certificate issue that messed up our add-ons
published: true
description: What the heck is certificate issue that messed up our add-ons
tags: firefox, add-ons, mozilla
---
![Firefox Error](https://thepracticaldev.s3.amazonaws.com/i/koanfbmbynyti6r74xrh.png)
Firefox enables user to install add-ons so as to increase the utility. Firefox ensures that the add-ons(which are basically third party code) are reviewed and signed (with a Mozilla certificate). These signed add-ons are available on addons.mozilla.org and also can be hosted on developers website. Now once you install the add-on in the Firefox, it looks for the certificate and allows only those add-ons which are signed by known Mozilla certificate. Rest every add-on is shown as corrupt.

Unfortunately the certificate is expired for now and hence all add-ons show as corrupt, Firefox add-ons team is working on it as of now and soon we will have a fix. [Bugzilla entry](https://bugzilla.mozilla.org/show_bug.cgi?id=1548973)

Follow this twitter thread for the fix progress (mozamo)[https://twitter.com/mozamo/status/1124484255159971840]

As a really quick workaround you can try ideas on [this reddit thread](https://www.reddit.com/r/firefox/comments/bkhtv8/heres_whats_going_on_with_your_addons_being/?utm_source=share&utm_medium=web2x) but obviously these should be temporary!

*Update*
#amoFixed 😎😎😎
https://twitter.com/mozamo/status/1124627930301255680
Twitter Mini
Tags: javascript, electron, twitter, desktop
Published: 2019-05-04 07:58:41

---
title: Twitter Mini
published: true
description: 
tags: javascript, electron, twitter, desktop
---

Multi-platform Twitter Client built with Electron

https://github.com/dongri/twitter-mini

<img src="https://thepracticaldev.s3.amazonaws.com/i/ncf0o12svao8n2g74fhm.png">
Three quick tips when setting up a new node with Chef Infra!
Tags: devops, sre, chef, infrastructure
Published: 2019-05-04 07:55:54

---
title: Three quick tips when setting up a new node with Chef Infra!
published: true
description: Learn three quick tips when setting up a new instance with Chef Infra.
tags: devops, sre, chef, infrastructure
cover_image: https://thepracticaldev.s3.amazonaws.com/i/y4nahzc2zboi8pd4f29i.jpg
---

I was helping someone this evening with setting up a new node with Chef Infra. I wanted to document this so that if someone else experienced a similar problem, it might be a bit easier to understand what's going on.

## ⭐ **Tip 1** Ask for help when you get stuck.
 
The problem statement was "trying to pass a JSON file to chef-zero for extra attributes." The command in use was [chef-client](https://docs.chef.io/ctl_chef_client.html). 

> Folks might not know the exact terminology in use by a product so it can be hard to figure it out without guidance. Folks with expertise may be able to give you more insight with the right terminology. 

To make sure I understood what the person was looking for, I asked clarifying questions. The answers to those questions helped me understand that this was setting up a new instance or [bootstrapping](https://docs.chef.io/install_bootstrap.html). While the [chef-client](https://docs.chef.io/ctl_chef_client.html) page has helpful information, it isn't as specific and direct as the [bootstrapping page](https://docs.chef.io/install_bootstrap.html).

## ⭐ **Tip 2** Don't pass -o and -j both to chef-client.

_-o_ overrides the run_list, and _-j_ is how you specify a file that includes the recipes and attributes that you want to run. So instead of using both -j and -o, we took the configuration specified after -o and added it to the JSON file.

## ⭐ **Tip 3** The JSON file has a particular format that shouldn't look like a standard attribute file.


Within the node attributes file, attributes look like `node['resolver']['nameservers']`. So this:

```
{
	"node['resolver']['nameservers']": ["10.0.0.1"],
	"node['search']": "http://sparkle.corp",
	"run_list": ["recipe[resolver]"]
}
```

is valid JSON and looks close to the appropriate configuration within the node attributes definitions. It will even successfully be accepted but won't have the expected behavior. No errors will point you to the problem with the JSON file on converge.


Instead, the JSON file should look like this:

```
{
	"resolver": {
		"nameservers": ["10.0.0.1"],
		"search": "http://sparkle.corp"
	},
	"run_list": ["recipe[resolver]"]
}
```

That's all for now!
RFv2 v0.16.7.1 Update Patch Released
Tags: mbc, blockchain, update
Published: 2019-05-04 05:25:06

---
title: RFv2 v0.16.7.1 Update Patch Released
published: true
description: Reminder to update to the latest version 0.16.7.1
tags: mbc, blockchain, update
---


This is a reminder to update all nodes to the latest patch released, v0.16.7.1 which can be found [here](https://github.com/MicroBitcoinOrg/MicroBitcoin/releases/tag/0.16.7.1).

For more details on the update, please see the [wiki thread](https://mbc.wiki/d/27-rfv2-upgrade-notes).
Using RubyVM::AbstractSyntaxTree.of in pry
Tags: ruby
Published: 2019-05-04 04:27:34

---
title: Using RubyVM::AbstractSyntaxTree.of in pry
published: true
description: 
tags: Ruby
---

Put following snippets to `~/.pryrc`

```ruby
unless defined?(SCRIPT_LINES__)
  SCRIPT_LINES__ = {}
end

Pry.config.hooks.add_hook(:before_eval, :"ast<3") do |code, _pry|
  SCRIPT_LINES__["(pry)"] = code.lines
  code
end
```

It works, yay!

```
% pry
[1] pry(main)> RubyVM::AbstractSyntaxTree.of(-> { puts :hi })
=> (SCOPE@1:32-1:45
 tbl: []
 args:
   (ARGS@1:32-1:32
    pre_num: 0
    pre_init: nil
    opt: nil
    first_post: nil
    post_num: 0
    post_init: nil
    rest: nil
    kw: nil
    kwrest: nil
    block: nil)
 body: (FCALL@1:35-1:43 :puts (ARRAY@1:40-1:43 (LIT@1:40-1:43 :hi) nil)))
[2] pry(main)>
```

I also wrote a irb version, including how `RubyVM::AbstractSyntaxTree.of` uses `SCRIPT_LINES__`.
https://dev.to/okinawarb/how-can-i-use-rubyvm-abstractsyntaxtree-in-irb-m2k

Enjoy AST!
Don't Forget to Take Breaks
Tags: breaks, health, rest, breathe
Published: 2019-05-04 00:54:09

---
title: Don't Forget to Take Breaks
published: true
description: "You and your health are important. If you want to do your job effectively, make sure you're taking breaks."
tags: breaks, health, rest, breathe
cover_image: https://firebasestorage.googleapis.com/v0/b/ashleemboyer-2018.appspot.com/o/images%2Fbreaks.jpg?alt=media&token=c7014483-5733-4088-9d89-dc07733f3e59
canonical_url: https://ashleemboyer.com/don-t-forget-to-take-breaks
---

*This post is also over on [my personal blog](https://ashleemboyer.com/don-t-forget-to-take-breaks).*

Do you want to know what I most often forget to do when I'm working really hard? *I forget to eat.* That's a funny thought at first. Like, how do you forget something so vital to your existence? (I have zero ideas, so please tell me if you know the answer. My stomach will appreciate it.)

My point is, I get it. It's hard to take breaks and for various reasons. We often feel a ton of pressure to get all of our work done as quickly as possible. Guess what? It's never done. Ever. If you work in a food service business, there are always people wanting food. If you work on a support call line, there are always people needing help. If you write software for a living, there are always people asking for more features or telling you how you need to do better.

What do these examples have in common? They're focused on other people. Most of us are happy giving our time and effort to others and we don't want to let them down. If you're like me, you try your hardest to keep everyone happy, and might even put others' happiness and well-being before your own.

Let's do less of that. Take care of yourself too. It's not one bit selfish to take the time you need to do whatever it is that'll help you refresh (as long as you aren't hurting anyone or yourself!). You'll be in much better shape to do you your job effectively.

Here are a few of my own suggestions you might want to try when you need a break:
- Take a 5-minute walk outside or around the office
- Stand up and do a few stretches by your desk
- Have a snack (or the meal you forgot about 😅)
- Spend a few minutes just focusing on your breathing
- Drink a glass of water or a cup of tea

If you have any of your own suggestions you'd like to share, please do leave them in the comments or [send me a tweet](https://twitter.com/ashleemboyer).

---

Did you know I have a newsletter? 📬

If you want to get notified when I publish new blog posts or make major project announcements, head over to [https://ashleemboyer.com/newsletter](https://ashleemboyer.com/newsletter).

---

*[Image](https://unsplash.com/photos/uy5t-CJuIK4) by [Kate Stone Matheson](https://unsplash.com/@kstonematheson) on [Unsplash](https://unsplash.com).*
Oh My Zsh prompt theme for Windows Powershell!
Published: 2020-09-16 01:33:18

---
title: Oh My Zsh prompt theme for Windows Powershell!
published: true
date: 2019-05-04 00:00:00 UTC
tags: 
canonical_url: https://luisramos.dev/windows-powershell-oh-my-zsh
---

I do most of my programming in my mac these days, but once in a while my gaming desktop becomes the testground for some code bashing. Since I use git on the terminal, on windows I use powershell instead of a sweet zsh shell.

Working with powershell is not that bad, but I terribly miss not having the git branches on my prompt. Since I really enjoy the [Oh My Zsh](https://ohmyz.sh/) theme on my Mac, here’s a snippet that changes your power shell prompt!

```
function prompt {
\$ESC = [char]27

$p = Split-Path -leaf -path (Get-Location)
  $branch = $(git symbolic-ref -q HEAD) -replace "refs/heads/"
  if ($branch) {
$branch = "$ESC[34mgit:($ESC[0m$ESC[31m$branch$ESC[0m$ESC[34m)$ESC[0m "
}

"$ESC[1m$ESC[32m$([char]0x279C)$ESC[0m $ESC[36m$p$ESC[0m $branch\$ESC[0m"
}
```

This code lands in the `$profile` file, which probably needs to be created:

```
new-item -itemtype file -path $profile -force
notepad $PROFILE
```

Notepad should open up and you can copy paste the snipped there!