Category: Programming

  • How To Use Gmail to Send Email from Custom Domains for Free (With Pictures and Updated for 2019)

    Gmail is great. It is powerful, sleek and easy to use. Using gmail with a custom domain for free makes the platform even better.

    Sending emails from an @gmail address works for personal situations. Sending emails from @mydomain.com is necessary in professional and business settings. If you’re on a shoestring budget, or you just don’t want to pay $5 or $10 a month for Google apps to configure your custom domain email address, you can (and should) use gmail with a custom domain for free.

    There are three steps involved, and you don’t need to be technically savvy to set this up.

    1. Enable email forwarding
    2. Setup SMTP server
    3. Create a Gmail alias

    Email forwarding

    Our first step is to setup an email forwarding via a simple mail transfer protocol (SMTP) service. Here are a list of email forwarding and SMTP services that have “free” pricing tiers that you can use.

    SendGrid allows free users to send 12,000 emails a month. That is the most of the four companies listed above. For the example below I am going to be using mailgun. If you want to use Zoho check out this comprehensive tutorial.

    SMTP server

    Go to mailgun and signup for an account with your @gmail email address. Make sure you use your @gmail address – you need to do this in order verify your account.

    Once in mailgun, head to the primary dashboard page. Scroll down to the “Sending Domain” section and click Add New Domain and add your domain name. (As of March 2019, Mailgun has updated their user interface design, but the steps below still work).

    custom-domain-with-gmail-mailgun

    Follow the domain name server (DNS) instructions and add the DNS records with the service that manages your DNS.

    I manage my DNS for shefska.com with DigitalOcean.com, so I simply add the DNS records there.

    digital-ocean-dns-records

    If you registered your domain name with GoDaddy or Namecheap and are not sure how to set up DNS records simply google “how to set up DNS records with XXXX”. There are plenty of tutorials out there.

    Next, click on Domains, and then click on your domain name. Click on Manage SMTP credentials. Create a new SMTP credential for the custom domain email address you want to use (for example, “zach@shefska.com”). Enter in that email, and a password. You’ll need these credentials again in Gmail. Don’t forget them!

    This is the most “technical” aspect of setting up your custom domain with Gmail for free.

    Mailgun routes

    Next we’ll tell Mailgun to route emails it receives to your gmail account.

    Click on the Routes tab and then click on Create New Route. Enter the following information:

    routes-in-mailgun-for-gmail

    Be sure to use your email addresses in place of mine!

    Gmail alias

    Next, go to Accounts and Import settings page in Gmail. Click on Add another email address you own under the Send mail as section.

    gmail-add-email

    Enter the email address that you just set up in mailgun and press next.

    • Server: smtp.mailgun.org
    • Port: 587
    • Username: from the SMTP credentials section above, e.g. “zach@shefska.com”
    • Password: the password you set in mailgun SMTP Credentials

    Click Add Account (it says Save Changes in mine because I have already set this up), and confirm your email by completing the verification process. Nice! You’re done.

    configure gmail with a custom domain alias

    If you want, you can set your new email address to be your default on the Accounts and Import settings page.

    There you go, 10,000 free emails per month from your custom domain name in gmail!

    Using your free custom domain with Gmail

    At this point you’re all set. Leverage Google’s alias feature to choose which of your now many email addresses you want to send as, and configure your mailgun forwarding with more specific rules if you need to.

    If you get stuck, have any questions, or just need a helping hand, don’t hesitate to email me at zach (at) caredge.com. I refer to this tutorial frequently!

  • GymNear – AngularJS Project Update

    Two months ago I posted about an AngularJS side project that I had planned to begin working on. Over the past 8 weeks I have broken ground and launched an initial 1.0 app. I have gained an understanding of AngularJS, built a website that I am proud of, and had fun along the way.

    GymNear.com is a simple to use and effective app that helps users find a gym or fitness center near them. Users enter in a location and the app responds back with a list of gyms nearby.

    In my original post I wrote about how difficult it was to find a gym when google searching. I went as far as to say, “Scouring Google search results for ‘gyms near Reston, VA’ always proves a waste of time.”.

    Which is ironic, because I am now entirely relying on the Google Places API to serve content.

    I ditched the idea of scraping the internet to create my own database of gyms and fitness centers. Instead I went with Google’s API. Google has a fantastic database with more information then I would have ever been able to successfully pull together. The issue Google faces is when it comes to displaying that information to the end user.

    A google search of “Gyms near Reston, VA” will still be a waste of time. Intermixed with the good results are advertisements and unrelated content. With GymNear.com the user is presented with 20 of the closest gyms, that is it.

    Essentially, all I have done is made a simplified Google. It works, it is easy to use, and it provides immediate value, I am really happy with where it stands.

    Design

    I decided on a minimalist design for GymNear. When looking at competitors I thought there was a great opportunity to differentiate GymNear with clean, simple design.

    Other websites that offer the same functionality look like they are from 2002…

    With GymNear I knew I wanted something that looked both modern and simple.

    Functionality

    In the spirit of not having to make the user think (thank you Steve Krug), I have limited GymNear’s functionality. The only thing a user can do on the site is enter a location and click on a link.

    Initially I wanted to include reviews, ratings, directions and any other information that I could find when returning results. I decided against this, at least for now in an attempt to make GymNear as easy to use as possible.

    By providing bare-bones functionality the user gets exactly what they expect, while also leaving the window open for future features to be added.

    Tech

    Creating GymNear with Google’s API has allowed me to bypass nearly all “back-end” development. The entire application is built in Angular, and I have not yet set up a node server on the back-end.

    Currently GymNear works by sending an API call to the Google Maps Place Service with the user entered location. It returns an array of objects which I then display on the page. When a user clicks on more info I pass that specific gyms place_id to Google’s Place Details API which returns another object with a ton of relevant information.

    Essentially, what I have made is a website that makes a ton of requests to Google.

    I have yet to set up a Node server, but that is a top priority. GymNear serves an entire JavaScript page to the browser which makes conventional SEO impossible. Prerender allows for AJAX heavy websites to be crawled effectively by search engines. Prerender runs on Node, and I have no experience setting up either.

    In addition to configuring Prerender I am also planning on implementing UI Router. I would like to create 50 or so pages that serve content for specific locations. For example, gymnear.com/boston, or gymnear.com/atlanta. I think creating webpages like these would work well and help Gymnear rank higher for specific search terms.

    Hopefully between Prerender and Angular UI Router GymNear will be able to get picked up by search engines.

    Moving Forward

    Building version 1.0 of GymNear has been a blast. I will continue to post updates as more people use the application, and as new features and technical updates are made. If you are going to teach yourself a language or framework, this is the way to do it. Find a project and simply plug away.

  • Can You Win Fantasy Football With Quantitative Analysis?

    Last weekend marked the beginning of the 2015 National Football League season. From that weekend until Valentine’s day there will not be a single Saturday or Sunday without some form of college or professional football on tv.

    Fantasy football leagues, and one day fantasy football games have swelled in popularity. Daily fantasy sports have picked up the most steam as of late.

    Companies like DraftKings and FanDuel have both received billion dollar valuations from investors and are poised to payout hundreds of millions in “winnings” this season. As these corporations face legal challenges (daily fantasy sports and online gambling are nearly synonymous) I have thought to revitalize an old idea.

    I have a theory, if winning at daily fantasy is skill based then I should be able to win more times than I lose. I don’t have an innate ability to predict who will have a breakout game or what player is overrated from week to week. Rather, I can rely on quantitative analysis.

    Applying the same principles of financial analysis and portfolio theory to fantasy football teams should produce favorable results.

    There is one major caveat in my plan – I am no financial analyst. Unfortunately I have only taken a few classes on quantitative methods, statistics, and financial theory. (Yes mom, this is me admitting that going back to school would be beneficial in this context.) None the less there are a myriad of open source tools and resources to draw from that should make this a successful project.

    Getting the data

    I do not follow fantasy football religiously. I really don’t follow fantasy football at all. Thankfully Boris Chen, and Fantasy Football Analytics do.

    These two websites have been my main resource for data on players. Both websites use different techniques to rate players and project points.

    Boris generates tiers of players from a gaussian mixture model. He pulls his data from the consensus rankings at Fantasypros.com.

    Fantasy Football Analytics goes more in depth for each player. They provide a projection for the season, the risk involved in drafting that player, and the value over replacement. Their data set is very robust, very deep, and very informative. I have used their projections and calculations for my simulations.

    Creating a model

    There is probably a much better way to generate simulations than the technique I am about to lay out. Please give me suggestions for the model – I appreciate your help.

    For the Monte Carlo simulation we need to assign probabilities to each player. If I assign probabilities that are not accurately weighted then the model will not work well.

    As a baseline I have decided to assign probabilities based on the players projected points per game divided by their risk value. This generates probabilities that favor players who are projected to be more consistent.

    Henry Markowitz’s portfolio theory suggests that rational investors will always choose a portfolio that has the best risk-expected return profile. In fantasy football this should also hold true.

    By assigning probability to a player based on their return (points per game), and their risk (degree of uncertainty of players’ projected points) we have created a model that loosely follows Markowitz’s principles.

    Strategy

    I will be running simulations in Microsoft Excel. This can be burdensome on a personal computer, but the technique is relatively straight forward.

    DraftKings does not finalize their “price” per player until the day of competition. This means that the teams I am currently generating are not necessarily realistic. Once the salary data is confirmed I will be able to generate “real” teams.

    I know of no way to restrict excel to generate “teams” that fall below the $50,000 salary cap. As a work around I have assigned a background color to all cells that are above $50,000 in the “total salary” column.

    After running my simulations I will randomly take 500 of the generated teams and play them on DraftKings. For now I will be using a DraftKings CSV upload plugin – in the future (if this works), I would like to write a script that automates this process.

    In an attempt to mimic diversification (another one of Markowitz’s fundamental principles) I will play as many teams as possible. The more randomly generated teams I play, the more diverse my portfolio becomes.

    There are many different types of leagues on DraftKings. The two that have drawn most of my attention are head to head competitions, and aggregate competitions.

    A head to head competition gives you a 50% chance of winning. Your lineup competes against another users team. The team that scores more points wins. One on one competitions pay out $.80 on every dollar. If you enter a $1 competition and win, you get back $1.80.

    An aggregate competition pays out winnings to the teams that finish in the top 20% of points scored. Your team competes against every other users team. If you enter an aggregate competition you can win between 1x and 100x your entry fee. For example, in a $1 league you could win $2 up to $100 if you come in first.

    I have decided (as of now), to enter my teams in both competitions. I have no data driven approach to determine which league will provide better returns over time. I’m certain there is a way to determine this, I simply do not know how.

    I plan to play 500 teams on week one of the NFL season. I will have $500 on the line. To break even on my head to head match-ups I will need to win 56% of the games. To break even on the aggregate league I will need place multiple teams within the top 20%.

    Suggestions

    So, what do you think? If you have a suggestion, tip, or advice, please let me know. I will be posting updates on the simulation and my earnings (losses) as the NFL season gets going.

  • Programming On a Windows PC

    During the past two weeks I have been working weeknights and weekends on a simple AngularJS side-project. (I wrote more about that project here if you are interested).

    I’ve been writing all the code on my Windows PC.

    This has been quite a change. I’m used to developing on the Mac operating system (a huge thank you to the CEO of the company I work at for recently getting the development team new computers), and over the past 6 months I have done nearly all my programming on a Mac. Yet, when I am at home and working on a project I am left with my trusty 2012 Acer PC running Windows.

    After contemplating a complete removal of Windows OS and installing Linux I decided to tough it out and spend some time re-configuring my personal laptop as a development environment.

    House cleaning

    The first thing I did was remove garbage bloatware. I found a great site called Should I Remove It? which helped me decide what software was going to stay and what software had to go.

    The first time I opened up the “Uninstall or change program” window on Windows I was overwhelmed. After browsing Should I Remove It, and doing a bit of googling I ended up  removing a few dozen programs.

    Command line

    Coming from a Mac operating system I am familiar with the Mac, and even Linux shell. Trying to use those same commands in the Windows PowerShell became so annoying that I decided to install Cygwin.

    Rather than adapt to Windows, I brought Linux into the equation. Cygwin provides nearly all the functionality of a Linux terminal to a Windows machine. This does not mean Cygwin transforms your Windows computer into a Linux machine, but it does enough to keep you sane.

    The Cygwin website says it best, “Cygwin is not a way to magically make native Windows apps aware of UNIX®”.

    Git, Node, Bower…

    Next came the installation of Git. Followed by Node.js. Finished off with Bower for good measure.

    I installed Node for the first time on this computer specifically to install Bower. I have never worked with Node, and all I know about it comes from reading occasional posts that grace the front page of Hacker News.

    I know enough about Node to understand that it is powerful and important. Before installing Bower I went to NodeSchool and completed a few courses. I would suggest doing the same if you blindly install it like I did.

    Finally I installed Bower which poses the question;

    Why learn the in's and out's of package control when you can simply install Bower and have every dependency installed for you?!?

    Yeah, terrible mindset, I know. But seriously, Bower makes it so seamless and easy to start building a new application. Learning and managing my own packages is something on the future checklist, in the meantime, Bower to the rescue.

    Wamp and Sublime

    Two more software installations were necessary before I could start working on my Angular project. A local server, and a great text editor.

    I have used Wamp for years. I used Wamp when I was 14 and didn’t know what Javascript was. Wamp is solid, and provides the perfect foundation to start developing locally.

    At work I have been using Panic Coda 3 for the past few months. Coda is great. Publishing in Coda takes away the necessity of an FTP, and the preview mode has been a time saver every single day. But for developing locally and on a Windows machine Coda went out the window.

    I installed Sublime Text 3, changed a few small settings and got to work.

    Time to write code

    Setting up my environment to program on a Windows PC was relatively easy. Which reminds me, now is about the time I should get back to writing some code!

  • Starting to Develop An AngularJS Side Project

    I have been urged by my peers to learn AngularJS in recent weeks. At work our in house application uses Angular and the other developers would like for me to be able to help maintain it.

    With this in mind I have recently begun programming a new side project to learn and practice AngularJS.

    The idea

    The idea for this project was entirely inspired by a problem I frequently run into. When I am at home I religiously go to the gym. When I am away from home (on vacation, visiting family, etc) I never go to the gym.

    I always plan on finding a fitness center near the hotel I am staying at. Unfortunately, that never happens. Scouring Google search results for “gyms near Reston, VA” always proves a waste of time. Google finds a few gyms near-by, but does a poor job helping me sign up for a one week membership.

    Having repeatedly not been able to find a suitable gym with a reasonable one week pass I have decided to create GymFinder (the name is not set in stone).

    Users open GymFinder in their browser and put in the zip-code they will be travelling to. GymFinder searches through a massive database of fitness center across the world and returns those that are within a specified radius.

    Results also contain meta-data, such as the size of the gym, the equipment available, and the price for a one week pass. GymFinder helps people find the right gym when they go on trips. And if it doesn’t do that, then at least it will help me find a gym when I go on vacation!

    The tech

    After consulting with other developers at work I have decided to use a fairly simple stack to create this application.

    As mentioned above AngularJS will control nearly all of the application. Ajax requests will be done with Angular and a simple PHP server side script will call data from our mySQL database.

    The GymFinder app will be a single page and take full advantage of AngularJS routing. There will be no user login or storing of data. Rather the application will be quite simple and only spit out results. This is simply for practice at the moment, more features will come down the line once I have a more complete understanding of Angular.

    The data

    The most difficult aspect of this project is collecting, verifying, and storing enough data to make this project useful. After looking into using the Google Places API it became clear to me that creating an independent database of fitness centers was the best option.

    The plan is to write some sort of script that will crawl the web and write to a csv file. A few websites such as FitLink, Directoryfitness, and Gymnearme seem to have all the data GymFinder would need (those websites have user interfaces that make then nearly impossible to use).

    Two options are being considered for the crawling script. Option one would be to use an open source PHP script, while option two would be to write a simple bash script.

    I am leaning towards writing a bash script. Bash scripting is fun, interesting, and has many practical applications at my work. Utilizing someone else’s PHP code does not seem like as much fun.

    Updates

    I will mostly be working on GymFinder during the weekend. As progress is made I will be writing updates and sharing code.