Learn to Code in 30 Seconds

Computer programming is the act of writing (typing) instructions for a computer to follow, as opposed to controlling a computer using a mouse or touch screen. The basic commands we give the computer are called functions. More advanced commands/instructions include loops which instruct the computer to repeat things, and if-statements which allow us to instruct the computer on how to handle decision making. Along with loops and functions we can also instruct the computer to store data with variables and arrays.

 

You need supervisord

This blog post would have been more appropriately titled, “I need supervisord,” but I decided instead to go with a more click baity title instead. Hope you forgive me. Okay… so what’s all this supervisord business about, and why do you and I need it?

I just launched my latest side project, MoneyPhone, a personal finance web-app powered by Flask into production on a live virtual server the other day and have been struggling with the fact that every morning when I wake up the app has quit working! The fix is pretty simple however, I just restart my Ubuntu virtual server and everything starts working again. However, I don’t want to have to keep doing this every morning, and neither do you! So it looks like you and I need supervisord in our lives.

For the past two days I’ve been searching for answers regarding this bug in my free time, and the name supervisord seems to keep popping up so I’m going to assume that this is probably what I’m looking for. And this morning I happened to stumble upon a pretty interesting article regarding Steve Huffman, co-founder and developer of Reddit, once had the exact same problem after launching Reddit. The author of the aforementioned post writes:

Waiting around to restart your web server is painful – Steve Huffman, one of the founders of Reddit talks about literally sleeping with his laptop next to his bed and constantly waking to restart a process at ungodly hours of the morning… Eventually he discovered supervisord and got some sleep.

UPDATE (5/1/2019): I actually did not end up needing supervisord or any related software to fix my woes. In the end, I just needed to beef up my $5 per month virtual server from DigitalOcean to a $40 per month vps… whoops! So I suppose a more appropriate title for this blog post would have been: You don’t need supervisord, but you probably need more computing power. Since beefing up the server, the app hasn’t crashed once.

 

Requesting Access to the Plaid API Production Environment

This blog post is brought to you by the developer of BitBudget. BitBudget is an automated budgeting app for Android and iOS which syncs with your bank account and helps you avoid overspending. If you’d like to quit living paycheck-to-paycheck and get a better handle on your finances, download it today! https://bitbudget.io

Just submitted my request to Plaid to push MoneyPhone from the Plaid Development Environment to the Live Production Environment with Unlimited Users and No Rate Limiting. Sort of nervous and hoping everything goes well with my request. Wish me luck!

 

Why Your Startup Shouldn’t Pay the State of Texas $750

This blog post is brought to you by the developer of BitBudget. BitBudget is an automated budgeting app for Android and iOS which syncs with your bank account and helps you avoid overspending. If you’d like to quit living paycheck-to-paycheck and get a better handle on your finances, download it today! https://bitbudget.io

This isn’t really an original post, but I sort of just wanted to save this information here on the blog because it could mean the difference between success and failure for anyone starting a startup in the State of Texas. If you’ve ever started a startup before, one thing you may find out early on is that the administrative costs of operating a Delaware C Corporation can quickly exceed all of your other operating costs combined! $2,000 to incorporate through a service like Clerky, and another $800 per year miscellaneous state filing fees, this is likely to add up to more than you would spend on your DigitalOcean server bill in a year.

At the moment I’m consider forming another C Corporation for one of my latest software ventures, MoneyPhone, but I’ve sort of been balking at the idea of spending all that money once again because I know if I don’t end up receiving funding within 12 months or so I’ll ultimately end up needing to shut the C Corporation down even if the app is doing okay just to keep expenses under control.

Thankfully I stumbled upon this excellent blog post from a startup lawyer here in Texas who claims you just shouldn’t bother paying the State of Texas their crazy $750 foreign entity registration fee, and save yourself another few hundred bucks a year skipping the yearly filing fees (until your startup is actually generating revenue). This doesn’t eliminate all of the costs that I mentioned with starting a Delaware C Corporation in the State of Texas, but I do estimate that it could cut the fees in half. Also, by switching from Clerky to someone a little cheaper like Stripe Atlas or maybe someone else you can likely cut the cost of incorporation from $2,000 to more like $500 or less.

And last, here is a link to the original blog post if anyone is interested: When do I “really” need to qualify my Delaware-formed startup in Texas?

Anyway, I’ll probably make another post here on the blog sometime soon should I end up incorporating my latest venture. One thing I’m a little worried about is that the startup incorporation services like Stripe Atlas may force you register with the state. If that’s the case, I’m not sure exactly what I’m going to do. I know conventional wisdom says you should always incorporate as a Delaware C Corporation, but from my experience it’s often just a money sink. Spend $3,000 to please potential investors, but then never actually raise a dime. Hmm…

UPDATE: According to the “Startup Cheat-Sheet” you can actually find examples/templates of all the needed paperwork online for free and register as a Delaware C Corporation for $139 going the DIY route– Startup Cheat-Sheet: How to Incorporate Your Company

 

AttributeError: type object ‘datetime.time’ has no attribute ‘time’

