Posts

Showing posts from July, 2002

Android M Camera Intent + Permission Bug?

Answer : I had the same issue and find this doc from google: https://developer.android.com/reference/android/provider/MediaStore.html#ACTION_IMAGE_CAPTURE "Note: if you app targets M and above and declares as using the CAMERA permission which is not granted, then atempting to use this action will result in a SecurityException." This is really weird. Don't make sense at all. The app declares Camera permission using intent with action IMAGE_CAPTURE just run into SecurityException. But if your app doesn't declare Camera permission using intent with action IMAGE_CAPTURE can launch Camera app without issue. The workaround would be check is the app has camera permission included in the manifest, if it's , request camera permission before launching intent. Here is the way to check if the permission is included in the manifest, doesn't matter the permission is granted or not. public boolean hasPermissionInManifest(Context context, String permissionName)

Btn-default Bootstrap 4 Code Example

Example 1: bootstarp btn colors <button type= "button" class= "btn btn-primary" > Blue </button> <button type= "button" class= "btn btn-secondary" > Grey </button> <button type= "button" class= "btn btn-success" > Green </button> <button type= "button" class= "btn btn-danger" > Red </button> <button type= "button" class= "btn btn-warning" > Yellow </button> <button type= "button" class= "btn btn-info" >Ligth blue </button> <button type= "button" class= "btn btn-light" > White </button> <button type= "button" class= "btn btn-dark" > Black </button> <button type= "button" class= "btn btn-link" > White with blue text</button> Example 2: bootstrap 4 button <button type= "button&quo

Abs In Js Code Example

Example 1: how to get an absolute in js var value = Math . abs ( - 10 ) ; // value returns 10 Example 2: js absolute value Math . abs ( - 4 ) //returns 4 Math . abs ( 4 ) //returns 4 Example 3: javascript abs //Return the absolute value of number Math . abs ( number ) ; Example 4: javascript math absolute Math . abs ( - 7.25 ) ; // returns 7.25

Can We Use More Colors In Batch Script?

Image
Answer : Can I use more the 16 colours in a Windows batch file? No, as most most Windows apps only support 16 colours. However, in the Windows 10 Insiders Build #14931 the Windows Console was updated to support 24-bit RGB true color. Unfortunately as mentioned above most Windows apps cannot make use of this enhancement (yet). However, using Windows Subsystem for Linux (WSL), Linux scripts and tools can use the Console's new 24-bit color support: One of the most frequent requests we receive is to increase the number of colors that the Windows Console can support. We love nothing more than to deliver features you ask for! But rather than just add a few more colors, or limit our console to a mere 256 colors, in Windows 10 Insiders Build #14931, we’ve updated the Windows Console to support full, glorious 24-bit RGB true color! This is actually a little tricky to demo since most Windows apps only support 16 colors at most whereas the Linux world has broadly supported 256 col

Chrome Extension Vue-devtools Not Detecting Vue

Answer : I found this simple workaround: right click the Vue icon and click Manage extensions Scroll down and enable Allow access to file URLs Restart your Chrome, and you'll be good. NOTE: You might need to turn on debug mode by adding this line at the beginning of your script Vue.config.devtools = true; If using Vue 3, you need the new version of the extension that is currently still in beta https://chrome.google.com/webstore/detail/vuejs-devtools/ljjemllljcmogpfapbkkighbhhppjdbg?hl=en When using the answer to samayo for beginners is not complete. It is important for confused people to know the code that is placed in some location. The cause of leading to the problem is that you are using Vue.js from CDN. You should add the Vue.config.devtools = true; code snippet in your xxx.js file. For example: example.js Vue.config.devtools = true; new Vue({ el: '#app', data: { message: 'Hello Vue!', } }) Reference: https://github.com/v

Android - Are There Any Stats Of Android Version Distribution By Region?

