Recently Updated Pages

Capture stdout

Sometimes, it's required to capture the stdout from a function or module import. This is natively...

Flash taskbar icon

To flash the Windows taskbar icon, use the bundled Python library ctypes. import ctypes ctypes....

Get creation date of a file

Uses os and datetime. import os from datetime import datetime def getCreateDate(filepath): ...

Generator expressions

Generator expressions can be used to generate lists and dictionaries based on a condition in Pyth...

Using bytes with files

To open a bytes-like file for writing, use wb. open(file, "wb") To open a bytes-like file for r...

Cron and Python

Very often I end up using and working with external files in Python, and occasionally I use the t...

Vertically and horizontally center an element

Will center an element both vertically and horizontally in the element's parent element. Element....

Send POST data using a HTTP request

Sometimes the need arises to send POST data in a HTTP request. This is (relativley) simply achiev...

GET/POST variables

GET and POST are two methods used to request data as part of the HTTP protocol. GET variables G...

Create a download

To download a file instead of just displaying it requires multiple specific headers to be set. $...

Content-Type headers

Depending on what types of media you want to display using PHP, you need to set different values ...

Sanitizing and Validating User Data

When users submit data, you need to make sure that they've provided something you expect. Saniti...

Parameterised SQL

Parameterised SQL should be used whenever you are querying a SQL database using external input (s...

Including files

Files can be included in other PHP files using include.  Including a file will run any code withi...

Postpone JS import until DOM is loaded

Sometimes when using Javascript on a webpage, you need to wait until the entire page has loaded i...

Get contents of remote file

Using Javascript, it is often useful to request the contents of a file and then process that file...

Get items from the query string

First start by defining a constant that references the query string. const queryString = new URL...

Hide/show elements

Hiding and showing elements using Javascript is done by modifying the CSS of elements. Hiding an...

Back to top