sneakycrow

programming and personal blog

This week I started writing a file sharing software for the web. I wanted to start creating Entry posts, to track progress and issues I’m having.

note: I’m going to post some code below, but it’s not all the steps required to get up and running

I’m building it in Rust using the actix framework with diesel for interacting with the DB on the backend.

And on the frontend I’m just planning on using something fast. Probably Vue.js with Bulma CSS.

I started off by initializing the project with Rust’s cargo, and then bringing in the packages I knew I needed:

  • serde
  • actix-web
  • diesel
  • dotenv

Next, I started writing the main.rs file. I need to get the API running, so I initialized a “server” via the actix-web readme.

extern crate actix_web;
use actix_web::{server, App, HttpRequest, Responder};

fn greet(req: &HttpRequest) -> impl Responder {
    let to = req.match_info().get("name").unwrap_or("World");
    format!("Hello {}!", to)
}

fn main() {
    server::new(|| {
        App::new()
            .resource("/", |r| r.f(greet))
            .resource("/{name}", |r| r.f(greet))
    })
    .bind("127.0.0.1:8000")
    .expect("Can not bind to port 8000")
    .run()
}

Now that that was running, I know I needed a database. I’m preferential to PostgreSQL, so I created a docker compose file to get that running.

version: '3.1'

services:
  postgres:
    image: postgres:latest
    restart: always
    ports:
      - 5432:5432
    environment:
      POSTGRES_PASSWORD: postgres

note: I opted to use a compose file because I’m more familiar with them and I imagine I might add another service down the line

Then, I started structuring the data for the SQL table. The files aren’t actually going to be stored in the DB. I’m probably going to use Digital Ocean’s spaces for that. I do want the SQL rows to have some data for displaying on the frontend. Spaces can handle the actual downloads.

CREATE TABLE file_links (
  id UUID PRIMARY KEY,
  published BOOLEAN NOT NULL DEFAULT FALSE,
  storage_location TEXT NOT NULL,
  title TEXT,
  description TEXT,
  downloads INTEGER DEFAULT 0
)

And that’s as far as I got for now. My next steps that I want to take are these:

  • Create an endpoint for requesting all file_links from the DB
  • Integrate a SQL Query into that endpoint
  • Create Data for testing the endpoint

#dev

This article is a work in progress

This is an article about my own personal experiences learning Javascript vs learning Rust. I come from a computer programming background, but JS was the first language I was fluent in.

The Learning Curve

Javascript

When learning JS, I came from a HTML and CSS background primarily. I had worked a little with PHP, but not enough to truly understand it.

JS was a hard concept for me. It was the first language I did that truly had “interactivity” with the user, beyond CSS pseudo-elements.

With JS, I’d say as soon as I understood how javascript executed, and truly understand the DOM (at least in a basic sense), my javascript really started to shine.

Node is an entirely different story. Personally, I’d recommend learning client side JS, then going to a server side language that’s not Node (PHP, Python, Ruby even), and then coming back to Node. Node is a power house, but it’s missing some key features. I firmly believe that people that jump right to Node without knowing another backend get stuck there.

Rust

Rust is really hard if you’re not determined, patient, and disciplined. There’s tons of books, and the Rust documentation has to be the best documentation ever written. If you can manage to stick to reading all the docs, reading some books, and continuing to practice, the language gets significantly easier.

It’s just that clicking point feels much farther out with Rust. I definitely don’t think it’s a beginner friendly language, but, if you can manage to learn Rust, you can do a lot. So, I recommend trying it out. Just don’t let it defeat you.

*I’m still learning Rust myself, and don’t feel fluent in it enough to elaborate further than this

I'm sorry to say this post is not going to be about a puppy that can do Jie Jitsu.

I goofed and I missed a post mortem, but it was because of a crazy eventful week, that is just now starting to slow down.

What Happened

Well, to start off, I missed every single one of my goals

Whoops

But, that’s alright! Because the goals are still completable. It’s not the end of the world. I’m going to miss some sometimes, and that’s okay. The takeaway I have is to not continue to miss them, to not make a habit of doing it. But, for balance purposes, allow myself to goof once in a while accidentally