Image
Answer : Not for those "ancient versions", but for Android 4.0+ you can find some stats in Christina's Blog. Giving the example matching closest to your question: I answered a similar question some time ago. The best source I could find was this site, which bases its statistics on Internet traffic generated on the domain .mobi , managed by the domain registry Afilias, by mobile devices. The site gives access to statistics on the web usage by different OS versions (not only Android) by country. With the free access it is possible to select the country to look up, but with paid plans there are a lot of filters available to refine the queries. The process of comparing data can be lengthy, though, as you must look up country by country, there is no general overview. Also note that: the statistics cannot be precise, as they are bounded to accesses on that particular domain name, but I think they can serve well for an overview. StatCounter have stats by region, showing

24cm In Inches Code Example

Example: cm to inch 1 cm = 0.3937 inch

Color Hex Code Finder Code Example

Example 1: html color codes #1ca69d #e31ce0 #c13e72 #99b34d #3affb9 #6c7093 #b35ba0 #1b1452 Example 2: hex color code finder rgb(244, 116, 33) Example 3: html color codes Use htmlcolorcodes.com for this

String Comparison In C Code Example

Example 1: how to compare strings in c if ( strcmp ( strA , strB ) != 0 ) { . . . } Example 2: see if two strings are equal in C # include <stdio.h> # include <string.h> int main ( int argc , char const * argv [ ] ) { char string1 [ ] = { "tutorials point" } ; char string2 [ ] = { "tutorials point" } ; //using function strcmp() to compare the two strings if ( strcmp ( string1 , string2 ) == 0 ) printf ( "Yes 2 strings are same\n" ) ; else printf ( "No, 2 strings are not same\n" ) ; return 0 ; } Example 3: statement o compare two strings in c # include <stdio.h> # include <string.h> int main ( ) { char str1 [ ] = "abcd" , str2 [ ] = "abCd" , str3 [ ] = "abcd" ; int result ; // comparing strings str1 and str2 result = strcmp ( str1 , str2 ) ; printf ( "strcmp(str1, str

Batch File Comment Code Example

Example 1: comment lines in batch file :: This is a comment line Example 2: batch comment :: This is a comment REM This is also a comment Example 3: comment in batch file :: This is a comment REM This is also a comment Example 4: batch script comment Rem This is a comment :: This is another comment Example 5: how to comment a line in batch script your commands here :: commenttttttttttt

Mp3 Youtube Downloader Code Example

Example 1: youtube mp4 downloader I suggest videovor . com , it's really great and you even get an option to choose if you want the whole video or just the audio ! Example 2: youtube mp3 converter You can use WebTools , it's an addon that gather the most useful and basic tools such as a synonym dictionary , a dictionary , a translator , a youtube convertor , a speedtest and many others ( there are ten of them ) . You can access them in two clics , without having to open a new tab and without having to search for them ! - Chrome Link : https : //chrome.google.com/webstore/detail/webtools/ejnboneedfadhjddmbckhflmpnlcomge/ Firefox link : https : //addons.mozilla.org/fr/firefox/addon/webtools/ Example 3: youtube to mp4 ytmp3 . cc is the best by far Example 4: youtube to mp3 online This man is doing gods work Example 5: youtube download mp3 I use https : //github.com/ytdl-org/youtube-dl/ as a Python CLI tool to download videos

Android Phone Not Showing In Visual Studio Code Example

Example: mobile device not showing in android studio Enable Developer option from device settings Worked for me

Online Compiler C++ Shell Code Example

Example 1: c++ online compiler This two are good C ++ compilers : https : //www.onlinegdb.com/online_c++_compiler https : //www.programiz.com/cpp-programming/online-compiler/ Example 2: cpp online compiler Best Site With auto compile : https : //godbolt.org/z/nEo4j7 Example 3: cpp compiler online Three good online compilers : https : //www.onlinegdb.com/online_c++_compiler https : //www.programiz.com/cpp-programming/online-compiler/ http : //cpp.sh/ Example 4: online compiler cpp Good cpp compilers : -- -- -- -- -- -- -- -- -- -- - repl . it / languages / cpp www . w3schools . com / cpp / trycpp . asp ? filename = demo_helloworld onlinegdb . com / online_c ++ _compiler programiz . com / cpp - programming / online - complier cpp . sh

