Posts

Showing posts from August, 2018

Address Validation Using Google Maps API

Answer : The answer probably depends how critical it is for you to receive support and possible customization for this service. Google can certainly do this. Look into their XML and Geocoding API's. You should be able to craft an XML message asking Google to return Map coordinates for a given address. If the address is not found (invalid), you will receive an appropriate response. Here's a useful page: http://code.google.com/apis/maps/documentation/services.html#XML_Requests Note that Google's aim in providing the Maps API is to plot addresses on actual maps. While you can certainly use the data for other purposes, you are at the mercy of Google should one of their maps not exactly correspond to your legal or commercial address validation needs. If you paid for one of the services you mentioned, you would likely be able to receive support should certain addresses not resolve the way you expect them to. In other words, you get what you pay for ;) . If you have the t

Customised Scroll Bar Code Example

Example: custom scrollbar body ::-webkit-scrollbar { width : 12 px ; /* width of the entire scrollbar */ } body ::-webkit-scrollbar-track { background : orange ; /* color of the tracking area */ } body ::-webkit-scrollbar-thumb { background-color : blue ; /* color of the scroll thumb */ border-radius : 20 px ; /* roundness of the scroll thumb */ border : 3 px solid orange ; /* creates padding around scroll thumb */ }

Can Villagers Use Fence Gates?

Answer : No, villagers are not able to use fence gates. I tested this in creative, and they always used a long route with a door rather than a short route with a fence gate. I even blocked off the door and they just stood there. No . Villagers can only open and close wooden doors, but they cannot open and close fence gates. You can, of course, set up a fence gate, but the villagers may try to escape through that opening when you open the fence gate. A better way to trade with villagers is to set up a booth-like thing: F-Fence V=Villager FFF FFF FVFFFFVF FVVVVVVF FFFFFFFF This way, they cannot escape and you can still trade with them. No , they can't. They cannot use any mechanism without the help of redstone or stuff like pressure plates for wooden doors.

Convert Int To String Golang Code Example

Example 1: golang convert int to string str := strconv . Itoa ( 12 ) Example 2: go convert integer to string s := strconv . Itoa ( i ) // also s := strconv . FormatInt ( i , 10 ) // and also s := fmt . Sprintf ( "%d" , i ) Example 3: golang convert string to int64 s := "97" n , err := strconv . ParseInt ( s , 10 , 64 ) if err == nil { fmt . Printf ( "%d of type %T" , n , n ) } Example 4: convert string to int golang var s string i , err := strconv . Atoi ( s )

Convert Json Table Arrays To Objects With Jq

