teleren/devto huggingface dataset:
Where should API calls to third-party services live in a Ruby web app?
Tags: ruby, webdev, discuss, rails
Published: 2022-02-02 05:24:10

I saw [this question](https://www.reddit.com/r/rails/comments/si6qlk/question_i_want_to_make_an_api_call_to_an/) asked on [r/rails](https://www.reddit.com/r/rails/) on reddit.

Depending on when you asked me over the past 10 years, I probably would've had 10 different answers.

But lately, I have a new answer to this question and it was inspired by a post called [Screaming Architecture](https://blog.cleancoder.com/uncle-bob/2011/09/30/Screaming-Architecture.html) by Uncle Bob over at the [Clean Coder Blog](https://blog.cleancoder.com/). Again props to my main man @thorncp for telling me about this article.

The post can be summarized as saying each set of domain or business logic should have its own top-level directory in your repo. For example, for a To-do List app, you'd probably have something like:

 - /items
 - /lists
 - /sessions
 - /users

I'm not sure I believe this architecture would be great for a full application. Hell, maybe it would, but it would be entirely too much work to even _try_ to refactor the legacy codebase I'm working in to something like this.

However, I did find a great use-case for it: external third-party APIs. We recently moved ALL of the code for a couple of our third-party integrations to their own directory under `lib/`.

In my opinion, this ended up astonishingly better than the organization of the integrations we had beforehand.

## What's it look like, anyway?

Let's say I have a third-party integration called Blockfires. Here's how we organized their code:

```ruby
# call the third party's event creation endpoint
lib/blockfires/services/event/create.rb

# call the third party's transaction index and load them in the background
lib/blockfires/workers/transactions/historical_load.rb

# parse an incoming webhook
lib/blockfires/webhooks/transactions/parse.rb

 # the object the previous line parsed
lib/blockfires/webhooks/transaction.rb
```

Now, when I'm looking for Blockfires code, I know exactly where it's gonna be. No looking around wondering if we have a certain type of worker, what the webhook file is named, or what API calls are available. It's all right there: in its own `lib` directory.

Personally, it's 2022, and I'm loving it. I don't think this is limited to Ruby apps. I think you could apply it to a lot of different types of codebases and languages.

If you ask me about this in a couple years, I may have deleted the lib folder and thrown my computer in the trash can. Who knows? Opinions change so fast in software, but right now, I think this is a good one.
Argon Dashboard Laravel - Free Product
Tags: laravel, opensource
Published: 2022-02-02 05:05:46

Hello! 

This article presents an `open-source` **Laravel Starter** crafted and released for free by Creative-Tim. [Laravel Argon Dashboard](https://www.creative-tim.com/product/argon-dashboard-laravel?AFFILIATE=128200) can be downloaded from Github without a registration lock and used for commercial products or simply for eLearning activities. For newcomers, **Laravel** is a leading framework powered by PHP and many open-source enthusiasts across the globe.

> Links & Resources

- 👉 [Laravel Argon Dashboard](https://www.creative-tim.com/product/argon-dashboard-laravel?AFFILIATE=128200) - product page
- 👉 [Laravel Argon Dashboard](https://www.creative-tim.com/live/argon-dashboard-laravel?AFFILIATE=128200) - LIVE Demo
- 🎁 More [Free Templates](https://bit.ly/3wd5D25) provided by `Creative-Tim`

**Argon Dashboard** is built with over 100 individual components, giving you the freedom of choosing and combining.

--- 

> *Disclosure* - **This post contains affiliate links**. 

If you use these links to buy something (no additional cost to you) I may earn a commission, product, or service. **Thank you!**

---

![Laravel Argon Dashboard - User Profile Page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j6gv9xgd7y6hzpsjkj1h.png)

---

Argon is a completely new product built on our newest re-built from scratch framework structure that is meant to make our products more intuitive, more adaptive, and, needless to say, so much easier to customize

---

![Laravel Argon Dashboard - Maps Page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fpaa7887ghkhxsmo25a6.png)

---

This Dashboard is coming with pre-built examples, so the development process is seamless, switching from our pages to the real website is very easy to be done. Every element has multiple states for colors, styles, hover, focus, that you can easily access and use.

---

![Laravel Argon Dashboard - Data Tables](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0vnub7va7bf4oez3epb9.png)

---

![Laravel Argon Dashboard - Sign IN Page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tfcbq5dya07jrwjby6z5.png)

--- 

> *Thanks for reading!* For more resources, feel free to access:

- ✨ More [Free Dashboards](https://appseed.us/admin-dashboards/open-source) crafted in Django, Flask, and **React**
- ✨ More [Admin Dashboards](https://www.admin-dashboards.com/) - a huge index with products
Soft UI React Native - Free Product
Tags: react, softui, opensource
Published: 2022-02-02 04:55:45

---
title: Soft UI React Native - Free Product
published: true
description: Open-Source React Native starter crafted and released for free by Creative-Tim on top of Soft UI Design pattern.
tags: react, softui, opensource
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4yp6u9v8okc482ir4nhs.jpg
canonical_url: https://www.ui-themes.com/soft-ui-react-native-open-source/
---
Hello Coders!

This article presents an open-source **React Native Starter** crafted and released for free by `Creative-Tim`. [Soft UI React Native](https://www.creative-tim.com/product/soft-ui-react-native?AFFILIATE=128200) is a fully coded app template that can be downloaded from Github and used for commercial projects or eLearning activities. For newcomers, **React** is a leading JS library for coding user interfaces baked by Facebook.

---

> *Disclosure* - **This post contains affiliate links**. 

If you use these links to buy something (no additional cost to you) I may earn a commission, product, or service. **Thank you!**

---

![Soft UI React Native - Mobile View ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7sjnksx4yzmgnpwf0qg4.png)

---

`Soft UI React Native` features over 100 variations of components like buttons, inputs, cards, navigations, giving you the freedom of choosing and combining. All components can take variations in color, that you can easily modify inside our theme file.

If you want to get inspiration or just show something directly to your clients, you can jump-start your development with our pre-built example screens. From onboarding screens to profile or discover screens, you will be able to quickly set up the basic structure for your React Native mobile project.

---

![Soft UI React Native - Sample Screens](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g0a8tyom6o0o5vxr4tdz.png)

---

`Soft UI React Native` comes packed with a large number of components and cards. Putting together a mobile app has never been easier than matching together different components.

From the profile screen to a settings screen, you can easily customize and build your screens. We have created multiple options for you to put together and customize into pixel-perfect screens.

---

![Soft UI React Native - Dark-Mode Ready](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jr181i4kvtysnwfs7t0p.png)

---

> Thanks for reading! For more resources, feel free to access:

- ✨ More [Free Dashboards](https://appseed.us/admin-dashboards/open-source) crafted in Django, Flask, and **React**
- ✨ More [Admin Dashboards](https://www.admin-dashboards.com/) - a huge index with products
SQLite integer can save up to signed 64-bit with Golang
Tags: go, sqlite
Published: 2022-02-02 04:54:53

From this [page](https://www.sqlite.org/c3ref/int64.html), it seems SQLite can save up to the max number of uint64:

> The sqlite3_int64 and sqlite_int64 types can store integer values between -9223372036854775808 and +9223372036854775807 inclusive. The sqlite3_uint64 and sqlite_uint64 types can store integer values between 0 and +18446744073709551615 inclusive.

But I tried this with a simple table which has `id INTEGER PRIMARY KEY` and `id UNSIGNED INTEGER PRIMARY KEY` and with Golang's two SQLite drivers:
* github.com/mattn/go-sqlite3
* modernc.org/sqlite

Both throw the error below when I tried to insert an id with the value 9223372036854775808, it works when the number is 9223372036854775807, but not bigger. 

> sql: converting argument $1 type: uint64 values with high bit set are not supported

The max number it can successfully write to the db is the max number of "signed int64", 9223372036854775807.

I am not sure if this is Golang driver's problem or SQLite itself's INTEGER doesn't really support a big uint64. Since I currently need to support the uint64 data, I guess I'll need to make the `id` field as a `TEXT PRIMARY KEY`.
Data Lake
Tags: datascience, dataanalytics, datalake, machinelearning
Published: 2022-02-02 04:50:04

**What is Data Lake?**

Data lake is a place where all sort of data are stored or ingested in order to perform any kind of data analytics, business intelligence, machine learning, data warehousing etc.

**Why should we use Data lake?**

For the past few years, data have been growing exponentially and we are getting humongous data from different sources like mobile devices and extensively from IOT these days. Mostly those data are diverse and having open formats. Hence we use data lake as a central catalog for managing those increasingly diverse different format data like tables, images, videos and so on. Those data can be ingested into the data lake and can be managed and used for different purposes like stated earlier. 

**What are the different tools available for Data lake?**

While we have some powerful tools in the market for data analytics like Power BI, Python, Knime, Tableau and so on, we do have some robust tools for the data lake as well mainly in the cloud. Few such offerings of the best data lake tools in the cloud are AWS Lake Formation and Azure Data Lake Storage.

**What AWS has to offer for Data lake?**

The simplicity in implementing or setting up of data lake makes AWS a super player in the cloud competition. AWS has S3 which is more robust and resilient that can store even years old data with a less expensive form. It includes many different tiers of storage that makes it more dynamic and use data in a more effective manner. Also as mentioned earlier, AWS offers the Lake Formation solution that very well integrates with different services like S3, Redshift, Athena, Kinesis, EMR and so on.

**Conclusion**

Data is everywhere nowadays and hence the necessity to manage the same effectively has become vital. It started with the traditional databases where we simply managed the tables and mainly focussed on the business transactions. Then came the data warehousing concept with which we ingested some important data from business for analysing and improving the businesses. In the modern days, as the technology transformed to a different level, the data processing for automation, machine learning, AI increases and so is the demand for data lake is increasing enormously.
Containers
Tags: containers, docker, devops
Published: 2022-02-02 04:45:03

**Why Containerization?**

In this article, we will try to understand the need of containerization in simple terms. Unlike the traditional method of provisioning and managing the resources, the technology advancement has brought as a situation where companies are moving towards or already managing their infrastructure in different places. Be it on premise or with different cloud service providers like AWS, Azure, and Google Cloud and so on.  Multi-infrastructure management comes along with some major challenges like migration from one place to another. We know the pain of migrating all our workloads from one infrastructure to the other. Hence, the use of containers makes it easy to build, ship and run anywhere saving lot of time and effort.

Nowadays most of the companies are into transforming their applications from monolithic architecture to microservices architecture. Just think off the cost involved in provisioning the hardware/servers for each services in microservices. The containers can eliminate this challenge as well by running on a single server that too by isolating from each other. 
One another major advantage of using containers are in using along with CI/CD pipelines. Using containerization in the CI/CD pipelines saves us a lot of time and deliver high performance. Containers are lightweight and isolated and are easy scalable and provides seamless elasticity. One such popular Containerization tools in the market for a long time is Docker.
Why Docker became so popular?

Docker has attained popularity due to its simple interactive CLI. It has its own DSL (Domain Specific Language) and mainly it is similar to Linux. However, it is not only easy to learn for Linux users but also provides simplicity for the other new users. Docker is limited to run only through the command line although it is itself a VM or a Windows machine. Docker needs only the docker engine to be available and works in a similar way across all the operating systems (with the same CLI) that makes it platform independent.

**Conclusion**

Containers are everywhere. Most of the services in Microsoft Azure are nowadays running on the Containers. Nonetheless, it eliminates many challenges of VMs, in some cases VMs are still standing out. Hence, it is a better approach to use both of them effectively considering the use case and requirements of your projects or infrastructure and in optimally deploy and managing your applications.
Self-Taught Developer Journal, Day 52: TOP Building Rock Paper Scissors UI cont.
Tags: webdev, beginners, codenewbie, devjournal
Published: 2022-02-02 04:21:36

Today I started writing the JavaScript for my Rock Paper Scissors UI.

I began with creating a named function to pass to the button addEventListener. The function will take the event as an argument. 
For this function, I decided to re-use my game function I created in the earlier assignment.

![Old game function](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/osqld5xoxbmxfpexucvu.png)

As I testing the button events, I was having a hard time getting the correct button value to console log. I ended up down the rabbit hole of trying to Google to see what I was doing wrong. 

![event target](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ksziznxs7alu5bsg76k4.png)

I found out it was I should have been using the event target property. Specifically, I needed to do event.target.value, but I was trying to do event.value. It made realize I am definitely not familiar with the Event object. Even though I was looking at the Event object in console too.

I'm hoping to read up more on it, but glad I was able to get the correct output.

For future reference to myself:
https://www.w3schools.com/jsref/obj_event.asp
https://www.w3schools.com/jsref/dom_obj_event.asp
 
## Resources
[The Odin Project](https://www.theodinproject.com/paths/foundations/courses/foundations/)
[Revisiting Rock Paper Scissors](https://www.theodinproject.com/paths/foundations/courses/foundations/lessons/revisiting-rock-paper-scissors)
Calculating 6502 Execution Time - Part 3
Tags: opensource, assembly, 6502
Published: 2022-02-02 03:41:30

This is the third and final part of a series on determining execution time of an assembly language program written for the MOS 6502. Part 1 can be found [here](https://dev.to/gusmccallum/calculating-6502-execution-time-46ic) and part 2 can be found [here](https://dev.to/gusmccallum/calculating-6502-execution-time-part-2-6ih).

In this post I'll be trying to optimize the code from the previous posts to lower the execution time. Looking at the program without having tried to optimize an assembly program before, my gut tells me the 6 cycles dedicated to accessing the pointer to `$0400` and iterating over it 1024 times could be a good place to start. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6rjbx5ifxw6m380gffyo.png)

Removing the indirect address and restructuring the program to very explicitly fill each page individually should bring down the execution time by  1,081 microseconds. I'm sure there's further refinements you could make to improve execution time but given my very limited assembly knowledge that's all I've got for the moment. The code I used was as follows:

```
	LDA #$07 		
	LDY #$00 		
LOOP:	STA $0200,Y 	
	INY 
	BNE LOOP

	LDA #$07 
LOOP2:	STA $0300,Y
	INY
	BNE LOOP2

	LDA #$07 
LOOP3:	STA $0400,Y
	INY
	BNE LOOP3

	LDA #$07 
LOOP4:	STA $0500,Y
	INY
	BNE LOOP4
```

Other experiments for this week's lab include filling the display with light blue:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wmwfvso1bkaei7ojfrgw.png)

This involved simply changing the colour code loaded into the accumulator to `$e` from `$07`.

Another experiment was to change the colour for each page to have 4 distinct sections:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rlp50zn9x61grsma07qz.png)

Again, this just involved changing the colour code loaded into the accumulator for each loop - `$e`, `$a`, `$f`, and `$b`. 

To wrap up, some thoughts and feelings about my first experience with assembly. It's definitely a disarming language, I'm in my last term now and feel like I know a decent amount about programming but assembly really strips that away and makes you look at the rote data being manipulated without all the assumptions and preconceived notions surrounding it. One of the hardest learning curves for me in completing this was going back to hexadecimal numbers, trying to remember details about overflows and binary number limits, although it is review for me I haven't touched those concepts in a meaningful way since first term which was almost 5 years ago now. Once I get a grip on those again it should help a lot in following the logic of how assembly programs work. Excited to get deeper into it!
Laravel 8 Database Seeder Example
Tags: laravel, laravel8, database, seeder
Published: 2022-02-02 03:41:21

In this tutorial, we will see the laravel 8 database seeder example, as we all know laravel framework provides many functionalities to the user to reduce the developer's time for developing the website. So, here we will see how to create a database seeder in Laravel 8.

Many times you have a requirement to add some default records or entries to login or add form details etc. there is no problem adding manual data in the database one or two times but it is a very challenging task to add data manually each and every time.

Laravel includes the ability to seed your database with data using seed classes. All seed classes are stored in the database/seeders directory. By default, a DatabaseSeeder class is defined for you.

So, if you want to avoid this boring task you need to create database seeders in laravel, laravel provides an inbuilt command to create database seeders in laravel 8.

Let's see how to create a database seeder in laravel 8.
Refactoring you, the ultimate platform
Published: 2022-02-02 02:29:25

    I'll keep this brief because we all have a life to do. 

In short, my personal operating system went for a very long time without an upgrade, refactor, etc. This is what I did.
    
As we all know, 3rd party libraries are always getting updated, requirements change, methods are tweaked. If you don't upgrade your personal operating system problems present themselves. This is what we call "[technical debt](https://en.wikipedia.org/wiki/Technical_debt)". For example, you are no longer holding yourself accountable for your mistakes and in fact become defensive if someone suggests you make them in the first place. Yes, I know this is vague; but, I don't want to bore you with the details.
    knowing that you need to "[be the lion and not the dog](http://aumamen.com/story/be-a-lion-not-a-dog)" is great, but knowing what in your operating system is keeping you from being the lion is better. This is because your personal OS was coded for a good reason. So, I figured this out after a lot of reflection and help from other people.
    If you don't already know this I think you can see how refactoring **you** is a good idea. The trick is .. how? This is where I have to admit that I don't know how to fix _your_ operating system, but I can point you in the right direction. These are the first steps that I took:
- Look on YouTube for posts that "speak to you" about deep emotional problems you feel in my heart. It takes a lot of emotional intelligence just to notice your problems, but a good place to start is to ask the question "What makes me uncomfortable?"
- Get curious. When you get upset, step back and ask yourself why? There's always a good reason and if you're like me you just want to pretend it never happened and move on. That won't work. It's time to do a code review.
- When you're coding you will find [cruft](https://en.wikipedia.org/wiki/Cruft). Sometimes you leave it alone because there is no time or someone has told you to focus. Well; eventually, this cruft will break you. It might not happen today, it might not happen for years, you might go your whole life carrying this bad code; but, if you fix it there will be a bright light at the end of the tunnel I promise.
- [The body never forgets](https://www.google.com/aclk?sa=L&ai=DChcSEwiv59az-9_1AhV1FNQBHfdlDxEYABAFGgJvYQ&sig=AOD64_3zuaalH71fmtK9FjAjItVlSXiN1g&ctype=5&q=&ved=2ahUKEwjU9siz-9_1AhWgKEQIHZ_YCngQ9aACegQIARBC&adurl=). If you have trauma, your body will keep it locked up inside. For me, it was a tight, tense tummy, GI issues, etc. Also, the whole left side of my body wanted to be tense .. all the time. For you it could be shoulders or headaches. Could be a lot of things.
- Journalling can help. You're creating a dialog with yourself and getting better all on your own.
Cookie vs Session Storage vs Local Storage
Tags: beginners, security
Published: 2022-02-02 02:27:50

Until quite recently, every time I was asked to accept cookies, I was scared that my personal info might be stolen and get involved in a trouble someday. I was that ignorant. So, I did some research and summarized it in a super simple, easy-to-understand (-for-me) way.

First of all, those storage mechanisms allow us to avoid logging in every single time, or selecting items and adding to our shopping cart again after leaving the website.

**COOKIES**
When a user visits a website (or sends a request for a webpage), a server sends back a piece of data and the cookie is stored in the user's browser. When the user visits the same website again, the user is sending that cookie to the server so that the server can recognize the request comes from the same browser (so our login info or cart items are remained). 
Either a server or a client can set an expiration date. But there are some disadvantages such as its small data capacity (4KB) and its low security.

Here is another storage mechanism: Web Storage API.
Data is stored and retrieved in a browser/ on a client side.

**sessionStorage**
Data can be stored at most 5MB; data is never transferred to a server; data is expired once the user's window or tab is closed.

**localStorage**
It's the same as the sessionStorage except that data is stored with no expiration date (until the user edits or deletes it) and its data capacity is 10MB.


This summary would not be enough and needs digging deep into more details for security wise and source codes. The next step would be to focus on those, and start learning JSON Web Token.