Posts

Showing posts from August, 2000

Android: R.java: Error Expected

Answer : It sounds like you have accidentally defined a menu item in your XML with an id of =action_setting . For example: <menu> <item android:id="@+id/=action_settings" /> </menu> Remove the = from your menu XML and you should be good to go. I had the same problem, because I defined a string without name in my resources. like: <string name="">some text</string>

Angularjs Loading Screen On Ajax Request

Answer : Instead of setting up a scope variable to indicate data loading status, it is better to have a directive does everything for you: angular.module('directive.loading', []) .directive('loading', ['$http' ,function ($http) { return { restrict: 'A', link: function (scope, elm, attrs) { scope.isLoading = function () { return $http.pendingRequests.length > 0; }; scope.$watch(scope.isLoading, function (v) { if(v){ elm.show(); }else{ elm.hide(); } }); } }; }]); With this directive, all you need to do is to give any loading animation element an 'loading' attribute: <div class="loading-spiner-holder" data-loading ><div class="loa

Andwhere Laravel Code Example

Example 1: laravel not in query DB::table ( .. ) - > select ( .. ) - > whereNotIn ( 'book_price' , [ 100,200 ] ) - > get ( ) ; Example 2: laravel orWhere $camps = $field - > camps ( ) - > where ( 'status' , 0 ) - > where ( function ( $q ) { $q - > where ( 'sex' , Auth::user ( ) - > sex ) - > orWhere ( 'sex' , 0 ) ; } ) - > get ( ) ; Example 3: AND-OR-AND + brackets with Eloquent //mysql query be like this // .. . WHERE ( gender = 'Male' and age > = 18 ) or ( gender = 'Female' and age > = 65 ) //Eloquent query is // .. . $q - > where ( function ( $query ) { $query - > where ( 'gender' , 'Male' ) - > where ( 'age' , '>=' , 18 ) ; } ) - > orWhere ( function ( $query ) { $query - > where ( 'gender' , 'Female' ) - > where ( 'age' , '>=' , 65 ) ; } ) //@sujay Exa

Borderstyle Flutter Code Example

Example: border side in flutter import 'package:flutter/material.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return Center( child: Container( child: Text( "This is a Boder with One Side", textDirection: TextDirection.ltr, style: TextStyle(color: Colors.black), ), padding: EdgeInsets.symmetric(vertical: 100.0, horizontal: 100.0), decoration: BoxDecoration( border: Border( top: BorderSide(width: 16.0, color: Colors.lightBlue.shade600), bottom: BorderSide(width: 16.0, color: Colors.lightBlue.shade900), ), color: Colors.white, ), ), ); } }

'adb' Is Not Recognized As An Internal Or External Command, Operable Program Or Batch File

Answer : Set the path of adb into System Variables. You can find adb in " ADT Bundle/sdk/platform-tools " Set the path and restart the cmd n then try again. Or You can also goto the dir where adb.exe is located and do the same thing if you don't wanna set the PATH. If you wanna see all the paths, just do echo %PATH% From Android Studio 1.3, the ADB location is at: C:\Users\USERNAME\AppData\Local\Android\sdk\platform-tools. Now add this location to the end of PATH of environment variables. Eg: ;C:\Users\USERNAME\AppData\Local\Android\sdk\platform-tools If you want to use it every time add the path of adb to your system variables: enter to cmd (command prompt) and write the following: echo %PATH% this command will show you what it was before you will add adb path setx PATH "%PATH%;C:\Program Files\android-sdk-windows\platform-tools" be careful the path that you want to add if it contains double quote after you restart your cmd rewrite

Add Row To Numpy Array Code Example

Example 1: append row to array python import numpy as np newrow = [1,2,3] A = np.vstack([A, newrow]) Example 2: how append row in numpy import numpy as np arr = np.empty((0,3), int) print("Empty array:") print(arr) arr = np.append(arr, np.array([[10,20,30]]), axis=0) arr = np.append(arr, np.array([[40,50,60]]), axis=0) print("After adding two new arrays:") print(arr) Example 3: np append row A= [[1, 2, 3], [4, 5, 6]] np.append(A, [[7, 8, 9]], axis=0) >> array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) #or np.r_[A,[[7,8,9]]] Example 4: python append row to 2d array new_row.append([])

AWS: Custom SSL Certificate Option Is Disabled In CloudFront, But I Created A SSL Certificate Using AWS Certificate Manager