Answer : Answering my own question: jq 'to_entries|map(.key) as $keys| (map(.value)|transpose) as $values |$values|map([$keys, .] | transpose| map( {(.[0]): .[1]} ) | add)' Explanation: Extract keys ["IdentifierName", "Code"] and values as [ [ "A", 5 ], [ "B", 8 ], [ "C", 19 ] ] Then to index from keys to values, take json-seq of key-tuple with (each) value tuple and transpose and zip them in pairs. echo '[[ "IdentifierName", "Code" ], [ "C", 19 ] ]'|jq '.|transpose| map( {(.[0]): .[1]} ) | add' Combining both gives solution. This will work for any number of elements (0 and 1 are just key and value, not first and second). $ jq '[.IdentifierName, .Code] | transpose | map( { "IdentifierName": .[0], "Code": .[1] } ) ' file.json [ { "IdentifierName": "A", "Code": 5 }, { "IdentifierN

Resize Photo With Bootstrap Classes Code Example

Example 1: bootstrap image size .food1 img { width : 100 % ; height : 230 px ; } Example 2: bootstrap image size .top1 { height : 390 px ; background-color : #FFFFFF ; margin-top : 10 px ; overflow : hidden ; } .top1 img { height : 100 % ; }

C Printf Float Value Code Example

Example 1: format specifier fro float in printf printf ( "%0k.yf" float_variable_name ) Here k is the total number of characters you want to get printed . k = x + 1 + y ( + 1 for the dot ) and float_variable_name is the float variable that you want to get printed . Suppose you want to print x digits before the decimal point and y digits after it . Now , if the number of digits before float_variable_name is less than x , then it will automatically prepend that many zeroes before it . Example 2: printf c float printf ( "%.6f" , myFloat ) ; Example 3: c printf float value I want to print a float value which has 2 integer digits and 6 decimal digits after the comma . If I just use printf ( "%f" , myFloat ) I'm getting a truncated value . I don 't know if this always happens in C, or it' s just because I'm using C for microcontrollers ( CCS to be exact ) , but at the reference it tells that % f get just th

Convert From .cer To .pem Code Example

Example 1: convert crt to pem openssl x509 -inform DER -in yourdownloaded.crt -out outcert.pem -text Example 2: convert pem to private key openssl openssl rsa -outform der -in private.pem -out private.key

Getchildren Unity Code Example

Example: unity get child GameObject Child ; Child = transform . GetChild ( 0 ) . gameObject ;

Android Studio Toast Syntax Code Example

Example 1: how to make toast in android Toast toast = Toast.makeText(this, "message", Toast.LENGTH_LONG;); toast.show(); Example 2: toast.maketext Context context = getApplicationContext(); CharSequence text = "Hello toast!"; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show();

C Programming Factorial Function Code Example

Example 1: factorial c program using for loop # include <stdio.h> int main ( ) { int i , f = 1 , num ; printf ( "Enter a number: " ) ; scanf ( "%d" , & num ) ; for ( i = 1 ; i <= num ; i ++ ) f = f * i ; printf ( "Factorial of %d is: %d" , num , f ) ; return 0 ; } Example 2: factorial of a given number in c //Factorial of a given number # include <stdio.h> //This function returns factorial of the number passed to it long int factorialOf ( int number ) { long int factorial = 1 ; while ( number ) { factorial *= number ; number -= 1 ; } return factorial ; } int main ( void ) { int n ; printf ( "Find factorial of \n" ) ; scanf ( "%d" , & n ) ; printf ( "\nThe factorial of %d is %ld" , n , factorialOf ( n ) ) ; return 0 ; }

How To Fit Image In Div Without Stretching With Image In Html Code Example

Example: css resize image to fit div no stretching .div { background-image : url ( ../images/your-image.png ) ; background-size : cover ; background-position : center ; background-repeat : no-repeat ; }

Remove Background Button Css Code Example

Example: button background color remove .button { background-color : Transparent ; background-repeat : no-repeat ; border : none ; }

Html Css Strikethrough Code Example

Example 1: text-decoration css h1 { text-decoration : overline ; } h2 { text-decoration : line-through ; } h3 { text-decoration : underline ; } h4 { text-decoration : underline overline ; } Example 2: line through in css x { text-decoration : line-through ; }

ADO.NET Vs ADO.NET Entity Framework

Answer : Nothing is faster than an ADO.NET datareader. Entity framework also uses this in "the basement". However entitity framework helps you to map from database to objects.. With ADO.NET you have to do that yourself. It depends on how you program it how fast it is.. When you use ADO.NET datatables as "objects". They are a bit slower and memory hungry than plain objects.. As Julian de Wit says nothing is faster than ADO.NET DataReaders. ADO.NET Entity Framework is a wrapper to the old ADO.NET. It is pure Provider independent, ORM and EDL System. It gives us a lot of benefits that we have had to hand craft or "copy & paste" in the past. Another benefit that comes with it is that is completely Provider independent. Even if you like the old ADO.NET mechanism or you are a dinosaur like me(:P) you can use the Entity Framework using the EntityClient like SqlClient , MySqlClient and use the power of Entity-Sql witch is provider independent. I

Can I Search In The Terminal Backlog In Terminator

Answer : Terminator has a built-in search (ctrl-shift-f is the default keybinding), but it doesn't highlight the found text, which makes it fairly useless. There's a bug open against terminator to fix this, but right now it's still unresolved: https://bugs.launchpad.net/ubuntu/+source/terminator/+bug/271487 This actually has been resolved for terminator 2.1 , yes good things do happen in 2020. However it's not on the repo yet, but you can clone the github terminator repo And follow the steps form install guide Basically it will take you to git clone git@github.com:gnome-terminator/terminator.git sudo apt-get install python3-gi python3-gi-cairo python3-psutil python3-configobj \ gir1.2-keybinder-3.0 gir1.2-vte-2.91 gettext intltool dbus-x11 # In the folder where you've cloned the repo python3 setup.py build python3 setup.py install --single-version-externally-managed --record=install-files.txt you should be able to spawn a terminal from

How To Change Size Of Font Awesome Icons Code Example

Example 1: change font awesome icon size <i class= "fas fa-camera fa-xs" ></i> <i class= "fas fa-camera fa-sm" ></i> <i class= "fas fa-camera fa-lg" ></i> <i class= "fas fa-camera fa-2x" ></i> <i class= "fas fa-camera fa-3x" ></i> <i class= "fas fa-camera fa-5x" ></i> <i class= "fas fa-camera fa-7x" ></i> <i class= "fas fa-camera fa-10x" ></i> Example 2: how to increase size of font awesome icon #elementID { font-size : 20 px ; } Example 3: font awesome size <span style= "font-size: 500px; color: Tomato;" > <i class= "fas fa-camera" ></i> </span> Example 4: resize font awesome <i class= "fas fa-expand-alt" ></i> Example 5: how to change size of the font awsome Font Awsome Sizes

Country Phone Code With Flags Json Code Example

Example 1: api for countries dialing code along with country flag < img src = " https://www.countryflags.io/be/shiny/64.png " > Example 2: api for countries dialing code along with country flag < img src = " https://www.countryflags.io/be/flat/64.png " >

Mat Tooltip Width Auto Code Example

Example: increase tooltip width in angular material // Hi.. .this is Ayushman ::ng-deep .my-tooltip { max-width : unset !important ; white-space : pre-wrap ; font-size : 8 px ; }

Cost-effective Synonym Code Example

Example: cost-effective synonym cost-effective

Array Count In Javascript Code Example

Example 1: array length javascript var numbers = [ 1 , 2 , 3 , 4 , 5 ] ; var length = numbers . length ; for ( var i = 0 ; i < length ; i ++ ) { numbers [ i ] *= 2 ; } // numbers is now [2, 4, 6, 8, 10] Example 2: array length javascript var arr = [ 10 , 20 , 30 , 40 , 50 ] ; //An Array is defined with 5 instances var len = arr . length ; //Now arr.length returns 5.Basically, len=5. console . log ( len ) ; //gives 5 console . log ( arr . length ) ; //also gives 5 Example 3: array length in js' var x = [ ] ; console . log ( x . size ( ) ) ; console . log ( x . length ) ; console . log ( x . size ( ) == x . length ) ; x = [ 1 , 2 , 3 ] ; console . log ( x . size ( ) ) ; console . log ( x . length ) ; console . log ( x . size ( ) == x . length ) ; //arjun

Identify The Animation Property. Code Example

Example: what is the animation property in html and css with the help of animation properties in CSS we can control how the animation will be played throughout. The animation properties in CSS are - 1 ) animation-duration : implies the time taken by the animation to finish.Forexample- animation-duration : 6 s ; 2 ) animation-direction : implies the direction of the animation.Forexample- the direction in which the horse rides , the car moves , the insects crawls. 3 ) animation-delay : implies the time after which is the animation starts.Forexample- animation-delay : 3 s ; means after 3 seconds the animation will start. 4 ) animation-iteration-count : implies how many times the animation will repeat. 5 ) animation-timing-function : the values can be ease , ease-in , ease-out , linear , ease-in-out. 6 ) animation-play-state : the values can be paused , running , initial , inherit. 7 ) animation-name : implies the name of the animation which is assigned by

