teleren/devto huggingface dataset:
Kotlin Firebase Storage – Download Files to Memory, Local File | Android

Tags: kotlin, firebase, android, storage
Published: 2021-05-03 18:45:02

https://grokonez.com/android/kotlin-firebase-storage-download-file-example-to-memory-local-file-android

Kotlin Firebase Storage – Download Files to Memory, Local File | Android

In previous <a href="https://grokonez.com/android/kotlin-firebase-storage-upload-file-data-memory-local-file-stream-android">post</a>, we had known the way to upload data. This tutorial shows you how to download Files to Memory, Local File with Firebase Cloud Storage.

Related Posts:
- <a href="https://grokonez.com/android/kotlin-firebase-storage-upload-file-data-memory-local-file-stream-android">Kotlin Firebase Storage – Upload Data from Memory, Local File, Stream | Android</a>
- <a href="https://grokonez.com/android/kotlin-firebase-storage-get-list-files-example-image-list-firebaserecycleradapter-example-android">Kotlin Firebase Storage – Get List of Files example – Image List with FirebaseRecyclerAdapter | Android</a>

<!--more-->
<h2>I. How to download file</h2>
To use the Firebase Storage to download file, we need:
- add Firebase to Android App & enable Firebase Auth
- create a reference to the full path of the file, including the file name
- download file using <code>getBytes()</code> for in-memory data, <code>getFile()</code> for local file.

To know way to add Firebase Storage to Android App & enable Firebase Auth, please visit previous post:
<a href="https://grokonez.com/android/kotlin-firebase-storage-upload-file-data-memory-local-file-stream-android">Kotlin Firebase Storage – Upload Data from Memory, Local File, Stream | Android</a>

This tutorial bases on the code from that post, and continues with download methods.
<h3>1. Create a Reference</h3>
<pre><code class="language-java">
// From our app
val storageRef = storage.getReference()

// With an initial file path and name
val pathReference = storageRef.child("images/javasampleapproach.jpg")

// To a file from a Google Cloud Storage URI
val gsReference = storage.getReferenceFromUrl("gs://javasampleapproach-storage.appspot.com/images/javasampleapproach.jpg")

// From an HTTPS URL
val httpsReference = storage.getReferenceFromUrl("https://firebasestorage.googleapis.com/v0/b/javasampleapproach-storage.appspot.com/o/images%2Fjavasampleapproach.jpg")
</code></pre>
<h3>2. Download Data using</h3>
<h4>2.1 getBytes()</h4>

More at:

https://grokonez.com/android/kotlin-firebase-storage-download-file-example-to-memory-local-file-android

Kotlin Firebase Storage – Download Files to Memory, Local File | Android
Editing Commit Timestamps in Git
Tags: git, github, terminal
Published: 2021-05-03 18:44:39

I always forget that [GitHub shows commits in a pull request in timestamp order](https://help.github.com/en/github/committing-changes-to-your-project/why-are-my-commits-in-the-wrong-order) rather than tree/history order until just after I've just pushed a monster rebase and everything's in the wrong order. To force GitHub to show the commits in the correct order, we need to edit the commit timestamps to match the history order. To do this:

```
git rebase -i HEAD~N
```

Mark the commits that need re-ordering as `edit`


```
edit f3b9e40 Reticulate Splines
edit 68f39b8 Adjust Bell Curves
edit d605e5a Dice Models
```

At each stage of the rebase:

```
git commit --amend --date=now --no-edit
git rebase --continue
```

Now the timestamp ordering will match the history. When you force-push, GitHub will order the commits correctly in your pull request.
Flatiron Rails module
Published: 2021-05-03 18:24:38

Last week I wrapped up what I will consider the toughest programming challenge yet in all of my time. Learning the material wasnt that bad, but the project was pretty difficult. I ended up building and scrapping applications over and over again, it felt nice to finally build and finish out this project build.
In the middle of the module on project week the Texas winter storm also affected the project build and ultimately leading me to get a transfer due to deadlines, it was pretty unfortunate but it happens, I fit in with my new cohort and picked the material back up just fine. 

Being a former member of the First Robotics Competition back in high school is what infuenced my application. Users log in and can track team activity pretty much anywhere! I am really excited to have done this and I also want my final project to me over FRC as well. On to JavaScript!

-William West
How to Use Unity and echoAR for Body Occlusion [Tutorial]
Tags: unity3d, tutorial, beginners, augmentedreality
Published: 2021-05-03 18:24:34

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/907mjpanzacsrirhe9us.png)