This week, I changed from going working out in general to working out as a byproduct. I signed up for Brazilian Jie Jitsu classes. I’m very excited. I’m going to learn some self defense, hopefully gain some confidence, meet some people, and have fun while working out. The classes are twice a week, and then I also am starting yoga once a week. That should complete my workout sessions each week!

But, the most exciting thing that happened

Drum Roll

I adopted a dog!

His name is Arsenio. He’s two years old. He’s a husky (and possibly a little mix in there). He’s a beautiful, adorable, smart, and sweet dog. I’m so happy to have him in my life. Here’s a bunch of pictures!

Takeaways

Don’t fret if you a miss a week or two of goals. Just keep trying. Have some discipline, and move forward.

P.S. I’m going to be posting here more often with development stuff, so look out for that!

A post mortem of week 2

What I’ve learned

This week has been a grand learning experience for myself, in the best of ways. A few good things happened, a few bad things happened. I’ve learned quite a bit.

Regarding my goals, if you didn’t see my previous post this week, I decided to change up some of my goals. Primarily the intention of picture taking, the goal of working out more, and I added a new goal of learning a programming language fluently.

What I’m realizing, is that it’s super important to focus on ourselves. This week I dropped the ball on that, putting other people, other priorities, over my own.

Don’t get me wrong, there needs to be a balance. I don’t want to be selfish, but I do want to take care of myself. It’s extremely important.

This week, I didn’t do that, and it caused me to drop the ball on some of my goals. I didn’t work out the way I wanted to, and it was because I caused myself so much anxiety that I started to feel sick.

Lesson of the week: Take care of yourself, so you can take care of your loved ones

Picture of the Week!

I made Erin get up with me this week and have breakfast. She's so cute

I think it's important to note that people change, and so do our goals. That's okay! Sometimes we think we want something and we realize that we don't.

That's what happened to me. I've updated my goals with a few new changes that I've realized:

I want to take more pictures

This goal is actually still accurate. And the way I'm going about this will still remain the same. But the intention, the action, behind the goal changed. Originally, I was going to buy a DSLR. I argued that investing money on something like that will motivate me to accomplish the goal.

After 20 days of taking pictures easily with my iPhone, I realized that was unreasonable. The goal is totally achievable with todays Smart Phones. I am not super into photography, not enough to purchase a camera at least. But I love taking pictures, and I decided a better intention would be to introduce a new organizational tool (a todolist) to hold myself accountable.

I want to work out more

This goal in and of itself was offbase for me. I don't actually want to work out more. What I want is to be physically fit and confident in my body. The way I achieve this goal is by eating healthy and getting exercise.

I decided that the intention and balance of the goal was very accurate and useful, but the end goal was weak and inaccurate.

Lastly, I've added a new goal!

I want to Rust to become my strongest language

Rust is a language that I've been working on for the last year. I've been on and off on it, and every time I come back I feel a need to start from scratch. That's because I'm never on long enough to intake the language concepts.

So, this goal, is to finally follow through on it. To add to that, I want to know Rust well enough to outweigh how well I know JS and PHP. Since I'm using JS and PHP at work, this will be a difficult task. But, as long as I follow through and consistently practice, I can do it!

I was driving on my way to work this morning thinking about repository hosts, and I thought I’d look up some articles on other people’s experience with the three. Sr.ht is so new that not a lot of people have posted about it, and of course there’s a ton of articles on Github vs Gitlab.

I decided I’d write my own article about my personal experience with all three.

Gitlab

I was introduced to Gitlab decently early in it’s development, but didn’t dive into it until I started working at Isolary. Gitlab is really quite a nice solution. It basically has everything you would need for a software project baked into it. And everything works with each other really well.

One of the biggest benefits is that Gitlab offers a hosted solution, but also offers a self-hosted solution. That’s extremely appealing to people like me. I definitely prefer self-hosted solutions. My personal issue with Gitlab though, is that the self-hosted “free” packages are limited. But, they still contain most every feature you’d need, honestly.

