Posts

Showing posts from June, 2003

Android M Light And Dark Status Bar Programmatically - How To Make It Dark Again?

Answer : The solution posted by @Aracem is valid but, doesn't work if you try change also the background color of the status bar. In my case I do it in the following way. To enable windowLightStatusBar(programatically,inside a Utils class for example): public static void setLightStatusBar(View view,Activity activity){ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { int flags = view.getSystemUiVisibility(); flags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; view.setSystemUiVisibility(flags); activity.getWindow().setStatusBarColor(Color.WHITE); } } To restore to StatusBar to the previous state: public static void clearLightStatusBar(Activity activity) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { Window window = activity.getWindow(); window.setStatusBarColor(ContextCompat .getColor(activity,R.color.colorPrimaryDa

Bootstrap Flexdirection Row Code Example

Example 1: bootstrap flex direction column d-flex flex-column Example 2: flex direction column bootstrap 4 ... ... ... ... ...

Color Picker Google Chrome Extension Code Example

Example: chrome color picker To open the Eye Dropper simply: 1. Open DevTools F12. 2. Go to Elements tab. 3. Under Styles side bar click on any color preview box.

CMake Support "make Uninstall"?

Answer : If you want to add an uninstall target you can take a look to the official CMake FAQ at: https://gitlab.kitware.com/cmake/community/wikis/FAQ#can-i-do-make-uninstall-with-cmake If you just want a quick way to uninstall all files, just run: xargs rm < install_manifest.txt install_manifest.txt file is created when you run make install . No there is not. See in the FAQ from CMake wiki: By default, CMake does not provide the "make uninstall" target, so you cannot do this. We do not want "make uninstall" to remove useful files from the system. If you want an "uninstall" target in your project, then nobody prevents you from providing one. You need to delete the files listed in install_manifest.txt file. [followed by some example code] Remove files and folders (empty only) added by make install from a cmake project: cat install_manifest.txt | sudo xargs rm cat install_manifest.txt | xargs -L1 dirname | sudo xargs rmdir -p

Built In Python Hash() Function

Answer : As stated in the documentation, built-in hash() function is not designed for storing resulting hashes somewhere externally. It is used to provide object's hash value, to store them in dictionaries and so on. It's also implementation-specific (GAE uses a modified version of Python). Check out: >>> class Foo: ... pass ... >>> a = Foo() >>> b = Foo() >>> hash(a), hash(b) (-1210747828, -1210747892) As you can see, they are different, as hash() uses object's __hash__ method instead of 'normal' hashing algorithms, such as SHA. Given the above, the rational choice is to use the hashlib module. Use hashlib as hash() was designed to be used to: quickly compare dictionary keys during a dictionary lookup and therefore does not guarantee that it will be the same across Python implementations. The response is absolutely no surprise: in fact In [1]: -5768830964305142685L & 0xffffffff Out[1]: 1934711907L

Bootstrap 4 Docs Code Example

Example 1: bootstrap 4 cdn <!-- Boostrap 4 CSS --> < link rel = " stylesheet " href = " https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css " integrity = " sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh " crossorigin = " anonymous " > < script src = " https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js " integrity = " sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6 " crossorigin = " anonymous " > </ script > <!-- Boostrap JS --> < script src = " https://code.jquery.com/jquery-3.4.1.slim.min.js " integrity = " sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n " crossorigin = " anonymous " > </ script > < script src = " https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js " integrity = &qu

200f To C Code Example

Example: 14 f to c 14 °F = - 10 °C

Array Formula On Excel For Mac

Answer : This doesn't seem to work in Mac Excel 2016. After a bit of digging, it looks like the key combination for entering the array formula has changed from ⌘ + RETURN to CTRL + SHIFT + RETURN . Select the range, press CONTROL + U and then press ⌘ + RETURN .

Cdn Semantic Ui Code Example

Example 1: semantic ui cdn < link rel = " stylesheet " href = " https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css " > Example 2: semantic-ui cdn < link rel = " stylesheet " href = " https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css " > Example 3: cdnjs smeantic ui //add this to your index.html file, inside head tag < link rel = " stylesheet " href = " https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css " /> Example 4: semantic ui cdn < script src = " https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.js " > </ script >

Camtasia 2021 Offline Activation Code Example

Example: camtasia 2020 offline activation UHGFS-WERTG-HJ6UY-GFDSE-RTYH9 FSW6Q-AZXDE-WQAZX-CVG7K-JNBVG

Android Canvas Clear With Transparency