Answer : Certificates that will be used with an Application Load Balancer (ELB/2.0) need to be created in ACM in the same region as the balancer. Certificates that will be used with CloudFront always need to be created in us-east-1. To use an ACM Certificate with Amazon CloudFront, you must request or import the certificate in the US East (N. Virginia) region. ACM Certificates in this region that are associated with a CloudFront distribution are distributed to all the geographic locations configured for that distribution. – http://docs.aws.amazon.com/acm/latest/userguide/acm-regions.html The reason for this is that CloudFront doesn't follow the regional boundary model in AWS. CloudFront edge locations are all over the globe, but are configured and managed out of us-east-1 -- think of it as CloudFront's home region. Once a distribution reaches the Deployed state, it is not operationally dependent on us-east-1, but during provisioning, everything originates from that

Changing Locale In Android Emulator

Answer : I am using the emulator with Android 4.2 + 4.3 and there is an app to set the locale called "Custom Locale". Start emulator -> Launcher -> Custom Locale => Select the desired language from the list => Confirm with e.g "Select 'de_DE'" My solution is to use preinstalled on android emulator "Custom locale" application. Simply send intent with extra language parameter to it as below: adb shell am broadcast -a com.android.intent.action.SET_LOCALE --es com.android.intent.extra.LOCALE EN More information here - prepare android emulator for UI test automation. No Need to change local, just long press on the EditText widget, on the popup menu select input method, and change to the android keyboard.

Bootstrap4 Panel Code Example