Adding A Large Brace Next To A Body Of Text

Image
Answer : As this is one of the initial, and therefore most visible, incarnations of \tikzmark , I thought it a good idea to update it to an answer using the \tikzmark library. \documentclass{article} %\url{https://tex.stackexchange.com/a/1570/86} \usepackage{tikz} \usetikzlibrary{decorations.pathreplacing,calc,tikzmark} \begin{document} \hfill\tikzmark{right} \begin{itemize} \item First line \item Second line \tikzmark{2nd} \item Third line, which is quite long and seemingly tedious in the extreme \item Fourth line, which isn't as long as the third \tikzmark{4th} \item Fifth line \end{itemize} \begin{tikzpicture}[overlay, remember picture] \node[anchor=base] (a) at (pic cs:2nd) {\vphantom{h}}; % push the mark to the top of the line (ie including ascenders) \node[anchor=base] (b) at (pic cs:4th) {\vphantom{g}}; % push the mark to the bottom of the line (ie including descenders) \draw [decoration={brace,amplitude=0.5em},decorate,ultra thick,gray] (a.north -| {pic cs:right})

Can Not Connect To Sql Server From Docker Supported Asp.net Core Project

Answer : This took me some time to work out, there are a number of small issues that may be wrong, which makes it frustrating. This can get even more frustrating as the .net core web application visual studio 2017 project that gets auto-generated doesn't work straight out of the box. Having this experience as your first exposure to Docker isn't ideal. I initially also had the incorrect assumption that the docker image would come with SQL Server inside the container, this is not the case, it's trying to access the database server that must be pre-installed on the host machine. Steps to follow (tested for a windows docker image, rather than linux); 1) Get the IP address of your host machine, by running a command prompt and typing IPCONFIG 2) Set the database connection string within you appsettings.json file to this Ip address, followed by the SQL Server port number, i.e.; 192.168.X.X,1433 3) Set the connection string not to use Trusted_Connection (delete thi

Atom JavaScript Autocomplete

Answer : Since JavaScript is loosely coupled, providing a working autocomplete solution is not as easy as for statically typed languages like Java. Your best bets with Atom are the following packages: autocomplete-plus - this is now bundled with Atom as the default autocomplete provider ternjs - this looks pretty good, but requires some configuration. I suggest you give these a try. I think you should go for atom-ternjs This is java script intelligence for atom You need to change(Enable) setting for atom-ternjs Use autocomplete-snippets Display both autocomplete-snippets and function name and many more depends on your requirements ...

Back Quote Code Example

Example 1: backtick # A backtick ` Example 2: ` Alternatively known as acute, backtick, left quote, or an open quote, the back quote or backquote is a punctuation mark (`).

Calculate Distance Between Two Points In Google Maps V3

Answer : If you want to calculate it yourself, then you can use the Haversine formula: var rad = function(x) { return x * Math.PI / 180; }; var getDistance = function(p1, p2) { var R = 6378137; // Earth’s mean radius in meter var dLat = rad(p2.lat() - p1.lat()); var dLong = rad(p2.lng() - p1.lng()); var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(rad(p1.lat())) * Math.cos(rad(p2.lat())) * Math.sin(dLong / 2) * Math.sin(dLong / 2); var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); var d = R * c; return d; // returns the distance in meter }; There actually seems to be a method in GMap3. It's a static method of the google.maps.geometry.spherical namespace. It takes as arguments two LatLng objects and will utilize a default Earth radius of 6378137 meters, although the default radius can be overridden with a custom value if necessary. Make sure you include: <script type="text/javascript" src="http://maps.google.co