Posts

Showing posts from December, 2015

Android Manifest Internet Permission Code Example

Example 1: allow internet permission android //add to AndroidManifest.xml < uses-permission android: name = " android.permission.INTERNET " /> Example 2: internet permission android < uses-permission android: name = " android.permission.INTERNET " /> Example 3: android internet permission < uses-permission android: name = " android.permission.INTERNET " /> Example 4: android studio Manifest.xml internet permissionm < uses-permission android: name = " android.permission.INTERNET " />

AddEventListener On NodeList

Answer : There is no way to do it without looping through every element. You could, of course, write a function to do it for you. function addEventListenerList(list, event, fn) { for (var i = 0, len = list.length; i < len; i++) { list[i].addEventListener(event, fn, false); } } var ar_coins = document.getElementsByClassName('coins'); addEventListenerList(ar_coins, 'dragstart', handleDragStart); or a more specialized version: function addEventListenerByClass(className, event, fn) { var list = document.getElementsByClassName(className); for (var i = 0, len = list.length; i < len; i++) { list[i].addEventListener(event, fn, false); } } addEventListenerByClass('coins', 'dragstart', handleDragStart); And, though you didn't ask about jQuery, this is the kind of stuff that jQuery is particularly good at: $('.coins').on('dragstart', handleDragStart); The best I could come up with was

Can't Create WebStorm React Project

Answer : You need to install create-react-app npm module, before you use this feature. npm install -g create-react-app You can read more about this feature on the official release blog of WebStorm. Excerpt from the documentation : Make sure that you have create-react-app installed globally on your computer, for that run npm install -g create-react-app. Then to start your new project, double click on the start task in the npm tasks tool window to run it. That’s it! I had ie installed create-react-app globally using yarn and webstorm failed to find it. Then I used npm , not to mention globally and its working like a charm.

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Answer : if anyone pass through here, this is shorter solution: sudo chown -R $USER $HOME/.composer it seems to me the group information is missing in your command sudo chown -R <user> /home/<user>/.composer/cache/repo/https---packagist.org Shoud be sudo chown -R <user>:<group> /home/<user>/.composer/cache/repo/https---packagist.org But to avoid other permission issues, I would rather advise: sudo chown -R <user>:<group> /home/<user>/.composer/cache (you'll need access to other folders in there) and sudo chown <user>:<group> /home/<user>/.composer To make sure your user has permissions enough on the global composer folder. Mind the missing recursion so the user don't own keys created by root. If you need to find out the group: groups <user>

How To Print Std List Code Example

Example: how to print list in c++ # include <iostream> # include <list> std :: list < int > listOfNumbers = { 1 , 2 , 3 , 4 } ; for ( int item : listOfNumbers ) std :: cout << item << " " ;

What Is The Best Case Time Complexity Of Insertion Sort Code Example

Example: what is time complexity of insertion sort Time Complexity is : If the inversion count is O ( n ) , then the time complexity of insertion sort is O ( n ) . Some Facts about insertion sort : 1. Simple implementation : Jon Bentley shows a three - line C version , and a five - line optimized version [ 1 ] 2. Efficient for ( quite ) small data sets , much like other quadratic sorting algorithms 3. More efficient in practice than most other simple quadratic ( i . e . , O ( n2 ) ) algorithms such as selection sort or bubble sort 4. Adaptive , i . e . , efficient for data sets that are already substantially sorted : the time complexity is O ( kn ) when each element in the input is no more than k places away from its sorted position 5. Stable ; i . e . , does not change the relative order of elements with equal keys 6. In - place ; i . e . , only requires a constant amount O ( 1 ) of additional memory space Online ; i . e . , can sort a list a

Accessing $vuetify Instance Property From Vuex Store

Answer : For Vuetify 2.0 you can try following method. (After following Vuetify 2.0 Upgrade guide for themes) import Vuetify from './plugins/vuetify' export default { getters: {}, mutations: { toggleDarkTheme(state) { Vuetify.framework.theme.themes.light.primary = "#424242"; } } $vuetify is an instance property hence you can access any vue instance property using Vue.prototype.$prop For your case import Vue from 'vue'; export default { getters: {}, mutations: { toggleDarkTheme(state) { Vue.prototype.$vuetify.theme.primary = "#424242"; } } }; For Nuxt.js projects with Vuetify set as a buildModule , you can access $vuetify from the $nuxt property in the Vue instance: import Vue from 'vue'; export actions = { yourAction() { Vue.prototype.$nuxt.$vuetify.theme.dark = true; } }

Android Studio 2.2.2: All Packages Are Not Available For Download

Answer : I was facing the same issue. For me, it got resolved by setting proxy settings. Android Studio > File > Settings >appearance and behavior> System Settings > HTTP Proxy I would suggest checking any proxy is required to enable internet for your android studio. Hope this will help somebody. Open Android SDK Manager Click on Tools. Click on Android. Click on SDK Manager. Update your SDK's Then Sync ,Re-Build and Restart Your Project "Launch Standalone SDK Manager" is not available in newer versions. Just select "SDK Tools" tab, then "Android SDK Build-Tools and place a check next to 23.0.1, 23.0.2, 23.0.3, etc. and any others you may want to install. Select Apply and when complete, press Finish. Rebuild and see if that helps.

Android On Text Change Listener

Answer : You can add a check to only clear when the text in the field is not empty (i.e when the length is different than 0). field1.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable s) {} @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { if(s.length() != 0) field2.setText(""); } }); field2.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable s) {} @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { if(s.length() != 0) field1.setText(""); } }); Documentation for TextWatcher here. Also please respect naming con

