teleren/devto huggingface dataset:
Adding Splash Screen to Trusted Web Activity with Android’s FileProvider
Tags: web, pwa, twa, android
Published: 2019-05-03 15:08:14

---
title: Adding Splash Screen to Trusted Web Activity with Android’s FileProvider
description: Learn how you can add a splash screen to your Trusted Web Activity (TWA) with Android’s FileProvider.
published: true
tags: web, pwa, twa, android
cover_image: https://thepracticaldev.s3.amazonaws.com/i/kz97l9csq3mh0349y65q.jpg
---

> **⚠️ THIS ARTICLE IS MORE THAN 1 YEAR OLD.
Please refer to [this article](https://developer.chrome.com/docs/android/trusted-web-activity/integration-guide/#making-a-splash) on how to add splash screen to Trusted Web Activities.**

---

Learn how you can add a splash screen to your Trusted Web Activity (TWA) with Android’s FileProvider.

## What is Trusted Web Activity?
*Trusted Web Activities (TWA) are a new way to integrate your web-app content such as your PWA with your Android app using a protocol based on Custom Tabs.*

---

⚠️ **This method is NOT production ready, and it only works on Chrome 75+. You have been warned!️** ️️⚠️

---

## Step 1: Add Logo

Add your app logo to the drawable folder (using Asset Studio). In this case, I set the logo size to 96dp and named it `ic_splash`.

![](https://thepracticaldev.s3.amazonaws.com/i/zykq98ygemmc512penhi.png)
<figcaption>drawable/ic_splash</figcaption>

## Step 2: Create an XML file

Create a new XML file in the XML resources folder. In this case, I’m calling it `file_path.xml`.

![Adding "file_path.xml"](https://thepracticaldev.s3.amazonaws.com/i/2g4u63rymki7pwlata12.png)
<figcaption>Adding "file_path.xml"</figcaption>

Then, add the following code to the XML file you just created:

{% gist https://gist.github.com/limhenry/81632cd0236ffe8572e7a89e4da52e9c %}

## Step 3: Update AndroidManifest.xml

Update your `AndroidManifest.xml` file by adding a new `<meta-data>` and `<provider>`:

![AndroidManifest.xml](https://thepracticaldev.s3.amazonaws.com/i/269zfoh39znlrqzob5pu.jpg)
<figcaption>AndroidManifest.xml</figcaption>

## Step 4: Update the Trusted Web Activity Library

Make sure you are using the latest build of Chrome Tabs Client (or at least build 3679335).

Check the latest build here: https://chromium.googlesource.com/custom-tabs-client/+log

You can update the library in the `build.gradle` file:

![](https://thepracticaldev.s3.amazonaws.com/i/ojqqlg0b51z2nri9cbhm.png)
<figcaption>build.gradle</figcaption>

## Step 5: Party Time 🎉

Now you should see your app logo showing in the splash screen. Yay!

![Remote for Slides Lite Splash Screen](https://thepracticaldev.s3.amazonaws.com/i/1kh9iteo8v19i1l2oxn0.jpeg)
<figcaption>Remote for Slides Lite Splash Screen</figcaption>

---

CSS Tricks has an awesome article about how you can implement Trusted Web Activity to your Progressive Web App, you can learn more here:

https://css-tricks.com/how-to-get-a-progressive-web-app-into-the-google-play-store/

---

**Note**: This method is based on the doc from the custom-tabs-client library:

https://chromium.googlesource.com/custom-tabs-client/+/refs/heads/master/customtabs/src/android/support/customtabs/trusted/LauncherActivity.java
MongoDB buys Realm
Tags: realm, mongodb, discuss
Published: 2019-05-03 14:52:04

---
title: MongoDB buys Realm
published: true
description: Highlighting that Realm is in the process of being purchased by Mondo DB - and what the implications of this change of ownership might be 
tags: realm, mongodb, discuss
---
In case you've been living under a rock the past few days you should be aware that MongoDB have agreed to purchase Realm.

Of course Realm and Mongo have published many nice words about each other and about how nothing might change, which is all good stuff.  But as an indie developer who uses Realm I have grave concerns for the databases’ future, especially having been bitten big time by the Parse closure a few years ago.  Fortunately I am not a user of the Realm Cloud (too many security concerns) so I am hopeful that I will be least affected as the future unrolls.

How do you feel?
Are you worried?
Do you use Realm?

There is an FAQ on the Realm forums if you want to read some more.
https://forums.realm.io/t/realm-and-mongodb-faqs/2672
What do you code to relax?
Tags: discuss, life, wellness, coding
Published: 2019-05-03 14:51:31

---
title: What do you code to relax?
published: true
tags: discuss, life, wellness, coding
cover_image: https://thepracticaldev.s3.amazonaws.com/i/xdxn68gfwhpesu4q18ro.jpg
---

My projects have me jumping through hoops of a wide variety of technology, talking to people, writing, and even designing graphics. Sometimes I like to sit down and write something simple, as a way to relax.

Sometimes I find my own code projects to be relaxing. The [MDL](https://github.com/mortoray/mdl/) parser I'm working on now is one of them. I don't have any timelines, nor pressure to get it done.

Oddly, the pressure to get something done is one of the reasons why I [gave up on my programming language](https://mortoray.com/2018/08/07/sadly-i-must-say-goodbye-to-leaf-my-programming-language/). Perhaps it's the size of the project that makes a difference. My MDL project is small in scope and is useful almost immediately.

I used to code on Twitch streams as well. At first, it was relaxing, but I found an audience took that away somewhat. It wasn't stressful, but it wasn't relaxing either. As I coded the bots to fight others, I could feel people depending on me -- it really made no difference how few there were!

But MDL is relaxing, which leads to a problem other workaholics will identify with. Because it's relaxing, that work part of my brain isn't satisfied and continues questioning whether I should work on it, and often doesn't even let me start working on it.  Though, I suppose this is another tale altogether.

Do you code to relax? If yes, then what do you code?
Magento 2 Custom Checkout Fields & Order Attributes Extension
Tags: magento2extension, customfields, customcheckout, checkoutfields
Published: 2019-05-03 12:29:35

---
title: Magento 2 Custom Checkout Fields & Order Attributes Extension
published: true
description: 
tags: Magento 2 extension, custom fields, custom checkout, checkout fields
---
It is sometimes important for Magento 2 store owners to add custom fields to their checkout page in order to collect extra details from customers. These details help them understand the customer's needs and make important business decisions. With the default Magento 2 offering a limited set of standard checkout fields, it is essential to make use of third-party extensions in such a case. These extensions allow adding custom fields of various types to the checkout page along with other features. 

There are 4 steps of a typical Magento 2 checkout page. Shipping Address, Shipping Method, Billing Address, and payment step. A store owner may want to add custom fields to any of these steps depending upon their business requirements. An extension which has this feature will greatly benefit them. Another great feature which any custom checkout fields extension should have is dependable fields. This means that custom fields should be displayed if a particular condition is true. For example, if you want to display a specific custom checkout field when a specific product is added to cart. This is useful when you don't want to display a field all the time. Certain other features should be included in an ideal extension to help you make the best use of the custom fields. 

For this article's purpose, we will have a look at the [Magento 2 custom checkout fields](https://marketplace.magento.com/fme-checkout-order-attributes-fields.html) extension from FMEextensions. This is a widely used and highly useful extension packed with features mentioned above with several others. It is also simple to use, easy to install, comes with 45 days money back & free support and lifetime upgrades. The fact that it is listed on the Magento marketplace proves that it has been developed with Magento coding standards. This extension is a great way to add custom checkout & order related fields. Let's list some key features of the extension.

- Supports 10 types of custom fields for the checkout page (text field, text area, text editor, checkbox, radio button, dropdown, Date, Yes/No, multi-select)
- Supports input validation for Email, URL, Date, Integer number, Decimal number, etc.
- The fields can be displayed in Email & PDF invoices.
- Supports dependable fields
- Fields can be added to any checkout step
- Admins can also sort the order of the fields
- Allows adding a tooltip with every custom field
- Custom fields data is also displayed in order detail page
- Restrict the fields by customer groups & store views

Check Demos:
 
[Frontend Demo](https://mag2-checkout.fmeplugins.net/additionalcheckoutattributes/)       

[Backend Demo](https://mag2-checkout.fmeplugins.net/additionalcheckoutattributes/admin_4ce40dc/)
What was your win this week?
Tags: discuss, weeklyretro
Published: 2019-05-03 13:54:31

---
title: What was your win this week?
published: true
description: Got to all your meetings on time? Started a new project? Fixed a tricky bug?
tags: discuss, weeklyretro
cover_image: https://cl.ly/188e843c2985/download/Image%202019-02-15%20at%202.36.37%20PM.png
---

Time for some reflection ✨

Looking back on your week -- what was something you're proud of?

All wins count -- big or small 🎉

Examples of 'wins' include:

- Getting a promotion!
- Starting a new project
- Fixing a tricky bug
- Cleaning your house...or whatever else that may spark joy 😄

Happy Friday!
Formidable Labs to Start Paying for OSS Contributions
Tags: discuss, opensource, javascript, webdev
Published: 2019-05-03 13:32:45

---
title: Formidable Labs to Start Paying for OSS Contributions
published: true
tags: discuss, oss, javascript, webdevelopment
canonical_url: https://www.iamdeveloper.com/posts/formidable-labs-to-start-paying-for-oss-contributions-2l9l/
cover_image: https://media.giphy.com/media/1pAbbPYxZMeFzvWrGB/giphy.gif
---

An interesting blog post came out today from [Formidable Labs](https://formidable.com). As the blog title says, "Paying Cold, Hard Cash for Open Source Contributions"

This is an interesting endeavour that seems like a win win.

{% twitter 1124000142615568384 %}


They're also encouraging other companies to follow their model.

What are your thoughts on Formidable's OSS initiative?
VueJS Testing Nested Routes
Tags: help
Published: 2019-05-03 12:01:25

---
title: VueJS Testing Nested Routes
published: true
tags: help
---
Hello, I have an app that has bunch of sub routes and I want to test that they are rendered without an error.

##router.spec.js
```
import { mount, createLocalVue } from "@vue/test-utils"
import App from "@/App.vue"
import VueRouter from "vue-router"
import Fullpage from "@/layouts/full-page/FullPage.vue"
import routes from "@/router/routes.js"

const localVue = createLocalVue()
localVue.use(VueRouter)


describe("App", () => {
  it("renders a child component via routing", () => {
    const router = new VueRouter({ routes })
    const wrapper = mount(App, { 
      localVue,
      router,
      stubs: ['vx-card']
    })

    router.push("/pages/login");
    expect(wrapper.find(Fullpage).exists()).toBe(true)
  })
})
```
`expect(wrapper.find(Fullpage).exist())` returns false.

##routes.js
```
// Routes.js
export default [
  {
    // =============================================================================
    // MAIN LAYOUT ROUTES
    // =============================================================================
    path: '',
    component: () => import('../layouts/main/Main.vue'),
    children: [
      // =============================================================================
      // Theme Routes
      // =============================================================================
      {
        path: '/',
        name: 'Home',
        component: () => import('../views/system/Home.vue'),
        meta: { requiresAuth: true, abKey: 'getHome1' }, //! Prevent public access and check if user has access rights or not
      },
      {
        path: '/page2',
        name: 'page2',
        component: () => import('../views/Page2.vue'),
        meta: { requiresAuth: true, abKey: 'postCreate1' },
      },
      {
        path: '/admin',
        name: 'Admin',
        component: () => import('../views/admin/index.vue'),
        meta: { requiresAuth: true, abKey: 'adminMain' },
      },
    ],
  },
  // =============================================================================
  // FULL PAGE LAYOUTS
  // =============================================================================
  {
    path: '',
    component: () => import('@/layouts/full-page/FullPage.vue'),
    children: [
      // =============================================================================
      // PAGES
      // =============================================================================
      {
        path: '/pages/login',
        name: 'pageLogin',
        component: () => import('@/views/system/Login.vue'),
      },
      {
        path: '/pages/error-404',
        name: 'pageError404',
        component: () => import('@/views/system/Error404.vue'),
      },
    ],
  },
  // Redirect to 404 page, if no match found
  {
    path: '*',
    redirect: '/pages/error-404',
  },
];
```
Can anyone help ?
Moving between programming languages
Tags: programminglanguage
Published: 2020-01-05 07:34:51

---
title: Moving between programming languages
published: true
date: 2019-05-03 12:00:47 UTC
tags: programming language
canonical_url: 
---

Recently I’ve been reading the book “Think like a Programmer” by V. Anton Spraul. I decided it would be a good idea to do the coding exercises in all 4 programming languages that I know (PHP, JavaScript, C# and Python) in order to get better at keeping them apart. In many ways, the syntax is very similar, but it’s easy to get tripped up by small differences. You can view the code here: [https://github.com/phil4literacy/coding\_challenges](https://github.com/phil4literacy/coding_challenges)

Here are some things I learned:

Output:

- Javascript doesn’t come with a way to console.log new output to the same line, so I needed to add the output to a variable and print after I created the final output.   
In Python you have to use **print(item, end=””)** in order for the output to be printed on the same line.
- Each language uses a different function name for printing out to the terminal (PHP: echo, JavaScript: console.log, C#: Console.Write, Python: print).

For loops:

- c# needs to have the variable defined (e.g. as string or integer). In Python one uses “range” instead of the counting syntax.

String utilities:

- Repeating a string is done totally different in all languages. In PHP it can be done with str\_repeat(). I like how in Python one can just do print(string \* times).

Classes:

- All 4 programming languages use “class” to declare a class, but methods inside a JavaScript class are not declared using “function”. You simply write the function name.
- To call a method in JavaScript, C# and Python you use a dot, while in PHP you use an arrow.  
C#: myHashDrawing.createHalfX(row);  
PHP: $myHashDrawing-\>createHalfX($row);
- Constructors are created using the same name as for the class in C#. In PHP one uses public function \_\_construct(), in JavaScript it’s constructor() and in Python it’s def \_\_init\_\_(self)
- Python doesn’t use the **new** keyword for creating an object.

Of course, there are a lot more differences and similarities between the languages and sometimes it can take a bit of time to warm up when switching from another language.
How to destructure a variable nested inside an object's array?
Published: 2019-05-03 11:47:18

---
title: How to destructure a variable nested inside an object's array?
published: true
description: I am having the issue below in the image! Could someone help me out with this?
tags: 
---

https://thepracticaldev.s3.amazonaws.com/i/yhyl6hjezy5ctrjqzetm.png
A Little About Me
Tags: frontenddev, developer, dev, intro
Published: 2019-02-25 19:48:40

---
title: A Little About Me
published: true
description: How I got into web dev in a nutshell
tags: front end dev, developer, dev, intro
---
---
![Profile Image](https://thepracticaldev.s3.amazonaws.com/i/gcq4mqt5qzguc276gyju.jpg)I graduated college with a degree in Chemical Engineering with the intention of going to law school and delving into Environmental Law. I had been tinkering with computers since high school and I had started making my own websites when the University provided students with free space. This was pre-2000 so said websites consisted of maybe less than 10 HTML tags.
I took an 8 week course in Unix Administration and C/C++ and figured I'd give that a go while I waited for the next LSAT to come around. But in those 8 weeks I decided that 1. Unix Sys Admin was not my bag and 2. I didn't think going back to law school for 3 more years was my bag either. So when the end of the 8 week course rolled around and they offered resume help and even onsite interviews with several employers, I looked towards web development. I had been making sites on my own time, so why not turn that into a job.
And that began my career in Web Development.


---

Though my first title was "Web Designer" I am most definitely not a designer by any stretch of the imagination.
Somehow "designer" turned into PowerBuilder and ASP and JSP and .Net and Visual Basic and Document Management Systems and Access and SAP and HotDocs and a whole pile of proprietary systems and then finally after many job changes either prompted by myself or by my employer, I found a position doing honest to goodness web development. Whew.
HTML, CSS, and maybe a little JavaScript was where I was meant to be. In my time at that first real web dev job I coded well over 500 websites. Sometimes up to 8 sites a week. And I liked it.


---

When I'm not wrangling code I'm wrangling children (3), cats (3 so far), a dog, chickens (3 so far), ducks (2), and a horse (plus the neighbor's donkey and mini horse). My husband can wrangle himself, though that's maybe why we have a full arcade in our basement. I have had a myriad of hobbies over the years (mounted shooting, knitting, sewing, classic cars, ballet) but let's face it, who has time for hobbies with 3 kids. So right now my favorite hobby is sleeping.
SOLVED: Raspberry Pi Permissions
Tags: raspberrypi, apache, php
Published: 2019-05-03 10:57:00

---
title: SOLVED: Raspberry Pi Permissions
published: true
description: For a non-profit animal shelter, I'm trying to create a web application hosted on an Apache server, all built on a Raspberry Pi.
tags: RaspberryPi, Apache, PHP, HTML
cover_image: https://thepracticaldev.s3.amazonaws.com/i/z3lov0fvm8fv32s5bdfp.jpg
---

Hello folks!

I'm looking for some help with a Raspberry Pi project I'm working on. 

It's a Raspberry Pi 3 Model B+ running Raspbian and Apache server. Everything to do with Apache is up and running - as in I can see the generatde index.html file and edit it in Geany with the gksudo command.

However, my next step is to set up the rest of the web app within the /var/www/html folder. I cannot seem to do this because of permissions. The folder is owned by root and has a group of root. 

I've scoured the web and StackOverflow but can't seem to find any solution that either:
A) is the definitive best practice for security
B) make sense to a Raspbian newbie like me
C) works

I decided to pose my question here. What is a secure way to grant myself editing rights to the /var/www/html folder that doesn't violate security rules? Any sort of explanation that you could offer with regards to what the command is doing too would be very appreciated. I'd like to know what's going on so I can learn from it. XD
Video: Cognitive economy and software design 📹
Tags: cognitiveeconomy, psychology, software, design
Published: 2019-05-03 10:27:46

---
title: Video: Cognitive economy and software design 📹
published: true
description: Some thoughts on how I see the concept of ‘cognitive economy’ relating to how we design our software interfaces and components.
tags: cognitive-economy, psychology, software, design
---

Some thoughts on how I see the concept of ‘cognitive economy’ relating to how we design our software interfaces and components.
Fix speed issue when writing to NAS system
Tags: freebsd, nas, network
Published: 2019-05-03 09:52:53

---
title: Fix speed issue when writing to NAS system
canonical_url: https://tobias-barth.net/blog/Fix-speed-issue-when-writing-to-NAS-system/
cover_image: https://thepracticaldev.s3.amazonaws.com/i/9rxkt1bdo4mv7kdby02r.jpg
published: true
description: 
tags: 
  - freebsd
  - nas
  - network
---

I just fixed an issue with my FreeBSD home server. It is set up as a file server for Mac (AFP) and Linux Clients (NFS). My local network is Gigabit-based sothe limitating factor on read/write speeds should be the hard disk drives in the server.

The server has a Core i3-6100T CPU @ 3.20GHz, 8GB RAM, a ZFS setup with two mirror vdevs each consisting of two disks connected to the board via SATA3. And of course the onboard Gbit NIC (Realtek).

I know very well that write speed was at around 50–60MB/sec, which I would expect. But lately, it dropped amazingly to ~1MB/sec. And I just couldn't think of, why. I suspected the cable, the AFP, the RAM anything.

What I didn't suspect — until today, that is — was the network interface. But I had time today for some googling and even if I didn't found the solution directly, I stumbled across something related to the output of `ifconfig`. So I hacked that into the console and stared at it.

```
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
        ether 4c:cc:6a:b3:3c:f5
        hwaddr 4c:cc:6a:b3:3c:f5
        inet6 fd23:16:7:7::1 prefixlen 64
        inet6 fe80::4ecc:6aff:feb3:3cf5%re0 prefixlen 64 scopeid 0x1
        inet 192.168.10.118 netmask 0xffffff00 broadcast 192.168.10.255
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        media: Ethernet autoselect (10baseT/UTP <full-duplex>)
        status: active
```

Do you spot it? 

```
        media: Ethernet autoselect (10baseT/UTP <full-duplex>)
```

Well, that is … unfortunate. The output of `ifconfig -m re0` gave me:

```
	supported media:
			media autoselect mediaopt flowcontrol
			media autoselect
			media 1000baseT mediaopt full-duplex,flowcontrol,master
			media 1000baseT mediaopt full-duplex,flowcontrol
			media 1000baseT mediaopt full-duplex,master
			media 1000baseT mediaopt full-duplex
			media 100baseTX mediaopt full-duplex,flowcontrol
			media 100baseTX mediaopt full-duplex
			media 100baseTX
			media 10baseT/UTP mediaopt full-duplex,flowcontrol
			media 10baseT/UTP mediaopt full-duplex
			media 10baseT/UTP
			media none
```

So I ran `sudo ifconfig re0 media 1000baseTX mediaopt full-duplex` and it worked. After that I also ran `sudo ifconfig re0 media autoselect` which also set the media type to 1000baseT full-duplex. I have no idea why the system did that wrong (or when) but I will monitor what happens after the next reboot. Maybe I have to do some configuration but maybe it was just an hickup.

Speeds are up to 60MB/sec again.