Clearing the screen by printing a character?

If you want to clear the screen, the “ANSI” sequence in a printf \033[2J clears the entire screen, e.g., printf ‘\033[2J’ The command-line clear program uses this, along with moving the cursor to the “home” position, again an “ANSI” sequence: \033[H The program gets the information from the terminal database. For example, for TERM=vt100, it … Read more

Storing a string as UTF8 in C#

Well, you could create a wrapper that retrieves the data as UTF-8 bytes and converts pieces as needed to System.String, then vice-versa to push the string back out to memory. The Encoding class will help you out here: var utf8 = Encoding.UTF8; byte[] utfBytes = utf8.GetBytes(myString); var myReturnedString = utf8.GetString(utfBytes);

Convert non-ASCII characters (umlauts, accents…) to their closest ASCII equivalent (for slug creation)

The easiest way I’ve found: var str = “Rånades på Skyttis i Ö-vik”; var combining = /[\u0300-\u036F]/g; console.log(str.normalize(‘NFKD’).replace(combining, ”)); For reference see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)