One of the biggest downfalls that a lot of people point out (and that I agree with) is the lack of community. For me personally, that’s not a big deal. I don’t really have very many projects with multiple contributors. That being said, it really does not support exploring other projects and finding other people (networking basically).

The situation that this created for me, which is why I didn’t pick Gitlab as my personal solution, was that it felt like I was in this huge room with a bunch of different tools, but no one else in it with me. It felt lonely, as weird as that may sound.

I think Gitlab is an excellent solution for teams, but I personally don’t like it for my own projects.

Github

Github is more or less the reverse of Gitlab. Now, I will preface with Github has been introducing more and more features to compete with Gitlab. But, at the point of writing this, to get the same amount of features Gitlab has baked into your project, you’d have to integrate some third party solutions.

That being said, I really like Github as a personal solution, and I don’t have much experience with it as a team solution. While Gitlab feels more featureful without the need to integrate third party solutions, Github feels more network-capable.

By network-capable, I mean I really do feel a sense of community in Github. To add to that, a lot of other various third party platforms let you login with Github, which makes the account feel useful outside of Github itself.

I don’t want to boost the community feeling too much of Github. One thing I have noticed is that you do have to be very intentional about being involved in the community. That’s not necessarily a negative thing, but it is something I feel a lot of people don’t realize.

If you’re not intentional about going out of your way to network with people, your issues or repo will feel like you’re speaking at a normal voice in a 1000 person crowd.

I have noticed that a lot of people have been more negative towards Github since the Microsoft acquisition. Microsoft has a bad taste in my mouth, so if I’m being honest I did kind of jump on that bandwagon. What do you expect though? Microsoft has burned me so many times that I’m scared of them.

I also realized recently, that I don’t need the community features of Github. I don’t utilize them. I also don’t need the “bloat” of Gitlab (there’s just a lot of features of Gitlab I wouldn’t use personally).

This is why the next option was so appealing to a minimalist like myself.

Sr.ht

Sr.ht is a new (still in alpha) platform. They offer hosted solution (which is what I use), but also offer self-hosted solutions. It’s an open source project.

It just feels intentional. Everything I do is just what I need to do. And, they have pretty much anything I would need. They have repo support in their git platform. They have CI/CD in their build platform. They have issue tracking in their todo platform.

The website also just feels minimal, which I truly appreciate it.

I can’t speak much more than that on Sr.ht, but I’m slowly maneuvering my repositories over to it.

#TODO: Write a blog post after one year of using Sr.ht

Over the past few weeks, I've been working with various organizational tools. I've played with a lot of them over the past couple of years, but I've toned down to my favorites.

Note: I primarily work on iOS and MacOS. These applications may or may not support other platforms

Bear

My first, and favorite tool, is Bear. It's an amazing note taking tool. The biggest feature for me is supporting markdown. The second biggest being able to export into various formats.

This app has proved itself extremely useful. Here’s some of the primary purposes I’ve used it for: – Writing up a blog post and exporting into whatever format I need (HTML or Markdown primarily) – Quickly writing up some release notes and exporting them into PDF format for a client – We use markdown in our repositories for Changelogs and Readmes already, so this is extremely nice – Writing some API documentation, and exporting that to HTML for public facing versions, markdown for repo specific documentation, or PDF for client documentation

Things 3

Things 3 is a very well built and well designed todo list organizer. One thing that I really enjoy about it (see what I did there), is the ability to view my calendar events from within the app. I can also set repeating reminders, like for my take one picture a day goal. You can also organize things into projects and what not. Honestly, these features aren’t unheard of in other applications, but Things 3 is a one time purchase, and provides you with all the features that other applications (such as Todoist) require a subscription for.

These posts are going to be more or less a post mortem, or a review, of how well I accomplished all my goals, issues I ran into, and successes I had.

Week 1 was definitely the first weeks, if that makes any sense. I was successful in things like cooking, and planning, and accomplishing all my todos.

What I learned, is that discipline is super necessary, and planning is super necessary. Getting things in my calendar, in my todo list, having reminders, things like that. They're all very necessary.

My biggest success was my calendar and todos. I was able to accomplish most everything I put in there, if I timed it right.

