Categories
Humor Programming

Program in C: The coding song in Disney’s “The Little Mermaid”

How did I not know that this existed? Here’s a parody of Under the Sea, the bouncy song from Disney’s animated film The Little Mermaid, but instead of being about why life is better under the sea, it’s about why programming is better with C than with any of those newfangled programming languages with their classes and whatnot:

This amuses me to no end.

When I was a DJ at Clark Hall Pub, the engineering pub at Crazy Go Nuts University, among the alt-rock songs that were guaranteed to pack the dance floor was a strange outlier that started as a joke but turned into a hit that had to be played at least once a night: Under the Sea!

It’s also the time when I got proficient in C, as it was one of the acceptable programming languages for using in assignments. The other one was Turing, and yes, there’s a reason you haven’t heard of it. (One of my favorite professors, Dr. Michael Levison, used to say that Alan Turing would probably be horrified at the programming language that bears his name.)

I may have to add this one to my accordion repertoire.

Categories
Programming Reading Material

My tutorial on iOS authentication using SwiftUI and Auth0

Banner: Get Started with iOS Authentication using SwiftUI

Hey, iOS developers! My latest tutorial article on the Auth0 blog shows you how to easily add authentication (that is, login and logout) to SwiftUI apps and display information from their user profile.

The article demonstrates the most basic use of the Auth0.swift SDK, the Auth0 SDK for all Apple platforms — not just iOS, but macOS, iPadOS, watchOS, and tvOS. It’s Auth0’s third most-used SDKs, accounting for more than one in ten API requests to Auth0 systems!

It’s a two-part tutorial. Part 1 of the tutorial starts with File → New Project…, adds some basic interactivity, adds the Auth0.swift package, walks you through setup on the Auth0 side, and finally enables login and logout:

iOS Simulator screen shot: Screen with title “SwiftUI Login Demo” and “Log in” button.
The app’s “logged out” screen.
iOS Simulator screen shot: Auth0 Universal Login screen.
Auth0’s Universal Login.
iOS Simulator screen shot: Screen with title “Logged in” and “Log out” button.
The app’s “logged in” screen.

Part 2 of the tutorial takes your basic login/logout app and gives it the ability to read user information from the user profile and display it onscreen:

iOS Simulator screen shot: Screen with title “Logged in”, photo of user, user]s name and email address, and “Log out” button.
The revised “logged in” screen.
Categories
Current Events Meetups Programming Tampa Bay

This Wednesday: the Downtown Tampa Software Developers meetup!

There’s a new tech meetup here in “The Other Bay Area” — the Downtown Tampa Software Developers — and I’m planning on attending their next meetup (and getting some dinner) this Wednesday, March 30th, at 7:00 p.m.!

Organized by Michael Berlet, it’s a weekly meetup for software developers at Tampa’s big food hall/gathering place, Armature Works, which provides a wide variety of food and drink.

Here’s the group’s description from their Meetup page:

We are a group of professional, freelance, and amateur software developers living in the vicinity of downtown Tampa.

If you’re sick of impersonal online developer webinars and want to meet, make friends, and network with other developers in physical space, then this is the group for you. We’re informal, and like to chat about work, personal projects, and life in general.

Join us! It sounds like it’ll be fun. You can RSVP on the event page.

In case you need it, here’s the parking map for Armature Works:

Categories
Programming Reading Material

Two Kotlin/data science articles from Yours Truly!

Kotlin developers who want to get into data science: these articles are for you! They’re about using Jupyter Notebook, but with Kotlin instead of Python. Why should Pythonistas make all the big bucks?

Read the articles, which appear on RayWenderlich.com (the premier mobile development site, and it’s where I learned iOS and Android dev) in this order:

  1. Create Your Own Kotlin Playground (and Get a Data Science Head Start) with Jupyter Notebook: Learn about Jupyter Notebook, get it set up on your computer, and get familiar with krangl, the Kotlin library for data wrangling.
  2. Beginning Data Science with Jupyter Notebook and Kotlin: Once you’re familiar with krangl, it’s time to get familiar with data frames and working with datasets. This article will help you get started by exploring real data, crunching it, and even getting some insights from it.

Categories
Humor Programming

The real reason programmers prefer dark themes

Comic by monstika. Click to see the source.
Categories
Humor Programming

What coding in Light Mode says about you

This made me chuckle.

Categories
Meetups Programming Tampa Bay

Building a “Wordle” function, part 1

These slides capture what we worked on Tuesday night’s “Think Like a Coder” meetup: coming up with a first attempt at a “Wordle” function. Given a guess word and a goal word, it should output a Wordle-style score.

We came up with a solution that I like to call the “close enough” algorithm. It goes through the guess word one character at a time, comparing the current guess word character with the goal word character in the same position.

When making those character-by-character comparisons, the function follows the rules:

Here’s the “close enough” algorithm, implemented in Python…

def wordle(guess_word, goal_word):
    
    # Go through the guess word one character at a time, getting...
    # 
    # 1. index: The position of the character
    # 2. character: The character at that position
    for index, character in enumerate(guess_word):
        
        # Compare the current character in the guess word
        # to the goal word character at the same position
        if character == goal_word[index]:
            # Current character in the guess word
            # matches its counterpart in the goal word
            print("green")
        elif character in goal_word:
            # Current character in the guess word
            # DOESN’T match its counterpart in the goal word,
            # but DOES appear in the goal word
            print("yellow")
        else:
            # Current character DOESN’T appear in the goal word
            print("gray")

…and here’s the JavaScript implementation:

function wordle(guessWord, goalWord) {
    
    // Go through the guess word one character at a time
    for (let index in guessWord) {
        // Compare the current character in the guess word
        // to the goal word character at the same position
        if (guessWord[index] == goalWord[index]) {
            // Current character in the guess word
            // matches its counterpart in the goal word
            console.log('green')
        } else if (goalWord.includes(guessWord[index])) {
            // Current character in the guess word
            // DOESN’T match its counterpart in the goal word,
            // but DOES appear in the goal word
            console.log('yellow')
        } else {
            // Current character DOESN’T appear in the goal word
            console.log('gray')
        }
    }
}        

I call the solution “close enough” because yellow is a special case in Wordle. If the guess word is ATOLL and the goal word is ALOFT, the first L in ATOLL should be yellow and the second should be gray because there’s only one L in ALOFT.

We didn’t settle on the “close enough” algorithm — it was just enough for that night’s session. In the next session, we’ll refine the algorithm so that it matches Wordle’s!

Want to become a better programmer? Join us at the next Think Like a Coder meetup!