Bootstrap Table Scroll Vertical Code Example

Example 1: table bootstrap with scrool <div style= "height: 600px;overflow: scroll;" > <!-- change height to increase the number of visible row --> <table></table> </div> Example 2: how to set the scroll in bootstrap4 table body table { display : flex ; flex-flow : column ; width : 100 % ; } thead { flex : 0 0 auto ; } tbody { flex : 1 1 auto ; display : block ; overflow-y : auto ; overflow-x : hidden ; } tr { width : 100 % ; display : table ; table-layout : fixed ; }

Convert Int To String In Java Code Example

Example 1: int to string java int x = 3 ; Integer . toString ( int ) Example 2: java how to cast int to String int i = 1234 ; String s = String . ValueOf ( i )

Campfire Mc Recipe Code Example

Example: can campfires start fires minecraft no, campfires don't start fires

23 Inch To Cm Code Example

Example: inch to cm 1 inch = 2.54 cm

Text Justify Html Code Example

Example 1: html text justify <p style= "text-align: justify;" > Justify to width </p> Example 2: how to justify text in html <p align= "justify" > Example 3: justify text csss text-align : justify ;

Android Item Size In Layer-list

Answer : I found solution, but I expected better way. Here is final code: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <gradient android:endColor="#000004" android:gradientRadius="1000" android:startColor="#1f3371" android:type="radial" > </gradient> </shape> </item> <item> <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/texture_5" android:tileMode="repeat" /> </item> <item android:drawable="@drawable/logo" android:bottom="214dp" android:top="214dp"

Angular 10 Tutorial For Beginners Code Example

Example 1: Angular 9 tutorial < div class = "calculator" > < input type = "text" class = "calculator-screen" value = "0" disabled / > < div class = "calculator-keys" > < button type = "button" class = "operator" value = "+" > + < / button > < button type = "button" class = "operator" value = "-" > - < / button > < button type = "button" class = "operator" value = "*" > × < / button > < button type = "button" class = "operator" value = "/" > ÷ < / button > < button type = "button" value = "7" > 7 < / button > < button type = "button" value = "8" > 8 < / button > < button type = "button" value = "9" > 9 < / b

Bring Out The Inner Llama Of A Sentence

Answer : Perl, 52 bytes The solution is provided as function that takes the string as argument and returns a list of positions. One-based positions, case-sensitive search, without newlines: 52 bytes sub l{pop=~/(l).*?(l).*?(a).*?(m).*?(a)/;@+[1..$#+]} The case-sensitive search returns an empty array in the example of the question, because after matching the first three letters the lowercase letter m is missing in the input text. Support of newlines: + 1 byte = 53 bytes sub l{pop=~/(l).*?(l).*?(a).*?(m).*?(a)/s;@+[1..$#+]} The text can now span several lines. Case-insensitive search: + 1 byte = 54 bytes sub l{pop=~/(l).*?(l).*?(a).*?(m).*?(a)/si;@+[1..$#+]} Now the example in the question reports a list of index positions, they are one-based numbers: [45 68 77 106 115] Zero-based positions: + 9 bytes = 63 bytes sub l{pop=~/(l).*?(l).*?(a).*?(m).*?(a)/si;map{$_-1}@+[1..$#+]} Result for the example in the question: [44 67 76 105 114] Ungolfed: The l