Script

2020-07-23

Screen resolutions

Grafik
Some standrad screen resolutions and sizes with the same ratios
720p = 1280 x 720 (HD), ratio: 16/9
1080p = 1920 x 1080 (2K, FHD, Full HD), ratio: 16/9
1440p = 2560 x 1440 (QHD, Quad HD, 4 x HD), ratio: 16/9
2160p = 3840 x 2160 (4K, UHD or Ultra HD, 4 x FHD), ratio: 16/9
4320p = 7680 x 4320 (8K, 16 x FHD), ratio: 16/9

Some sizes with same ratio (16/9):
1200 x 675
1040 x 585
800 x 450
640 x 360
320 x 180
256 x 144
128 x 72
80 x 45
64 x 36
48 x 27

Some sizes with older standard ratio (4/3):
1280 x 960 (sxga)
1024 x 768 (xga)
800 x 600 (svga)
640 x 480 (vga)
320 x 240 (qvga)
160 x 120
120 x 90
80 x 64
48 x 36
32 x 24
2020-06-28

DNS

Provider
Cloudflaires dns-servrar
1.1.1.1
1.0.0.1
2020-06-07

Telefon-länk

Html
Klicka för att ringa!
<a href="tel:1-562-867-5309">Click to Call!</a>
2019-06-12

Wildcards i DNS

Provider
Inställningar i DNS
* = Whatever subdomän
@ = utan www (eller subdomän)
2018-12-03

General Tree Class

Php
A general class for constructing recursive trees (that can include a list of other trees of the same class as the tree itself)
<?php
/**
Copyright Rolf Fredriksson ROSiRO Dec 2018. https://www.webman.se

General class that collects a recursive tree of tree objects from database.
Uses 4 fields: id, parent_id, name and place from a given table stored in
the global variable $db_table. The top parent id is 0 and all other objects
must track up to this.

The class can be changed by altering the sql question, for instance
to display and sort on other fields or by adding a global variable
to keep track on which parts of the Tree that is in use.

Use like this:
// 1. Create top object: id, path to parent, name
$oTree = new Tree(0, array(0), 'top');

// 2. Build a tree of Tree objects: Tree object, path
$oTree->buildTree($oTree, array(0));

// 3. Use the object (as many times you want)
function showTree($oTree) {
	foreach($oTree->getSubtrees() as $o) {
		echo $o->getName(), '<br />';
		// Do something more...
		showTree($o); // Recursive call
	}
}
showTree($oTree);
*/

class Tree {
	
	protected $id;       // int
	protected $aPath;    // array of parent ids, from top level down
	protected $name;     // str
	protected $subtrees; // array of objects
	
	function __construct($id, $aPath, $name) {
		$this->id       = intval($id);
		$this->aPath    = $aPath;
		$this->name     = $name;
		$this->subtrees = array();
	}
	
	function buildTree($oTree, $aPath) {

		global $conn, $db_table;

		// Get last id from path and use it as parent to get the sub-items...
		$sql = "select * from " . $conn->escape($db_table) .
		" where parent_id = " . $aPath[count($aPath) - 1] . " order by place";
		$rs = $conn->getResult($sql);
		
		foreach (new LimitIterator($rs, 0) as $row) {
			
			// Copy the path array and add the new id...
			$path = $aPath; 
			$path[] = $row['id'];
			
			// Create and add a new sub-tree with that id and path...
			$tree = new Tree($row['id'], $path, $row['name']);
			$oTree->subtrees[] = $tree;
			
			// Build the new tree...
			$this->buildTree($tree, $path); // Recursive call
			
		}
		
	}
	
	function getId()       { return $this->id; }
	function getParentId() { return $this->aPath[count($this->aPath) - 2]; }
	function getPath()     { return $this->aPath; }
	function getLevel()    { return count($this->aPath) - 2; }
	function getName()     { return $this->name; }
	function getSubtrees() { return $this->subtrees; }

} ?>