This blog post is brought to you by the developer of BitBudget. BitBudget is an automated budgeting app for Android and iOS which syncs with your bank account and helps you avoid overspending. If you’d like to quit living paycheck-to-paycheck and get a better handle on your finances, download it today! https://bitbudget.io

Happened to run across a very annoying error attempting to generate timestamps tonight in Python. Apparently, the modules datetime and time can conflict with each other so that time.time() will not work if you are also importing the datetime module. I had some suspicion that the bug was due to some sort of bug related to using both datetime and time, but I wasn’t actually the person that figured this out, some wonderful man(woman?) on StackOverflow was! However, I wanted to jot this solution down here on the blog to make sure it is as easy to find as possible– Instead of importing time, import time under an alias such as time_:

# REFERENCE: https://bit.ly/2Gpmoy7
import time as time_
timestamp = int(time_.time())

 

SendGrid, Error Sending First eMail using Python– AttributeError: ‘TypeError’ object has no attribute ‘message’

This blog post is brought to you by the developer of BitBudget. BitBudget is an automated budgeting app for Android and iOS which syncs with your bank account and helps you avoid overspending. If you’d like to quit living paycheck-to-paycheck and get a better handle on your finances, download it today! https://bitbudget.io

Just wanted to post a quick remedy/solution to an annoying bug I recently encountered getting started with SendGrid using their Python Library. The error message I received following their quickstart guide went something like…

AttributeError: ‘TypeError’ object has no attribute ‘message’

Okay, so here’s what I figured out. There are two things probably going on here if you are encountering this error and can’t figure out what the problem is. First, you need to remember that your first SendGrid emails are likely going to end up in your Spam folder! Especially when using Gmail. So make sure you check your spam folder as there is a good chance your emails have actually been sending despite the error message.

Second, there appears to be a bug in the try-except block posted in the official SendGrid Quickstart Guide for Python. The solution is to simply comment-out/disable the response and error message code. Here is what the quickstart guide should look like with the buggy parts commented-out:

 
# using SendGrid's Python Library
# https://github.com/sendgrid/sendgrid-python
import os
from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Mail

message = Mail(
    from_email='from_email@example.com',
    to_emails='to@example.com',
    subject='Sending with Twilio SendGrid is Fun',
    html_content='<strong>and easy to do anywhere, even with Python</strong>')
try:
    sg = SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
    response = sg.send(message)
    # Comment out the response, and print something else instead
    # print(response.status_code)
    # print(response.body)
    # print(response.headers)
    # print('SUCCESS!')
except Exception as e:
    # Comment out the e.message, and print something else instead
    # print(e.message)
    print("ERROR: PC LOAD LETTER") # Cryptic Error Message

PLEASE NOTE, the WordPress plugin which I’m currently using to post code snippets here on the blog has some issues so the line numbers and what not appear to be off on the example above. Will need to look for a better solution here in the future. Maybe Github Gist Embeds?

 

Beating the Apple Card to Market: MoneyPhone Launching Memorial Day 2019

This blog post is brought to you by the developer of BitBudget. BitBudget is an automated budgeting app for Android and iOS which syncs with your bank account and helps you avoid overspending. If you’d like to quit living paycheck-to-paycheck and get a better handle on your finances, download it today! https://bitbudget.io

On March 12th 2019 I began working on my latest project, MoneyPhone, a personal finance app that monitors your spending habits to help you save money. Two weeks later on March 25th I woke up to discover (while surfing YouTube) that Apple Inc. has been working on essentially the exact same app— Apple Card. At first I was a little bit upset by the news, but now it’s actually got me fired up. If one of the most valuable companies in the world happens to be working on the same app idea that I’m working on, it must be a good idea right?

Apple has announced that Apple Card will be launching this Summer, however, I just wanted to take the opportunity to announce here on my blog that I plan on beating Apple to market– launching MoneyPhone by Memorial Day (May 27th, 2019)! Watch out Apple, under-employed millennial in his parent’s basement is coming for you 😉

 

Creating Secret Keys in Python for use with the Flask Web Framework

This blog post is brought to you by the developer of BitBudget. BitBudget is an automated budgeting app for Android and iOS which syncs with your bank account and helps you avoid overspending. If you’d like to quit living paycheck-to-paycheck and get a better handle on your finances, download it today! https://bitbudget.io

Working on a little web-dev project this afternoon and am diving into sessions for the first time with Python and Flask. Apparently when working with sessions in Flask you need to create a secret_key comprised of random bytes represented in hexadecimal. I’m sort of a high-level guy myself and am not used to working with bits, bytes, hexadecimal and whatnot, so I had to do a little googling to get up to speed and wanted to share what I learned here on the blog.

According to the official Flask documentation, you create your secret_key by assigning it a string value with this funky letter ‘b’ prefixed in front of your string literal:


# Set the secret key to some random bytes. 
# Keep this really secret!
app.secret_key = b'_5#y2L"F4Q8z\n\xec]/'

Okay, so how do you go about creating this hexadecimal code? I suggest heading over to repl.it and simply entering the following Python 3 code from my github gists to generate your hexadecimal:

topherPedersen’s Hexadecimal Conversion Tool

Generating Random Bytes in Hexadecimal