android.support.v4.content.FileProvider not found

As of AndroidX (the repackaged Android Support Library), the path is androidx.core.content.FileProvider so the updated provider tag would be: <provider android:name=”androidx.core.content.FileProvider” android:authorities=”${applicationId}.fileprovider” android:exported=”false” android:grantUriPermissions=”true”> <meta-data android:name=”android.support.FILE_PROVIDER_PATHS” android:resource=”@xml/file_paths” /> </provider> Android Support Libraries are now in the androidx.* package hierarchy. android.* is now reserved to the built-in Android System Libraries.

How to create a random string using PHP?

If you want to allow repetitive occurences of characters, you can use this function: function randString($length, $charset=”ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789″) { $str=””; $count = strlen($charset); while ($length–) { $str .= $charset[mt_rand(0, $count-1)]; } return $str; } The basic algorithm is to generate <length> times a random number between 0 and <number of characters> − 1 we use as …

Read more

Keyboard events in a WPF MVVM application?

To bring an updated answer, the .net 4.0 framework enables you to do this nicely by letting you bind a KeyBinding Command to a command in a viewmodel. So… If you wanted to listen for the Enter key, you’d do something like this: <TextBox AcceptsReturn=”False”> <TextBox.InputBindings> <KeyBinding Key=”Enter” Command=”{Binding SearchCommand}” CommandParameter=”{Binding Path=Text, RelativeSource={RelativeSource AncestorType={x:Type TextBox}}}” …

Read more

Palindrome check in Javascript

Maybe I will suggest alternative solution: function checkPalindrom (str) { return str == str.split(”).reverse().join(”); } UPD. Keep in mind however that this is pretty much “cheating” approach, a demonstration of smart usage of language features, but not the most practical algorithm (time O(n), space O(n)). For real life application or coding interview you should definitely …

Read more

Should we hire someone who writes C in Perl? [closed]

I advise people to never hire Perl programmers, or C programmers, or Java programmers, and so on. Just hire good people. The programmers who I’ve hired to write Perl were also skilled in various other languages. I hired them because they were good programmers, and good programmers can deal with multiple languages. Now, that code …

Read more