How to Get Year, Month, and Day as Integers from an ISO 8601 Formatted Date String in Python 3 with dateutil

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

I’m currently working with the Plaid Banking API and need to convert the ISO 8601 formatted date strings returned by the API into easy to work with integers. While I considered writing my own code to handle this, after a quick Google search I found that this is quite easy to do in Python using the dateutil module. So far I’ve only run this code in the repl.it web based programming environment, but I believe this module can be easily installed with the pip package manager by running something like:

$ pip install python-dateutil

The code snippet below mostly comes from a blog post on CodeYarns.com titled How to convert datetime to and from ISO 8601 string, but I did add the parts which I needed specifically (year, month, day):

# REFERENCE: https://bit.ly/2xLIh6I
import dateutil.parser
# Datestring in ISO 8601 format
datetime_str = "2019-01-23T06:17:59.273519"
# Convert to datetime object
some_datetime_obj = dateutil.parser.parse(datetime_str)
# Get Year, Month, and Day as integers
print(some_datetime_obj.year)
print(some_datetime_obj.month)
print(some_datetime_obj.day)
 

Robert Green and The Laws of Human Nature

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

Stumbled upon this awesome talk at Google tonight on YouTube and just wanted to bookmark it here on the blog so I don’t forget about it.

 

MoneyPhone Support

Dear User,

My name’s Topher Pedersen, founder and developer of MoneyPhone Personal Finance. If you are in need of support, first try simply pressing the nifty chat icon in the bottom right hand corner of the app. Or if the matter is more urgent, simply give us a call–

Support Line: +1 (469) 261-0727

Or send us an email–

Email: chris@topherpedersen.com

Best regards,

Topher Pedersen, founder @ MoneyPhone

 

How to Post Source Code on Your WordPress Blog using GitHub Gists and the GistPress WordPress Plugin

  1. Download gistpress-develop.zip
  2. Install the GistPress Plugin on Your Blog
  3. Copy & Paste the Link to Your GitHub Gist in Your Blog
/*******************************************************************************
*******************************************************************************
*******************************************************************************
How to Post Source Code on Your WordPress Blog using GitHub Gists and the
GistPress WordPress Plugin:
1) Download gistpress-develop.zip
2) Install the GistPress Plugin on Your Blog
3) Copy & Paste the Link to Your GitHub Gist in Your Blog
*******************************************************************************
*******************************************************************************
******************************************************************************/
while (true) {
alert("Creating programming related blog posts just got a lot easier!");
}
 

BitBudget Privacy Policy

Privacy Policy

Your privacy is important to me. It is  my (Christopher Pedersen) policy to respect your privacy regarding any information I may collect from you on my app, BitBudget.


I only ask for personal information when we truly need it to provide a service to you. I collect it by fair and lawful means, with your knowledge and consent. I also let you know why I am collecting it and how it will be used.


I only retain collected information for as long as necessary to provide you with your requested service. What data I store, I will protect within commercially acceptable means to prevent loss and theft, as well as unauthorized access, disclosure, copying, use or modification.
I don’t share any personally identifying information publicly or with third-parties, except when required to by law.


My app may link to external sites that I do not operate. Please be aware that I have no control over the content and practices of these sites, and cannot accept responsibility or liability for their respective privacy policies.


You are free to refuse our request for your personal information, with the understanding that I may be unable to provide you with some of your desired services.


Your continued use of my app will be regarded as acceptance of our practices around privacy and personal information. If you have any questions about how I handle user data and personal information, feel free to contact me (chris@topherpedersen.com).


This policy is effective as of 3 June 2020.

 

# TODO: 3-4 Week Plan for MoneyPhone & the June/July 2019 Pioneer Tournament

  1. Remove the “Yesterday Total Spending” SMS-Text Alert
  2. Stop Counting Pending Payments
  3. Write Code to Account for “Net Money Transfers”
  4. Quit Sending SMS-Text Alerts to Users Which Have Not Yet Linked Their Bank Accounts
  5. Replace Web-App with Landing Page
  6. Launch MoneyPhone for Android
  7. Launch MoneyPhone for iOS
  8. Launch Beta-X Accelerator (and Run YouTube Ads for First Batch)
  9. Acquire Paid Beta Users

UPDATE (6/27/2019): Can cross 1, 2, 4, 5, & 6 off the list.

# TODO:

  • Write Code to Account for “Net Money Transfers”
  • Launch MoneyPhone for iOS
  • Launch Beta-X Accelerator (and Run YouTube Ads for First Batch)
  • Acquire Paid Beta Users

# POSSIBLY ADD TO LIST:

  • Add an event listener that detects whenever the WebView is re-opened and refreshes the app if it has been more than 4 hours.
  • Handle updating spending targets, phone numbers, and toggle switches via ajax without refreshing the entire app

# STUFF THAT WILL PROBABLY NEED TO WAIT UNTIL AFTER THE TOURNAMENT:

  • Try caching the main login.html page with JavaScript localStorage for seemingly faster login speeds, bypassing the main login screen, and then simply fetch the new data in the background while displaying a little spinner wheel in the navbar.
  • Consider re-designing the app
  • Add all the cool new features that I want (fixed expenses, new stats/metrics)
 