As for failures, I would say my meal planning (primarily breakfast), and my workout schedule failed.

The workout was particularly hard because of the way I scheduled it. When I make a new workout plan next week, I'm going to make a point to be more intentional about how I balance work, workouts, and personal time. The other issue I ran into for workouts was two of the three I scheduled I did not prepare my workout gear in my car. I need to make sure I do that.

As far as meal planning, it was mostly successful. The issue I ran into was meal planning for breakfast. Now, I don't necessarily consider this one a failure. I just realized that I'm not big on breakfast! I don't think that's a big deal honestly. But, I do know breakfast is important.

Corrections for next week

  1. Make workouts more intentional and balance them with proper times. Also, make sure to be prepared for them.
  2. Plan meals separately. What I mean by this is don't necessarily plan breakfast, lunch, and dinner for a whole day. Spread things out.

Aside from that, I did pretty well! This week I'll be attempting to purchase a DSLR to accomplish my photography goal. In the meantime, I have been able to successfully take one picture every day.

Pictures of the week:

Working hard on getting those sprints done! I got a new haircut! I finished setting up my apartment (mostly)

Updated on January 17, 2019

Motivational Words

This idea came from my friend Lauren, who got the idea from this podcast. The idea, as I understand it (and how I intend to execute it) is to think of these words every time you do or say anything. Use them as motivation to drive everything you do and are.

My words are intention and balance

Resolution List

Note: For all of these resolutions I wanted to make a point to not call them 2019 resolutions. They’re more like “life” resolutions. Each one is supposed to improve my life as a whole. I want to take my time with each one. My thinking is that I want to accomplish each one for the sake of improving myself, not for the sake of accomplishing them.

In the spirit of that, each resolution is accompanied by reasonable way to achieve itself.

I want to get physically fit I want to work out more

Edited on January 17, 2019 Work out at least three days a week Intention: During the week prior, put workouts in my calendar. Schedule what kind of work out I’m going to do as well. Balance: Put Rest Days in the Calendar.

I want to cook more

Cook at least four days a week Intention: During the week prior, find four recipes. Add all items I don’t have to the grocery list. Be sure to have all groceries for a dish prior to cooking the dish. Balance: Keep three days available for going out or eating in/relaxing

I want to learn to bake

Cook at least once a month Intention: On the 1st Sunday of the month, find a recipe to bake and add all items that I don’t have for it to the grocery store Balance: Prior to having all the items necessary to bake, be sure to only buy one major item for baking a month instead of baking something.

I want to go back to school

Sign up for classes Intention: Pick at least one pre-requisite class for a class I want to take Balance: Take at least one class I enjoy

I want to take more pictures

Take at least one picture a day Intention: Buy a DSLR and get into a photography class of some sort. Think of intention here as investment. Investing in the hobby sometimes helps motivate you to pursue the hobby. Intention: This one I set a Todo list item that repeats everything single day. It sets a badge notification if I don't complete it (badge notifications drive my crazy) Balance: Picture can be of anything, including myself. But, I should try and take pictures of events, loved ones, or other things beside myself.

I want to spend more time in nature

Take a hike at least once a month Intention: On the 1st Sunday of the month, research a hike to do and plan a day to do it. Balance: During non-ideal weather months, replace a hike with a walk or an extra work out day. On nice weather months, replace a work out day with a hike.

I want to Rust to become my strongest language

Intention: Every Sunday, schedule at least 1 hour a day, every day, to practice my Rust skills Balance: This doesn't necessarily have to be coding. It could be reading an article about Rust, reading some of my books about Rust, or just reviewing some code on open source repositories

I want to document my life

Start a blog Intention: During the week prior to publishing an article: plan a topic, write an outline, schedule a day to write the article, set a publish day/deadline Balance: If a week is a bit hectic, I can skip this at most once within the course of about a month.

I want to follow through with everything I do and plan

Put all events, including the ones above, in either my calendar or my todo list respectively. Intention: Do this item, alongside my other items, every Sunday morning. Balance: If I forget to do it on Sunday, or don’t have an opportunity, do it at the end of Monday instead.