Example: .card class < style > .card { border : 1 px solid #ccc ; background-color : #f4f4f4 ; padding : 20 px ; margin-bottom : 10 px ; } </ style >

6inch In Cm And 4 Inch In Cm Code Example

Example: inch to cm 1 inch = 2.54 cm

Math.floor Java Code Example

Example 1: floor in java Math . floor ( value ) ; Example 2: math.floor console . log ( Math . floor ( 5.95 ) ) ; // expected output: 5 console . log ( Math . floor ( 5.05 ) ) ; // expected output: 5 Example 3: math.floor console . log ( Math . floor ( 5.05 ) ) ; // expected output: 5 Example 4: java math.floor The floor of a floating point number is the largest integer that is <= to the number . Example 5: java "->" interface LambdaFunction { void call ( ) ; } class FirstLambda { public static void main ( String [ ] args ) { LambdaFunction lambdaFunction = ( ) -> System . out . println ( "Hello world" ) ; lambdaFunction . call ( ) ; } } Example 6: java "->" Runnable r = ( ) -> System . out . print ( "Run method" ) ; // is equivalent to Runnable r = new Runnable ( ) { @Override public void run ( ) { System . out .

Download Mp3 Youtube Online Code Example

Example 1: 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 2: youtube download mp3 I use https : //github.com/ytdl-org/youtube-dl/ as a Python CLI tool to download videos

Android- How To Implement Horizontal Step Progress Bar

Image
Answer : I found a Vertical Steper that follows Google Material Design guidelines: And also another well documented library Here I hope it helps. EDIT: A repo which seems to currently be well supported and used (Sep 2016) https://github.com/baoyachi/StepView Old Answer: This answer is late to the party, but so far the best I've found is this repo from Anton46: https://github.com/anton46/Android-StepsView It's quite simple to setup too. Heres an example: I've created a Step View ViewPager that supports both Horizontal and Vertical paging and doesn't require drawables and images. You can configure the appearance by simply specifying various attributes. It can be found here https://github.com/YablokovDmitry/StepViewPager

AWS RDS MySQL Vs Aurora

Answer : The technical differences are summarised nicely in this SlideShare - http://www.slideshare.net/AmazonWebServices/amazon-aurora-amazons-new-relational-database-engine It's really quite a different architecture/implementation under the covers from standard MySQL, and one that is fundamentally closed. Amazon are being coy about the extent to which the front end is a MySQL derivative or a complete rewrite that is protocol-compatible - see http://www.theregister.co.uk/2014/11/26/inside_aurora_how_disruptive_is_amazons_mysql_clone/?page=2 - but it looks likely it's at least a major fork with lots of new code. It will have different bugs from the main MySQL releases, which users will be reliant on Amazon to fix. A distributed transactional database backend is a complex thing to write, and while Amazon have some of the best engineers in the world for this sort of system, it's still quite new. It relies on a completely new Amazon-specific multi-tenanted storage bac

Batch Script Loop

Answer : for /l is your friend: for /l %x in (1, 1, 100) do echo %x Starts at 1, steps by one, and finishes at 100. Use two % s if it's in a batch file for /l %%x in (1, 1, 100) do echo %%x (which is one of the things I really really hate about windows scripting) If you have multiple commands for each iteration of the loop, do this: for /l %x in (1, 1, 100) do ( echo %x copy %x.txt z:\whatever\etc ) or in a batch file for /l %%x in (1, 1, 100) do ( echo %%x copy %%x.txt z:\whatever\etc ) Key: /l denotes that the for command will operate in a numerical fashion, rather than operating on a set of files %x is the loops variable (starting value, increment of value, end condition[inclusive] ) And to iterate on the files of a directory: @echo off setlocal enableDelayedExpansion set MYDIR=C:\something for /F %%x in ('dir /B/D %MYDIR%') do ( set FILENAME=%MYDIR%\%%x\log\IL_ERROR.log echo =========================== Search in !FILE

How To Find Prime Numbers C Code Example

Example: c program to check prime number using for loop # include <stdio.h> int main ( ) { int n , i , flag = 0 ; printf ( "Enter a positive integer: " ) ; scanf ( "%d" , & n ) ; for ( i = 2 ; i <= n / 2 ; ++ i ) { // condition for non-prime if ( n % i == 0 ) { flag = 1 ; break ; } } if ( n == 1 ) { printf ( "1 is neither prime nor composite." ) ; } else { if ( flag == 0 ) printf ( "%d is a prime number." , n ) ; else printf ( "%d is not a prime number." , n ) ; } return 0 ; }

Can I Power An NodeMCU Trough VIN Providing 5v

Answer : Can I use the micro usb's 5v to power the board through the VIN or do any solution require more equipment than that ? Yes. That is the pin's purpose. You can use any voltage from about 4.5V up to 20V, although higher voltages will cause more heat from the on-board 3.3V regulator. VIN just connects to the 5V of the USB. If you are working with the "v3" (Lolin) pcb, USB v5 pin is not directly connected to Vin, but to VU. Vin has a S4 SMD diode (aka Schottky 40V1A 1N5819) between it and the USB v5 pin.

Arduino Pow Function Code Example

Example: arduino pow() valueVPD = (-0.006107 * (DHT22humidity - 100)) * pow(10, ((7.5 * gemTemp) / (gemTemp + 237.3)));

Centering Floating Divs Within Another Div

Answer : First, remove the float attribute on the inner div s. Then, put text-align: center on the main outer div . And for the inner div s, use display: inline-block . Might also be wise to give them explicit widths too. <div style="margin: auto 1.5em; display: inline-block;"> <img title="Nadia Bjorlin" alt="Nadia Bjorlin" src="headshot.nadia.png"/> <br/> Nadia Bjorlin </div> With Flexbox you can easily horizontally (and vertically) center floated children inside a div. So if you have simple markup like so: <div class="wpr"> <span></span> <span></span> <span></span> <span></span> <span></span> </div> with CSS: .wpr { width: 400px; height: 100px; background: pink; padding: 10px 30px; } .wpr span { width: 50px; height: 50px; background: green; float: left; /* **chi

Argenta Bic Code Example

Example: BIC argenta BIC OF ARGENTA IS: "ARSP BE 22"

Change Ion-item Background Color In Ionic 4.0

Answer : Use this special ionic CSS rule: ion-item{ --ion-background-color:#fff; } I found the working one in ionic 4. Apply the below 2 css in your .scss file where you have implemented ion-list and ion-item: ion-item { --ion-background-color: white !important; } .item, .list, .item-content, .item-complex { --ion-background-color: transparent !important; } I seem to have found a fix. You just need to add color="light" to the ion-item element. Please see below: <ion-item class="light-back" color="light"> <ion-icon name="search" color="light"></ion-icon> <ion-input required type="text" placeholder="Search for a site" color="light"> </ion-input> </ion-item> The problem is that other code gets injected based on my theme, which I set to my primary color from my variables, so I need to indicate that I am again usin

Array Push Object Php Code Example

Example 1: array push object php $myArray = [ ] ; array_push ( $myArray , ( object ) [ 'key1' => 'someValue' , 'key2' => 'someValue2' , 'key3' => 'someValue3' , ] ) ; return $myArray ; Example 2: array push php < ? php $a = array ( "red" , "green" ) ; array_push ( $a , "blue" , "yellow" ) ; print_r ( $a ) ; ? > Example 3: add object in array php $myArray = array ( "name" => "my name" ) ; echo json_encode ( $myArray ) ;

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

Access Byref Argument Type Mismatch Code Example

Example: ByRef argument type mismatch ' If you don't specify a type for a variable, the variable receives the default ' type, Variant. This isn't always obvious. For example, the following code ' declares two variables, the first, "MyVar", is a Variant; the second, ' "AnotherVar", is an Integer. Sub main() Dim MyVar, AnotherVar As Integer ' MyVar->Variant, AnotherVar->Integer 'Dim MyVar As Integer, AnotherVar As Integer ' Both are declared integers MyVar = 3.1415 Call SomeSub((MyVar)) End Sub Sub SomeSub (MyNum As Integer) MyNum = MyNum + MyNum End Sub