How to format code in Xcode? 

Select first the text you want to format and then press Ctrl+I. Use Cmd+A first if you wish to format all text in the selected file. Note: this procedure only re-indents the lines, it does not do any advanced formatting. In XCode 12 beta: The new key binding to re-indent is control+I.

How to read from input until newline is found using scanf()?

scanf (and cousins) have one slightly strange characteristic: white space in (most placed in) the format string matches an arbitrary amount of white space in the input. As it happens, at least in the default “C” locale, a new-line is classified as white space. This means the trailing ‘\n’ is trying to match not only … Read more

How to display hexadecimal numbers in C?

Try: 0 – Left-pads the number with zeroes (0) instead of spaces, where padding is specified. 4 (width) – Minimum number of characters to be printed. If the value to be printed is shorter than this number, the result is right justified within this width by padding on the left with the pad character. By default this … Read more

C – The %x format specifier

Break-down: 8 says that you want to show 8 digits 0 that you want to prefix with 0‘s instead of just blank spaces x that you want to print in lower-case hexadecimal. Quick example (thanks to Grijesh Chauhan): Output: Also see http://www.cplusplus.com/reference/cstdio/printf/ for reference.

Current time formatting with Javascript

A JavaScript Date has several methods allowing you to extract its parts: getFullYear() – Returns the 4-digit yeargetMonth() – Returns a zero-based integer (0-11) representing the month of the year.getDate() – Returns the day of the month (1-31).getDay() – Returns the day of the week (0-6). 0 is Sunday, 6 is Saturday.getHours() – Returns the hour of the day (0-23).getMinutes() – … Read more