Montserrat Medium Font Free Download Code Example

Example: montserrat font <link rel= "preconnect" href= "https://fonts.gstatic.com" > <link href= "https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel= "stylesheet" >

Define Escape Sequences In Java? Give Two Escape Sequences. Code Example

Example: c escape characters Escape HEX in ASCII Character represented \a 07 Alert ( Beep , Bell ) ( added in C89 ) \b 08 Backspace \e 1 B Escape character \f 0 C Formfeed Page Break \n 0 A Newline ( Line Feed ) ; see notes below \r 0 D Carriage Return \t 09 Horizontal Tab \v 0 B Vertical Tab \\ 5 C Backslash \' 27 Apostrophe or single quotation mark \" 22 Double quotation mark \ ? 3F Question mark ( used to avoid trigraphs ) \nnn any The byte whose numerical value is given by nnn interpreted as an octal number \xhh… any The byte whose numerical value is given by hh… interpreted as a hexadecimal number \uhhhh none Unicode code point below 10000 hexadecimal \Uhhhhhhhh none Unicode code point where h is a hexadecimal digit

O Partigiano Portami Via Meaning Code Example

Example: bella ciao lyrics E seppellire lassù in montagna O bella ciao , bella ciao , bella ciao , ciao , ciao E seppellire lassù in montagna Sotto l'ombra di un bel fior

Bfs Algorithm Using Geeksforgeeks Code Example

Example: BFS in c++ # include <iostream> # include <list> using namespace std ; class Graph { int V ; list < int > * adj ; public : Graph ( int V ) ; void addEdge ( int v , int w ) ; void BFS ( int s ) ; } ; Graph :: Graph ( int V ) { this -> V = V ; adj = new list < int > [ V ] ; } void Graph :: addEdge ( int v , int w ) { adj [ v ] . push_back ( w ) ; } void Graph :: BFS ( int s ) { bool * visited = new bool [ V ] ; for ( int i = 0 ; i < V ; i ++ ) visited [ i ] = false ; list < int > queue ; visited [ s ] = true ; queue . push_back ( s ) ; list < int > :: iterator i ; while ( ! queue . empty ( ) ) { s = queue . front ( ) ; cout << s << " " ; queue . pop_front ( ) ;

Create Method Controller Laravel Code Example

