Advertisement

Advertisement

Run Python Script as Windows Service

If you want to run a Python script as a Windows service you can use the Non-Sucking Service Manager to create the service. This application allows you to easily create a service using any executable or batch script that gets treated as a proper Windows service that you can manage Windows services by running services.msc or by going to the Services tab from the Task Manager.

The most common use case for running a Python script as a service is to ensure an application is always run and starts running when you log in. For example, if you have a web application that you want to stay running whenever the computer is up. I have used this method to run Flask applications and other utilities.

Working with Dates and Times in Python 3

Working with dates and times in any programming language can be a huge hassle. There are so many ways to mess up when using different date and time formats, dealing with timezones, and accounting for daylight savings time. There are a lot of things to remember to get right. I'll show you everything you need to know about working with dates and times in Python to make it easy so you can feel confident any time you have work with them.

How to Setup Drupal for Local Development with Just PHP

With older versions of Drupal you could not run Drupal without Apache or Nginx to perform the URL rewrites needed to use the application with clean URLs.

New versions of Drupal (8+) come with a .ht.router.php file that is specifically used to run local development instances with just the built-in PHP web server. No Apache, no Wamp, no Mamp, no Xampp. Just the built-in PHP server.

In addition, you don't have to use MySQL an setup a separate database. Drupal supports SQLite3 so can completely skip any MySQL setup.

This means you can run a local Drupal development environment with nothing but PHP.

  • No Apache
  • No MySQL
  • No Wamp,Xampp,Mamp
  • Just PHP

Following the method in this guide works on Windows, Mac, and Linux equally.

Run JavaScript After DOM is Fully Loaded

Introduction

When writing JavaScript for a web browser, there are times when you want the page to fully load before the code is executed. This is particularly true if your JavaScript manipulates or utilized the HTML DOM. Your JavaScript will fail if it tries to reference an element that has not yet been loaded. This example will show you how to defer code from being executed until the web page has fully loaded.

Tips and Tricks for Colab

Colaboratory, or Colab for short, is a browser-based Python interpreter built by Google. It extends the open source Jupyter Notebook project.

With additional niceties such as Markdown previews, free GPU, and the ability to make a comment just like you would any Google Docs, Colab is quickly becoming the Python environment of choice among developers in machine learning, data science, and AI research spaces.

Here are few practical Tips and Tricks to help you get the most out of Colab.

Working with Git Repositories in Python

The GitPython project allows you to work in Python with Git repositories. In this guide we'll look at some basic operations like:

  • Initializing a repo
  • Cloning a repo
  • Adding and committing
  • Pushing and pulling with remotes
  • Checking for changes
  • Getting a diff
  • Listing and switching branches

For full documentation, see https://gitpython.readthedocs.io/. The source code is available at https://github.com/gitpython-developers/GitPython.

Advertisement

Advertisement