Difference between a “coroutine” and a “thread”?

First read: Concurrency vs Parallelism – What is the difference? Concurrency is the separation of tasks to provide interleaved execution. Parallelism is the simultaneous execution of multiple pieces of work in order to increase speed. —https://github.com/servo/servo/wiki/Design Short answer: With threads, the operating system switches running threads preemptively according to its scheduler, which is an algorithm … Read more

Can’t apply system screen brightness programmatically in Android

OK, found the answer here: Refreshing the display from a widget? Basically, have to make a transparent activity that processes the brightness change. What’s not mentioned in the post is that you have to do: Settings.System.putInt(y.getContentResolver(),Settings.System.SCREEN_BRIGHTNESS_MODE, 0); Settings.System.putInt(y.getContentResolver(),Settings.System.SCREEN_BRIGHTNESS, brightnessLevel); then do WindowManager.LayoutParams lp = getWindow().getAttributes(); lp.screenBrightness = brightness; getWindow().setAttributes(lp); And if you call finish() right … Read more

How to get the actual (localized) folder names? [duplicate]

You can get the localized display name with the SHGetFileInfo API: public static string GetDisplayName(Environment.SpecialFolder specialFolder) { IntPtr pidl = IntPtr.Zero; try { HResult hr = SHGetFolderLocation(IntPtr.Zero, (int) specialFolder, IntPtr.Zero, 0, out pidl); if (hr.IsFailure) return null; SHFILEINFO shfi; if (0 != SHGetFileInfo( pidl, FILE_ATTRIBUTE_NORMAL, out shfi, (uint)Marshal.SizeOf(typeof(SHFILEINFO)), SHGFI_PIDL | SHGFI_DISPLAYNAME)) { return shfi.szDisplayName; } … Read more