Example 1: laravel create controller php artisan make : controller MyController Example 2: how to create controller in laravel php artisan make : controller PhotoController -- resource Example 3: use resource in laravel 8 php artisan make : controller PhotoController -- resource -- model = Photo Example 4: Route::resource Route :: resource ( 'photos' , PhotoController :: class ) ; Example 5: controller in laravel 8 Rout :: get ( '/test' , [ TestController :: class , 'index' ] ) ;

Can You Make A Travel Region Polygon With With Google Maps API?

Image
Answer : Google's tools do not provide any way to do this kind of thing built in. While you might be able to do this by routing to a sufficient number of locations and checking the time, another tool that you might be interested in is Graphserver. GraphServer is a multimodal trip planner, which can take data from OpenStreetMap and other data sources. Some of the gallery images show growing shortest-path distance routing, and this is based on a similar metric. The Google Group would be the appropriate place to discuss the possibilities of using this tool. Note that this is not a pre-baked tool; it will likely require some investigation and work to get it to solve your problem, but the tool can be used to do it. Take a look at the Mapnificent API. Mapnificent provides dynamic public transport travel time maps for many cities in the US and some world wide. You can use the Mapnificent API to augment your Google Maps application with public transport travel time

Can I Create Custom Slot Types Dynamically In Alexa Voice Service?

Answer : I think that, in fact, this is possible. You have to define a custom slot type, as explained here: https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/defining-the-voice-interface#custom-slot-types Now, the custom slot type asks you to provide possible values, which you should do. BUT! It seems that Alexa will still parse slot values correctly even if they are not in the list of possible values that you provided! This seems to be an undocumented feature and what I am telling you is based on my own observations: My custom slot type is taking on unexpected values In general, my impression is that the interaction model as a whole should be seen less as a strict set of rules and more as a guideline that is interpreted at the discretion of the Alexa Voice Service. I was able to achieve this exact thing by creating a custom intent called "Search" with a custom slot type called 'query.' This sends whatever the user says in the slot v

Angular 5 Remove Query Param

Answer : You can remove a query parameter by using the merge option of queryParamsHandling and passing in null for any params you wish to remove. // Remove query params this.router.navigate([], { queryParams: { 'yourParamName': null, 'youCanRemoveMultiple': null, }, queryParamsHandling: 'merge' }) This option is simpler and requires less work to ensure you are not removing other params. You also do not need to worry about cleaning up an observable subscription when your component is destroyed. UPDATE: @epelc's answer below is the up-to-date and correct way to do this: https://stackoverflow.com/a/52193044/5932590. Unfortunately, there is no clear-cut way to do this currently: https://github.com/angular/angular/issues/18011. However, as jasonaden commented on the linked thread, This could be done manually by merging the old and new query params, removing the key you don't want. Here is one way to do that: Let's say

Android Manifest Permission Internet Code Example

Example 1: android how to add permission to manifest < manifest xlmns: android... > ... < uses-permission android: name = " android.permission.INTERNET " /> <application ... </ manifest > Example 2: allow internet permission android //add to AndroidManifest.xml < uses-permission android: name = " android.permission.INTERNET " /> Example 3: internet permission android < uses-permission android: name = " android.permission.INTERNET " /> Example 4: android studio Manifest.xml internet permissionm < uses-permission android: name = " android.permission.INTERNET " />

C Operator Precedence

The following table lists the precedence and associativity of C operators. Operators are listed top to bottom, in descending precedence. Precedence Operator Description Associativity 1 ++ -- Suffix/postfix increment and decrement Left-to-right () Function call [] Array subscripting . Structure and union member access -> Structure and union member access through pointer ( type ){ list } Compound literal (C99) 2 ++ -- Prefix increment and decrement [note 1] Right-to-left + - Unary plus and minus ! ~ Logical NOT and bitwise NOT ( type ) Type cast * Indirection (dereference) & Address-of sizeof Size-of [note 2] _Alignof Alignment requirement (C11) 3 * / % Multiplication, division, and remainder Left-to-right 4 + - Addition and subtraction 5 << >> Bitwise left shift and right shift 6 < <= For rela