Sign in

Alex Merced is a Full Stack Developer, learn more about his work at AlexMercedCoder.com
Image for post
Image for post

My Original Article on Virtual Environments

In my previous article, I talked about two ways to create Python virtual environments using mkvirtualenv and pyenv. What I wasn’t aware of at the time is that in Python 3.3 and above a native ability to create a virtual environment was added to python.

REMINDER: The Reason we want to make virtual environments is to isolate our project dependency and manage dependency versions, kinda like what a package.json does for us in Javascript, a Gemfile in Ruby, cargo.toml in rust, composer.json in PHP, you get the idea.

How to Use the Native Venv Module

Create a New Virtual Environment

You may need to write python3…


Image for post
Image for post

Find tutorials for django at my website, devNursery.com

Often times when making a RESTFul API with Django it can seem like… “how would this work in?”

Django has a lot of great aspects to it:

  • Modularity, creating chunks of your application as “apps” allows you to reuse and repurpose features you’ve already created. (example, build out an auth app then just reuse it in all future projects)
  • A fairly robust built suite of authentication features

This is all great but when making a microservice or RESTFul API Django can seem a bit clunky (cause its design seems to really be…


Image for post
Image for post

Learn more Javascript with my Javascript Video Playlist => Javascript Playlist

Copying Arrays and Objects

One thing that you always have to be careful in programming is that collections (Arrays, Objects, Maps, Sets, etc.) aren’t primitive values so variables that hold them don’t hold the data but a reference to where the data is located in memory. This creates a syntactical annoyance.

const myArray = [1, 2, 3, 4]
// This line doesn't duplicate the array but creates another variable referring to the same array
const myArray2 = myArray

The reason this is an issue is cause it means modifying the myArray2 modifies the…


Image for post
Image for post

Installing Postgres

Installing PostgreSQL is pretty straight-forward on Linux, just follow a tutorial like this one:

Where I confused the first time around was why certain things worked the way they did so this post is to help address some of those issues.

The Postgres User

When you first install Postgres on Linux it creates a new Linux user called Postgres with superuser privileges. Why does this matter?

  • When you run “psql” command to run the Postgres shell, it defaults to opening the shell under a username that matches the current Linux users and opens a database by the same…

Image for post
Image for post

The beauty of scripting and automation

Today is a great world to live in when it comes to scripting and automating tasks in your computing environment. Out of the box of most Unix-based systems you have several tools to write scripts.

  • The Bash command line which has its own scripting language
  • Perl, while maybe not the first choice for a full-blown application, is a very powerful language for command-line scripting
  • Many Unix based systems may already come with some version of Ruby, Python, PHP which can also be used for scripting

Plus so many other fun scripting languages we can add to our system:

  • Raku (Formerly…

Image for post
Image for post

Why?

Recently I did a blog post where I show the basic syntax in Javascript, Python, Ruby and PHP side by side and got a pretty good response. Figured I’d do the same thing with some lower-level compiled languages. So in this post, I’ll be showing how to do many basic things in Go, Rust and C++ (Keep in mind Go and Rust were created to be modern alternatives to situations you’d use C/C++/Java for speed and efficiency).

Hello World

C++

#include <iostream>using namespace std;int main() {
std::cout << "Hello World \n";
}

Go

package mainimport "fmt"func main(){
fmt.Println("Hello World")
}


Image for post
Image for post

Bash Terminal

Basic Terminal

  • list all files ls -la
  • change directories cd folderName
  • display current dir pwd
  • remove file rm filename
  • remove directory rm -rf directory
  • print contents of file cat filename
  • directory mkdir directoryName
  • make file touch filename
  • go up a directory cd ..
  • go back to home directory cd ~

Special

  • Kill a Port sudo kill -9 $(sudo lsof -t -i:3000)

Git

Git Commands

  • new git repo git init
  • clone remote repo git clone repourl
  • add to staging git add filename
  • git commit git commit -m “message”
  • push to remote repo git push remoteName BranchName
  • pull from remote repo git pull remoteName BranchName
  • list branches git…

Image for post
Image for post

It all starts with memory

There is your computer memory (RAM) and its Hard Drive (HD). Think of RAM as your computers short term memory, the dashboard for thinking and executing things. Really, it’s just a chip that can generate mini-electrical signals that add up to a bunch of 0’s and 1’s. The more RAM you have (4gb, 8gb, 16gb, etc.) the more of these signals it can generate meaning the more thoughts (running processes) it can hold its short term memory. …


Image for post
Image for post

Why do we care?

In any programming language, you’ll inevitably be using code made by other people to make your life easier. These 3rd party chunks of code are referred to as packages, libraries, and frameworks. This brings two challenges…

  • There needs to be an easy way to get these packages and use them in my code
  • There needs to be a mechanism for me to replicate the setup I have on one computer on another

This is where the all might Package Manager comes in. In the world of Python programming that package manager is known as Pip.

  • Simply by running a pip…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store