Advertisement

Advertisement

Create custom launcher in Windows for custom file extensions

In Windows, you can associate any custom command with a file extension. For example, if you want Windows to automatically run Java .jar files using the command java -jar. These examples will walk through the steps necessary to do this:

  • Update the PATHEXT environment variable
  • Associate the file extension to a file type
  • Specify a command to run when that file type is executed

This example will focus on using java to run a .jar file, but this example works just as good for any custom application, or creating script runners for Python and Ruby.

Schedule a shutdown in Windows (sleep timer)

I enjoy listening to audio books and sometimes I want to listen a little bit before going to sleep. Audible has a sleep timer built-in to the app, but I wanted my entire computer to shut down.

You can use the built-in shutdown command in Windows to schedule a shutdown. These examples will show how to schedule a shutdown and how to cancel a scheduled shutdown from the command-line.

curl Tutorial

curl (https://curl.haxx.se/) is an incredibly useful and powerful command-line tool and library. The latest version at the time of this writing is 7.68.0 released January 8, 2020. You can download it from https://curl.haxx.se/download.html and the source code is available at https://github.com/curl/curl.

It's primary purpose is transferring data over network protocols like HTTP and HTTPS. It supports a large number of other protocols including: FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, Telnet and TFTP. It also supports SSL/TLS encryption, cookies, authentication, and proxies.

You can use it as a command-line tool by calling curl or you can use it as a library inside C, C++, or other applications. We will look at several things in this tutorial including:

  • Basic curl usage for making HTTP requests
  • Downloading files
  • Compiling from source
  • Using curl in a C++ application

Compiling SQLite3 with C++

If you want to write a C++ program that utilizes Sqlite3 you will need to take an extra step in the compile and link process in order to compile Sqlite3 with the C compiler (gcc), and then your C++ program with the C++ compiler (g++) If you try to compile Sqlite3 with g++ it will error.

For this example, I am using g++ and gcc to compile. I tested this in Windows 10 with MinGW64, but it should also work in Linux and Mac.

If you want to learn more about using SQLite3, check out my other tutorials:

Bob Martin's Open Letter to the Linux Foundation

There was recently an incident with the Linux Foundation where a member was booted from the organization following a public Tweet "outing" him as a Trump supporter. The Linux Foundation apparently reviewed this request and deemed the person in question was violating the Linux Foundation code of conduct. This decision was met with controversy. Many people do not understand the decision and believe it was made purely based on his political affiliation and not any action he has taken.

United Airlines Wi-Fi is Limited

Recently I took a nice long 12-hour flight with United Airlines from the US to Tel Aviv, Israel. I was excited when I learned I could purchase wi-fi during the long flight. What would I do to kill the time? Probably the same things I normally waste my time on like browsing Reddit and chatting on Discord.

Well, too bad you can't do either of those because they are blocked. I thought maybe I could get around it by installing OpenVPN from the Google Play Store and connecting to one of my remote servers. Nope, you can't access the Google Play Store either. So I can't install any games or other apps, can't chat, and can't browse Reddit.

I paid almost $30 for wi-fi access and I can't access any of the primary things that I wanted to access on my Android tablet:

  • Reddit
  • Discord
  • Google Play Store

How to Publish Android Apps to Google Play Store

Building Android apps can be really easy to get started with. There is a bit of a hurdle when it comes to jumping from the debug build to a release build because it requires keystores and private keys and app signing. It can be confusing. This guide will walk through all the steps needed to build a release APK that is fit for distribution and can be uploaded to the Google Play Store.

With the knowledge in this guide, you will be able to build signed release APKs that can be distributed and uploaded to the Google Play Store.

This guide assumes you already have an Android app or know how to create one, but only using debug builds. This guide will walk through the process of creating the keystore and signing APKs with self-signed certificates for distribution on the Google Play Store.

If you don't know hot to build Android apps, check out my Android related tutorials and streams:

You can also read up on the official Android Developer Documentation and Android Distribution Guide.

Java Keytool Tutorial

Java has a tool named keytool that lets you do common tasks like

  • Generate RSA keys and self-signed SSL certificates
  • Import and export certificates
  • Print certificate information
  • Generate and sign certificate signing requests

It also stores everything in a secure file that has a master password in addition to specific passwords for each key it stores. You can think of it kind of like a little password protected SQLite database with your keys and certs (though there is no SQL involved).

Arduino Libraries Tutorial

If you have ever written an Arduino sketch or function that you want to re-use or share, creating a library for it is a great idea. In this guide, we will look at creating, importing, and using libraries. We will also look at creating and using examples that come with a library. You wil learn all the basics about managing libraries and even create your own custom library.

This guide will help you understand how to:

  • Create and distribute a Arduino library ZIP
    • With examples that can be opened via File -> Examples menu
    • That can be imported via the Sketch -> Include Library -> Add ZIP Library
  • Create and open sketches that are found with the File -> Sketchbook menu
  • Include libraries in to your sketches

Seeeduino Nano Tutorial

Seeed Studio offers an Arduino-compatible Nano board, Seeeduino Nano. It is like an Arduino Nano, but with some noticeable differences:

  • Seeeduino Nano currently costs $6.90 and the Arduino Nano $22.00
  • Seeeduino Nano has a USB-C connector instead of Mini-USB
  • Seeeduino Nano comes with a Grove connector

Otherwise, it has the same Atmega328P procesor, size, and pins. You can use Nano breakout boards like the Grove Shield for Arduino Nano.

This guide will look at the board features, how to compile and upload sketches using the Arduino CLI, and how to use the Grove system modules.

Python Kivy Tutorial

Kivy can build applications for desktop and mobile including Android and iOS. The same code base can be used for both desktop and mobile, depending on what hardware devices you are trying to access.

This guide will walk through the basics of installing Kivy, building simple applications, building and packaging them for desktop and Android.

For an example of a complete project, check out my Bitcoin Price Checker example with the Live Stream on YouTube.

Alternatives for desktop application programming with Python are PyQt5, Tkinter, and wxPython. Those packages have a more traditional desktop UI but lack the Android and iOS build capabilities the same way Kivy has. Qt technically supports Android but it is not easy to build with PyQt5.

Expose a Local Port over a Remote VPS with SSH Remote Port Forwarding

There are occassions when you want to expose a local port to the world so it can be accessed publicly on the internet.

For example, if you want to:

  • Share you local development environment publicly
  • Be able to receive webhooks from external services for your local development environment like Stripe webhooks
  • Expose a local database to the internet via a remote server

One option is to log in to your router, typically https://192.169.1.254/ or something similar, and configure port forwarding. That will let you tell the router to take incoming traffic for a specific port and send it your local computer. This can be annoying because you have to undo the change when you are done, which is easy to forget about, and you may not have access to your router with admin privileges at all. You can also run in to port conflicts.

Another option is to use a remote host, like a VPS rented from a service like Digital Ocean to expose your port to the internet. You can do this by using SSH port forwarding (tunneling) to securely forward a port from your local computer to a port on the Digital Ocean VPS. In turn, you can expose that port on the VPS to the internet.

This example is like an exercise in setting up your own ngrok service.

Python Logging Tutorial

This is a simple guide to Python core logging package basics. The Python logging package is very powerful and widely used. For example, Django uses Python's built-in logging package.

For the most in-depth and up-to-date information, always refer to the official Python logging documentation. This guide will walk through a summary of the things I think are most important and useful in my regular work.

STDIN, STDOUT, STDERR, Piping, and Redirecting

Operating systems recognize a couple special file descriptor IDs:

  • STDIN - 0 - Input usally coming in from keyboard.
  • STDOUT - 1 - Output from the application that is meant to consumed by the user, stored in a file, or piped to another application for parsing. Typically goes to terminal.
  • STDERR - 2 - Used for info, debug, and error messages to the user that are not intended to specifically be part of the application output. Typically goes to terminal.

This guide will look at how you can redirect and pipe these streams for better application development and system administration.

Electron with Angular Tutorial

Electron is an amazing framework that lets you create desktop application using JavaScript, HTML, and CSS. It is essentially a web application that is self contained as a desktop application. The Electron API lets you access native system elements like the system tray icons, menus, dialogs, etc.

In this guide, we will look at how to create an Electron application with the Angular framework using TypeScript. We will cover:

  • Building a project from scratch
  • Packaging the desktop application for distribution
  • Using live reloading for development
  • Using Electron APIs for inter-process communication

Recursively Copy, Delete, and Move Directories in Windows

If you need to copy an entire directory to a new destination in Windows, you can use xcopy. This guide will show you how to use xcopy to recursively copy a directory, all of its subdirectories, and include hidden files. We will also look at how to remove a directory with rmdir and move a directory with move.

Set Environment Variables in Windows

In Windows, you sometimes need to modify environment variables. There are environment variables like %APPDATA% and %PROGRAMFILES% which contain useful paths, and others that contain things like your username (%USERNAME%). An important one that you may want to modify is %PATH%. In this guide we will look at how to set, check, update, and unset environment variables using the GUI and the command prompt.

Note that environment variables are case-insentive and that there are system-wide environment variables and user-specific environment variables.

Create a Windows .ico Icon File

When creating icons for Windows applications, sometimes you can't just use a .png file and you must use a special .ico format.

The ICO format is a collection of .png or .bmp images in a special structure. Fortunately, there are readily available tools to help you take a simple .png and convert it to the .ico file. This guide will look at a couple options.

NativeScript Tutorial

NativeScript is an amazing framework that lets you create cross-platform mobile applications for Android and iPhone using TypeScript. Not only does it allow you to use TypeScript, but you can also use Vue.js or Angular frameworks!

In this guide, I will focus on installing the necessary tools to build an Android application using the Angular framework in Windows.

Advertisement

Advertisement