• Linux bash printer run time


    #!/bin/bash function ShowTime() { endTime=`date +’%Y-%m-%d %H:%M:%S’` start_seconds=$(date –date=”$startTime” +%s); end_seconds=$(date –date=”$endTime” +%s); usedTime=$((end_seconds-start_seconds)) #Display in red font for more than 2 seconds, yellow font for 1-2s and green font for less than 1 s if [[ $usedTime -ge 2 ]] then echo -e “\033[31mUsed time:$usedTime s \033[0m” elif [[ $usedTime -ge 1 ]] then […]

  • Imagerectforcontentrect, titlerectforcontentrect, contentrectforbounds, when is imagerectforcontentrect called


    Layout order details of uibutton When to call imagerectforcontentrect, titlerectforcontentrect, contentrectforbounds, imagerectforcontentrect is also the time to call. First, clear the rules of several layouts: Changing the size of the view triggers layoutviews Changing X or y of view will not trigger layoutsubviews Changing the size of the subview will trigger the layoutsubviews of the […]

  • C # Change the background color of the console


    Previously, I found a problem related to static constructors that I had unintentionally encountered. Change the background color of the console. static void Main(string[] args) { // Setting Green Console.BackgroundColor = ConsoleColor.Green; Console. WriteLine (“Background color changed”); } This code will look like this when it runs. Not in line with the desired results. So […]