Apache-Cordova/PhoneGap Application Error net::ERR_CONNECTION_REFUSED (http://127.0.0.1:5000)

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

Hello there distraught Apache-Cordova/PhoneGap developer! Quick post here on the blog to help you with this horrible error message. If you happen to be trying to link up your Apache-Cordova/PhoneGap application running in an Android Emulator to a local development server, such as the builtin Python/Flask development server, and have already made sure to enable the cordova-plugin-whitelist, your problem (and solution) is simple: you cannot link up a cordova app running in an emulator to a local development server running at http://127.0.0.1. Instead, you need to use a tool like ngrok to give your local development server its own public web address such as https://yoursupersweetdevserver.ngrok.io which will then make your local development server accessible to your cordova app.

Please note however, I suggest paying the $60 per year for the ngrok basic subscription so that you have a stable web address that doesn’t change. If you try to accomplish this using their free service, you are going to be in for quite the headache constantly changing the url in your codebase every time you run ngrok!

Hope this post helps some other poor souls out there on the interwebs. This bug caused me quite the headache this afternoon. However, I’m feeling much better after figuring out the solution. And shout out to the guys at ngrok. God bless you!

 

The Music that Plays When I Finally Get my Code to Run…

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

 

19 Billion Reasons Why Your Startup Should Bet on Hybrid Application Development with HTML5, CSS, & JavaScript

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

For my latest startup endeavor, MoneyPhone, I decided to develop and launch the product using web technologies. The main reason for this was that I’m 1) simply better at programming using HTML, CSS, & JavaScript, and 2) I really wanted to use something cross platform if possible. It’s just really awful to be an Android guy, create an app, and then everyone you show it to has an iPhone. And creating an iPhone app when you’re really an Android guy is kind of a bummer as well. So naturally, I just decided to go with web technologies given that my particular project did not require that I tap into any lower level system type stuff that might require native code.

However, I ran into some serious problems recently trying to market MoneyPhone. Launched as a web application at the URL https://moneyphone.app, people didn’t really seem to understand what a web app is. Is it a website? Or is it an app? People just didn’t seem to care or understand. However, this upcoming week I plan on solving this problem by packaging the app up as a hybrid application using Adobe PhoneGap (or Apache Cordova) and publishing it on the Google Play Store, and the App Store at some point as well.

But all of this web-dev stuff has left me with a little imposter syndrome as of late. So is this thing really an app? Or am I just some poser bundling his ‘website’ up with a wrapper, putting it on the App Store, and calling himself a developer? Possibly.

Although that’s not really the point of this post however. The point of this post is to make myself feel better about my choice of technologies by making note of the fact that Slack, a company built on HTML5, CSS, JavaScript, and now the Electron Hybrid Application Framework, recently went public on the New York Stock Exchange at a market capitalization of $19,500,000,000. Badda bing! Badda boom!

UPDATE (6/23/2019): Since I don’t actually use Slack, I’m not sure how popular the electron version of Slack is. Maybe what really took off was their web app, and they just also happened to release an electron based version for Desktop as well. But never let the truth get in the way of a good story 😉

 

Why you should use TurboLinks instead of Intercooler.js or… How to Use TurboLinks without Ruby on Rails

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

Interesting title eh? Just had a few thoughts on TurboLinks vs. Intercooler.js that I wanted to jot down here on the blog in case anyone else out there on the internet needs help making some similar choices as the ones I’ve been mulling over the past couple weeks…

So you want to build a single page application the simple way using something like TurboLinks or Intercooler.js, right? If you’re using Ruby on Rails the choice is simple, just use TurboLinks. However, if you’re like me and you aren’t using Rails and are using something else like Python & Flask the answer is a little trickier. I mean, can you even use TurboLinks if you aren’t using Rails? Well yes! Yes you can use TurboLinks without rails. In fact, it’s quite simple. All you need to do is drop a little <script> tag in your <head> pointing to a CDN hosting the transpiled/compiled version of TurboLinks and you are well on your way!

  <script src="https://cdnjs.cloudflare.com/ajax/libs/turbolinks/5.2.0/turbolinks.js"> 

To learn more about actually using TurboLinks, make sure to checkout TurboLink’s Official README on Github, and also take a look at my very basic TurboLinks demo as well.

Okay, so on to the last point– Why you should use TurboLinks over Intercooler.js. When I was first taking a look into both of these options I actually selected Intercooler.js over TurboLinks as I thought that Intercooler.js was less tied to Rails and was more of a general purpose tool compatible with whatever language/framework you happen to be using. However, I soon ran into a huge problem. After adding Intercooler.js into my project all of the JavaScript I had written on my secondary pages broke! This was pretty demoralizing and I almost gave up on the idea of using a JS library to transform my web app in to a single page application, however I decided to give TurboLinks a second look. And to my delight, I quickly found that TurboLinks handles loading JavaScript from secondary pages with ease right out of the box by default! Had I gone with TurboLinks initially instead of playing around with Intercooler.js first, my webapp would probably already be a single page application.

So in conclusion, TurboLinks is the bomb.com and you need it in your life!