Answer : Use the following. canvas.drawColor(Color.TRANSPARENT,Mode.CLEAR); The solution was to create a secondary canvas and bitmap to draw on. My Custom View's onSizeChanged() method looked like @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); bitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888); bitmap.eraseColor(Color.TRANSPARENT); temp = new Canvas(bitmap); } and the onDrawMethod looks like @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); temp.drawColor(Color.argb(80, 0, 0, 0)); temp.drawCircle(centerPosX, centerPosY, 200, transparentPaint); canvas.drawBitmap(bitmap, 0, 0, null); } where transparentPaint is declared in the onstructor as transparentPaint = new Paint(); transparentPaint.setColor(getResources().getColor(android.R.color.transparent)); transparentPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.

Chrome Keyboard Shortcut To Pause Script Execution

Answer : While I haven't found the exact solution to this problem, I did come up with a one-liner that can be put in a page (or pasted in the Javascript console) to achieve my goal: jQuery(window).keydown(function(e) { if (e.keyCode == 123) debugger; }); This will cause execution to be paused when you hit F12 . ( debugger is a JavaScript statement that forces a breakpoint.) Update: Dev Tools has many built-in shortcuts (press F1 for a list), but you must be focused in the Dev Tools window for them to work. Pausing script execution is F8 (when looking at the Sources tab, as of Chrome 45) or Ctrl + / . The above one-liner might still be useful if you need to stay focused in the page before pausing. Google's Keyboard Shortcuts Reference lists for "Pause / resume script execution": F8 or Ctrl + \ (Windows) F8 or Cmd + \ (Mac) There are easier ways to inspect things in odd states like hover or active. First, find the DOM node in the Elements

Avatar The Last Airbender Font Code Example

Example: avatar the last airbender The best tv show!

Angular 5, NullInjectorError: No Provider For Service

Answer : You need to add TesteventService under providers under imports in your app.module.ts providers: [ TesteventService ] Annotate your service class with - @Injectable({ providedIn: 'root' }) The service itself is a class that the CLI generated and that's decorated with @Injectable() . By default, this decorator has a providedIn property, which creates a provider for the service. In this case, providedIn: 'root' specifies that Angular should provide the service in the root injector.

Calculate Pandas DataFrame Time Difference Between Two Columns In Hours And Minutes

Answer : Pandas timestamp differences returns a datetime.timedelta object. This can easily be converted into hours by using the *as_type* method, like so import pandas df = pandas.DataFrame(columns=['to','fr','ans']) df.to = [pandas.Timestamp('2014-01-24 13:03:12.050000'), pandas.Timestamp('2014-01-27 11:57:18.240000'), pandas.Timestamp('2014-01-23 10:07:47.660000')] df.fr = [pandas.Timestamp('2014-01-26 23:41:21.870000'), pandas.Timestamp('2014-01-27 15:38:22.540000'), pandas.Timestamp('2014-01-23 18:50:41.420000')] (df.fr-df.to).astype('timedelta64[h]') to yield, 0 58 1 3 2 8 dtype: float64 This was driving me bonkers as the .astype() solution above didn't work for me. But I found another way. Haven't timed it or anything, but might work for others out there: t1 = pd.to_datetime('1/1/2015 01:00') t2 = pd.to_datetime('1/1/2015 03:30') print pd.Timedelta(t2

Color Similarity/distance In RGBA Color Space

Answer : Finally, I've found it! After thorough testing and experimentation my conclusions are: The correct way is to calculate maximum possible difference between the two colors. Formulas with any kind of estimated average/typical difference had room for discontinuities. I was unable to find a working formula that calculates the distance without blending RGBA colors with some backgrounds. There is no need to take every possible background color into account. It can be simplified down to blending maximum and minimum separately for each of R/G/B channels: blend the channel in both colors with channel =0 as the background, measure squared difference blend the channel in both colors with channel =max as the background, measure squared difference take higher of the two. Fortunately blending with "white" and "black" is trivial when you use premultiplied alpha. The complete formula for premultiplied alpha color space is: rgb *= a // colors must b

Android Button TextAppearance

Answer : The values of attributes defined using textAppearance are applied before the values of attributes in a style. A Button is a TextView with a style applied, and the default style of a Button will override your textAppearance (Android 2.3 for example will set it to ?android:attr/textAppearanceSmallInverse) and textColor. textAppearance excepts styles as values, android:textAppearance="@style/login_button_text_appearance" is the normally correct way to set a textAppearance, but not for a Button : If you're changing the text colour of a Button , you should also enforce a custom background image because if you don't, one device will use a dark background image (motorola defy) and another will use a light image (htc desire) which may make the text difficult to read. I think you should use : style = "@style/login_button_text_appearance" instead of: android:textAppearance="@style/login_button_text_appearance" The android:textAppe