Here’s a great example demo for simple human body occlusion with Unity, AR Foundation, and echoAR. The full demo can also be found on echoAR’s [GitHub] (https://github.com/echoARxyz/Unity-ARFoundation-echoAR-demo-Body-Occlusion).

***Note***: this demo requires an iOS device with A12 bionic chip running iOS 13.

## Register
Don’t have an API key? Make sure to register for FREE at [echoAR] (https://console.echoar.xyz/#/auth/register).

## Setup

* Clone this project and open in Unity.
* Load the PeopleOcclusion scene from the *Assets/Scenes* folder in Unity.
* Set your echoAR API key in the echoAR prefab.
* Add your own images or images from the Images folder to the echoAR console.

## Run
* [Upload] (https://docs.echoar.xyz/quickstart/add-a-3d-model) the images from the Image folder to your project.
* [Build and run the AR application] (https://docs.echoar.xyz/unity/adding-ar-capabilities#4-build-and-run-the-ar-application). Click the *Add Open Scenes* button below *Scenes In Build*. Verify that the *Scenes\PeopleOcclusion* scene is ticked in the *Scenes in Build* list and click *Build And Run*.

## Learn more

Refer to our [documentation] (https://docs.echoar.xyz/unity/) to learn more about how to use Unity and echoAR.

## Support

Feel free to reach out at support@echoAR.xyz or join our [support channel on Slack] (https://join.slack.com/t/echoar/shared_invite/enQtNTg4NjI5NjM3OTc1LWU1M2M2MTNlNTM3NGY1YTUxYmY3ZDNjNTc3YjA5M2QyNGZiOTgzMjVmZWZmZmFjNGJjYTcxZjhhNzk3YjNhNjE).

## Screenshots

![Alt Text](https://miro.medium.com/max/1920/0*y5s62iKzxnXrOD7V.gif)
***

> echoAR (http://www.echoAR.xyz; Techstars ’19) is a cloud platform for augmented reality (AR) and virtual reality (VR) that provides tools and server-side infrastructure to help developers & companies quickly build and deploy AR/VR apps and experiences.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5yohb8n1yut8umhtwsoq.png)
Ruby on Rails web app
Tags: ruby, rails
Published: 2021-05-03 18:20:46

I wrote my first Rails app and it proved to have issues. A certain requirement for this project involved nested routes. Understanding the concept has been a bit difficult for me to grasp, but the longer I've been using it the more it has been making sense. I used a simple three model design with two being has many-to-many relationships which were the `User` model and `Manufacturer`. A `belongs-to` relationship for the `Gun` model to create my join table between both the `User` and `Manufacturer`.

My development workflow seems to go better by writing out code within the controllers and testing to see how the app reacts. While trying to save myself some time by creating helper methods beforehand can have it benefits it has also been the cause of more problems (and time sink) to debug than worthwhile. Needless to say, everything in the first cycle of development has taken awhile due to re-writes from the helpers to controllers and I have learned the valuable lesson of always writing less and testing more.

Creating flash messages have been a thing to go over more times than once and always forgetting to render them in the `application layout` in order to see what it is that I'm doing.

A valuable lesson has been learned during this project and that is mainly with the refactoring. I wasn't too sure on how refactoring was supposed to work nor did I see it's value until this Rails app. To me now, refactoring the repetitive code makes a little more sense considering how often it can be used within views. For example a method that has the potential of being used many time would be `inches_or_mm(gun)` that takes the argument of a gun object to check the caliber and change the input from "40" to "0.40 inches" or 9 to "9 mm". This information is presented to the user clearly what size of bullet would be used with this particular model of gun. Partial forms are something I would like to use more in the future as with the extend of this project had portions that could have more than one form added to each view to bring out the diversity of searching or filtering criteria on a much fuller database.

As far as the database is concerned, I was having difficulty finding a usable endpoint so that I may have a wider range of use with this app, but I think if I were to have access to such resources having an admin role to control more aspects of user experience would enhance a more direct approach to use this as more of a catalog to search through different manufacturers and find a gun that suits a shopper's interest.
Onto a New Flavour of JS. . .
Published: 2021-05-03 18:12:49

---canonical_url: https://tanikadev.hashnode.dev/onto-a-new-flavour-of-js ---
I’ve been learning Javascript for a month now and it's going great but it doesn’t have all the bells and whistles you get with using a framework. So although JS vanilla is lovely I think it’s time to move onto some new flavours in the JS world.

There’s around 24 JS frameworks out there and React.js ranks number one as people’s choice. React is actually a library (it states that right on their homepage) but sometimes it’s referred to as a framework, with that aside, it’s a great next step once comfortable with Vanilla Javascript. Here’s a few reasons why:

1. It’s a small and light package installation and is quick and easy

2. It’s pretty much javascript so the transition is pretty seamless.

3. It’s declarative, you don’t have to state step by step HOW you want something to be performed, you just state WHAT you want to be done.

4. It can reduce your code tremendously.

5. Great for Frontend

6. It’s component based, it allows you to break down your code into components and join them together to create a complex UI. You can reuse components in different parts of your code and change elements within components, as they are separated it doesn’t break your whole code.

7. It’s faster, the use of components and virtual DOM improves performance

8. Uses JSX (javascript syntax extension) which is like writing HTML in JS

9. It is very intuitive; if an error occurs it spells out the issue it found in your code

10. State and state hooks allow you to manage data and render a page when they change. State hooks now allow you to do this in functions and you don’t need to create classes making a lot easier to use.

After using React for only a week it is a breath of fresh air compared to Vanilla JS, my fingers have had a rest from typing so much, it is much easier to write and create code. It’s quicker finding areas of code I need to edit as I just go to the component instead of scrolling through 1000+ lines of code. And updating a page is easy with addition of hooks, useState is a charm. Here’s a link to learn more and try react out reactjs.org
Episode 5: Bojan Reads the Documentation
Tags: agile, scrum, management
Published: 2021-05-03 18:12:30

Garlic sprinkles anyone? The transreality espresso machine has gone on the fritz, and Bojan and Jason are trying to figure out why. Into the madness walks the force of calm that is Anastasiia Tymoshchuk.

Surrounded by tomes of documentation, Anastasiia, Jason, and Bojan chat about everything that can go wrong in an organization, from postmortem blame to zombies in the scrum meeting.

This may also be the genesis of The Daily Planking. (According to our unicorn lawyer, you can't hold us liable if anyone actually implements this!)

Listen now!

{% podcast https://dev.to/bughunters/episode-5-bojan-reads-the-documentation %}

---

Anastasiia's Website: [https://atymo.me/](https://atymo.me/)

Follow Anastasiia on Twitter: [@anastasiatymo](https://twitter.com/anastasiatymo)

[PyBerlin Meetup](https://www.meetup.com/PyBerlin/)

[The Coaching Habit by Dr. Sriram Ananthan](https://bookshop.org/books/the-coaching-habit-the-coaching-habit-workbook/9798664472684)

[The Pomodoro Technique by Francesco Cirillo](https://bookshop.org/books/the-pomodoro-technique-the-acclaimed-time-management-system-that-has-transformed-how-we-work/9781524760700)

[The Zombie Scrum Survival Guide](https://www.zombiescrum.org/)

Music by: [https://audionautix.com](https://audionautix.com)

Sponsored by Softerrific: [https://www.softerrific.com/](https://www.softerrific.com/)
Decorator Pattern in Java
Tags: java, decorator, pattern
Published: 2021-05-03 17:17:37

https://grokonez.com/design-pattern/decorator-pattern-in-java

Decorator Pattern in Java

Decorator Pattern is a <strong>Structural Pattern</strong> in which, functionality can be added to an existing object without changing its structure.

<!--more-->
<h2>I. OVERVIEW</h2>
Decorator Pattern defines one or many Classes that wrap original Class. Everytime we decorate original Class with a Decorator Class, a functionality is added.
<img src="https://grokonez.com/wp-content/uploads/2017/03/decorator-pattern-overview.png" alt="decorator-pattern-overview" width="700" height="226" class="alignnone size-full" />
There is an <strong>abstract Decorator</strong> Class which implements Component interface to get its original <code>operation()</code> function, then each <strong>concrete Decorator</strong> override <code>operation()</code> method to add its own functionality <code>decorate()</code> using instance of original Class <strong>Component</strong>.
<img src="https://grokonez.com/wp-content/uploads/2017/03/decorator-pattern-structure.png" alt="decorator-pattern-structure" width="699" height="509" class="alignnone size-full" />
So, when <strong>Client</strong> wants to add more functionality, it just calls appropriate constructor method corresponding to specific <strong>Decorator</strong>.
<h2>II. PRACTICE</h2>
<h3>1. Project Overview</h2>
At first, a person could buy a new <strong>House</strong>. We give him an option that he can pay more money to add a <strong>Garden</strong> around his house, and then, if he think he should have a <strong>Pool</strong>, we can create it for him.

So we need 2 Concrete <strong>Decorators</strong>: <code>Garden</code> and <code>Pool</code> extending abstract Class <code>HouseDecorator</code>.
<img src="https://grokonez.com/wp-content/uploads/2017/03/decorator-pattern-demo.png" alt="decorator-pattern-demo" width="699" height="504" class="alignnone size-full" />
<h3>2. Step by Step</h2>
2.1- Create <code>IHouse</code> interface and its implementation - <strong>SimpleHouse</strong>:

<strong>IHouse.java</strong>
<pre><code class="language-java">
package com.javasampleapproach.decorator.pattern;

public interface IHouse {

	public String description();
}	
</code></pre>

<strong>SimpleHouse.java</strong>

More at:

https://grokonez.com/design-pattern/decorator-pattern-in-java

Decorator Pattern in Java
The basics of role-based access control (RBAC) in SQLAlchemy
Tags: authorization, python, sqlalchemy, rbac
Published: 2021-05-03 18:01:20

Almost every application will need to control who can do what - and a good way to solve for this is "roles"! Often this is referred to as role-based access control (RBAC). An ‘admin’ is a role, for instance, and so is a ‘moderator’. Roles map very nicely to how we talk about our systems.

To celebrate a new release of [Oso](http://osohq.com), our open-source authorization library, this blog post demonstrates a few ways of modeling role-based access control in Python and SQLAlchemy. It has complex examples to provide you with the building blocks for adding RBAC to your app and are written in a multi-tenant production system. 

[Read the blog post](https://www.osohq.com/post/sqlalchemy-role-rbac-basics) and join[here and checkout our documentation on the new library](https://docs.osohq.com/python/new-roles/install.html)!

If this is an area you’re exploring, we encourage you to join the community of developers in the [Oso Slack](http://join-slack.osohq.com/)! Our core engineering team is also in Slack and is happy to engage and answer your questions.
Grid Template Areas
Tags: devjournal, beginners, css
Published: 2021-05-03 17:53:57

I have a very busy schedule but I try to find some time every weekday to code, commit to Github and learn new skills. I'm currently at the final stage of my Bootcamp, which is focused towards finding a tech job (I'm a career changer which already works on tech but in a different position). To me it is not as fun as learning new code so I keep working on my portfolio to keep learning more code.

Today I stumbled upon grid-template-areas. At first sight I wasn't able to understand it at all... what are those values assigned to that? What does this mean and what is it exactly doing?

So I did a Google search and was presented with the great MDN docs. During the bootcamp I didn't use it at all, but now I understand why developers love it so much. The MDN docs is presented with examples which make it easier to understand what the code is doing and it has a lot of links to related pages. It's very good.

Now it all makes sense, so I was able to change the layout of a portfolio item incredibly fast and easy. I think I'm just grasping the power of CSS Grid and to be honest I'm a bit overwhelmed when I try to think of all the possibilities it offers.

I know I want and will spend time reading more about Grid and I don't understand why it is not used widely since it's browser compatibility is pretty good. All in all I feel like this is an awesome way to layout several elements and that the theory behind it it's harder to understand than to put it in practice.

Photo from https://unsplash.com/@d_mccullough
NodeJS – Save File/Image to MySQL by Sequelize with BLOB type
Tags: node, blob, sequelize, mysql
Published: 2021-05-03 17:50:43

https://grokonez.com/node-js/nodejs-save-file-image-to-mysql-by-sequelize-with-blob-type

NodeJS – Save File/Image to MySQL by Sequelize with BLOB type


In the tutorial, we will show how to build a NodeJS application to save files/images to MySQL database by Sequelize with <strong>BLOB</strong> type.

Related posts:
- <a href="https://grokonez.com/node-js/sequelize-orm-build-crud-restapis-with-nodejs-express-sequelize-mysql">Sequelize ORM – Build CRUD RestAPIs with NodeJs/Express, Sequelize, MySQL</a>

<!--more-->
<h2>Sequelize save file/image to MySQL</h2>
Firstly, we define a Sequelize model for files/images with BLOB type as below:

<pre><code class="language-javascript">
const Image = sequelize.define('image', {

  ...
  data: {
	type: Sequelize.BLOB('long')
  }
});</code></pre>

To read/write data of file/image, we use <code>fs.readFileSync('/path/to/file')</code> and <code>fs.writeFileSync('/path/to/file', image.data)</code> functions of NodeJS file-system module.

Below segment code is used to store file/image to MySQL:

<pre><code class="language-javascript">
var fs = require('fs');

...

var imageData = fs.readFileSync('/path/to/file');

Image.create({
	...
	data: imageData
}).then(image => {
	try{
		fs.writeFileSync('/path/to/file', image.data);				
	}catch(e){
		console.log(e);
	}
})
</code></pre>
<h2>Practice</h2>
We build a NodeJS project as below structure:


More at:

https://grokonez.com/node-js/nodejs-save-file-image-to-mysql-by-sequelize-with-blob-type

NodeJS – Save File/Image to MySQL by Sequelize with BLOB type
Vue.js + Node.js/Express RestAPIs – Mongoose ODM + MongoDB CRUD example
Tags: vue, node, express, mongodb
Published: 2021-05-03 17:34:36

https://grokonez.com/frontend/vue-js/vue-js-node-js-express-restapis-mongoose-orm-mongodb-crud-example

Vue.js + Node.js/Express RestAPIs – Mongoose ODM + MongoDB CRUD example

In this tutorial, we show you Vue.js Http Client & Node.js Server example that uses Mongoose ODM to do CRUD with MongoDB and Vue.js as a front-end technology to make request and receive response.

Related Posts:
– <a href="https://grokonez.com/node-js/crud-restapis-with-nodejs-express-mongodb">Crud RestAPIs with NodeJS/Express, MongoDB using Mongoose</a>
– <a href="https://grokonez.com/frontend/vue-js/vue-router-example-with-nav-bar-dynamic-route-nested-routes">Vue Router example – with Nav Bar, Dynamic Route & Nested Routes</a>

<!--more-->
<h2>Technologies</h2>
– Node.js/Express
– Mongoose

– Vue 2.5.17
– Vue Router 3
– Axios 0.18.0

- MongoDB
<h2>Overview</h2>
This is full-stack Architecture:

<img src="https://grokonez.com/wp-content/uploads/2018/12/Vue-nodejs-express-restapi-mongoose-mongodb-full-stack-architecture-1.png" alt="Vue-nodejs-express-restapi-mongoose-mongodb-full-stack-architecture" width="681" height="243" class="alignnone size-full wp-image-16327" />
<h3>1. Node.js Server</h3>
<img src="https://grokonez.com/wp-content/uploads/2018/12/vue-nodejs-express-restapi-mongoose-mongodb-nodejs-backend-mysql-architecture-1.png" alt="vue-nodejs-express-restapi-mongoose-mongodb---nodejs-backend-mysql-architecture" width="701" height="325" class="alignnone size-full wp-image-16326" />
<h3>2. Vue.js Client</h3>
<img src="https://grokonez.com/wp-content/uploads/2018/12/vue-nodejs-express-restapi-mongoose-mongodb-front-vue.js.png" alt="vue-nodejs-express-restapi-mongoose-mongodb---front-vue.js" width="700" height="334" class="alignnone size-full wp-image-16305" />
<h2>Practice</h2>
<h3>1. Node.js Backend</h3>
- Project structure:

<img src="https://grokonez.com/wp-content/uploads/2018/12/vue-nodejs-express-restapi-mongoose-mongodb-nodejs-project-structure.png" alt="vue-nodejs-express-restapi-mongoose-mongodb---nodejs-project-structure" width="191" height="324" class="alignnone size-full wp-image-16306" />
<h4>Setting up Nodejs/Express project</h4>
Init <code>package.json</code> by cmd:

More at:

https://grokonez.com/frontend/vue-js/vue-js-node-js-express-restapis-mongoose-orm-mongodb-crud-example

Vue.js + Node.js/Express RestAPIs – Mongoose ODM + MongoDB CRUD example