Posts

Showing posts from March, 2016

Can I Have Backup Power For An Arduino Device?

Answer : you could set up a relay to work in reverse with the mains power, have your backup battery connected to the gate contacts of the relay, and then use the mains power running your project to open the relay and keep it open as long as there is power. if the mains turns off, then the relay closes and the battery is connected. you might want to put something in line with the power to the arduino to make sure you don't get any spikes when things switch. hope this helps as i love kittens I suggest this "Battery boost" circuit from AdaFruit. It's designed to do exactly what you describe. An Arduino needs a smooth, steady 5 V supply with no "blips". The AdaFruit unit does just that, and charges the battery while on Mains supply.

Angular.js Cdn Code Example

Example 1: angularjs cdn <! doctype html > < html ng-app > < head > < title > My AngularJS App </ title > < script src = " https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js " > </ script > </ head > < body > </ body > </ html > Example 2: angular.min.js version < script src = " https://ajax.googleapis.com/ajax/libs/angularjs/1.7.9/angular.min.js " > </ script >

Float To Int C# Unity Code Example

Example: unity cast float to int //(int) casts float or int after it to an int intVar = ( int ) var

0f To C Code Example

Example: convert fahrenheit to celsius import java . util . Scanner ; public class Main { public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int far = sc . nextInt ( ) ; int cel = ( far - 32 ) * 5 / 9 ; System . out . printf ( "%d Fahrenheit is %d Celsius" , far , cel ) ; } }

108 F To C Code Example

Example 1: c to f let f = c * ( 9 / 5 ) + 32 ; let c = ( f - 32 ) * ( 5 / 9 ) ; Example 2: 14 f to c 14 ° F = - 10 ° C

A Timely Offer (Glass Arrows, Thieves' Guild)

Answer : I found it: Outside the Mistveil Keep Barracks door (labeled on local map) there are 3 barrels and 1 is labeled Thief cache. It has Glass Arrows and other misc items. To clarify - you have to enter the Keep Barracks, go up the stairs, then out the door to 'Riften'. The 'Thief Cache' barrel is up there. As stated in a comment by LessPop-MoreFizz, the accepted answer is wrong. What they are referring to are the thieves caches in Riften and their location is detailed in this Arcade Answer. The comment by Aquarius Power further points to the wiki pages which basically points out that the container is bugged. As with many bugs in Skyrim, LimeJello24 has provided a mod named A Timely Offer which attempts to fix it. This mod is available on Nexus for SSE.

Css Fontawesome 4 Icon Code Example

Example: font awesome css < span style = "font-size: 3em; color: Tomato;" > < i class = "fas fa-camera" > < / i > < / span > < span style = "font-size: 48px; color: Dodgerblue;" > < i class = "fas fa-camera" > < / i > < / span > < span style = "font-size: 3rem;" > < span style = "color: Mediumslateblue;" > < i class = "fas fa-camera" > < / i > < / span > < / span >

How To Scanf Char Array In C Code Example

Example 1: how to print char array in c char a_static [ ] = { 'q' , 'w' , 'e' , 'r' , '\0' } ; char b_static [ ] = { 'a' , 's' , 'd' , 'f' , '\0' } ; printf ( "value of a_static: %s\n" , a_static ) ; printf ( "value of b_static: %s\n" , b_static ) ; return 0 ; Example 2: return char array in c char * createStr ( ) { char char1 = 'm' ; char char2 = 'y' ; char * str = malloc ( 3 ) ; str [ 0 ] = char1 ; str [ 1 ] = char2 ; str [ 2 ] = '\0' ; return str ; }

Create File In Vscode By Keyboard Shortcut Code Example

Example: new file shortcut vscode ctrl + n // Windows/Linux cmd + n // MacOS //Or use a great extension: File Utils

Convert Hex To Binary In Javascript

Answer : You can create a function converting a hex number to binary with something like this : function hex2bin(hex){ return ("00000000" + (parseInt(hex, 16)).toString(2)).substr(-8); } For formatting you just fill a string with 8 0 , and you concatenate your number. Then, for converting, what you do is basicaly getting a string or number, use the parseInt function with the input number value and its base (base 16 for hex here), then you print it to base 2 with the toString function. And finally, you extract the last 8 characters to get your formatted string. 2018 Edit : As this answer is still being read, I wanted to provide another syntax for the function's body, using the ES8 (ECMAScript 2017) String.padStart() method : function hex2bin(hex){ return (parseInt(hex, 16).toString(2)).padStart(8, '0'); } Using padStart will fill the string until its lengths matches the first parameter, and the second parameter is the filler character (blank space by

Convert A Numpy.ndarray To String(or Bytes) And Convert It Back To Numpy.ndarray

Answer : You can use the fromstring() method for this: arr = np.array([1, 2, 3, 4, 5, 6]) ts = arr.tostring() print(np.fromstring(ts, dtype=int)) >>> [1 2 3 4 5 6] Sorry for the short answer, not enough points for commenting. Remember to state the data types or you'll end up in a world of pain. Note on fromstring from numpy 1.14 onwards : sep : str, optional The string separating numbers in the data; extra whitespace between elements is also ignored. Deprecated since version 1.14: Passing sep='', the default, is deprecated since it will trigger the deprecated binary mode of this function. This mode interprets string as binary bytes, rather than ASCII text with decimal numbers, an operation which is better spelt frombuffer(string, dtype, count). If string contains unicode text, the binary mode of fromstring will first encode it into bytes using either utf-8 (python 3) or the default encoding (python 2), neither of which produce sane results. If you use tos

CSS For Grabbing Cursors (drag & Drop)

Answer : In case anyone else stumbles across this question, this is probably what you were looking for: .grabbable { cursor: move; /* fallback if grab cursor is unsupported */ cursor: grab; cursor: -moz-grab; cursor: -webkit-grab; } /* (Optional) Apply a "closed-hand" cursor during drag operation. */ .grabbable:active { cursor: grabbing; cursor: -moz-grabbing; cursor: -webkit-grabbing; } I think move would probably be the closest standard cursor value for what you're doing: move Indicates something is to be moved. CSS3 grab and grabbing are now allowed values for cursor . In order to provide several fallbacks for cross-browser compatibility3 including custom cursor files, a complete solution would look like this: .draggable { cursor: move; /* fallback: no `url()` support or images disabled */ cursor: url(images/grab.cur); /* fallback: Internet Explorer */ cursor: -webkit-grab; /* Chrome 1-21, Safari 4+ */ cursor: -

Crude Explode In Php Code Example

Example: explode a number php $nums = "" ; //Declare a variable with empty set. $nums .= $number ; //concatenate the empty string with the integer $number You can also use $nums = $nums . $number ; // this and the expression above do the same thing choose whichever you //like.. This concatenation automatically converts integer to string $nums [ 0 ] is now 4 , $nums [ 1 ] is now 5 , etc . . $length = strlen ( $nums ) ; // This is the length of your integer. $target = strlen ( $nums ) - 1 ; // target the last digit in the string; $last_digit = $nums [ $target ] ; // This is the value of 5. Last digit in the (now string)

Hide Scrollbar But Still Scroll Css Code Example

Example 1: hide scrollbar css /* Hide scrollbar for Chrome, Safari and Opera */ .scrollbar-hidden ::-webkit-scrollbar { display : none ; } /* Hide scrollbar for IE, Edge add Firefox */ .scrollbar-hidden { -ms-overflow-style : none ; scrollbar-width : none ; /* Firefox */ } Example 2: hide scrollbar css /* A very quick an applicable solution is to use this piece of code: */ html { overflow : scroll ; overflow-x : hidden ; } ::-webkit-scrollbar { width : 0 px ; /* remove scrollbar space / background: transparent; / optional: just make scrollbar invisible / } / optional: show position indicator in red */ ::-webkit-scrollbar-thumb { background : #FF0000 ; } Example 3: css stop scrollbar html { scrollbar-width : none ; /* For Firefox */ -ms-overflow-style : none ; /* For Internet Explorer and Edge */ } html ::-webkit-scrollbar { width : 0 px ; /* For Chrome, Safari, and Opera */ } Example 4: hide scroll bar when not needed overflow : auto ; Exampl

Calculate The Standard Deviation Of Grouped Data In A Spark DataFrame

Image
Answer : Spark 1.6+ You can use stddev_pop to compute population standard deviation and stddev / stddev_samp to compute unbiased sample standard deviation: import org.apache.spark.sql.functions.{stddev_samp, stddev_pop} selectedData.groupBy($"user").agg(stdev_pop($"duration")) Spark 1.5 and below ( The original answer ): Not so pretty and biased (same as the value returned from describe ) but using formula: you can do something like this: import org.apache.spark.sql.functions.sqrt selectedData .groupBy($"user") .agg((sqrt( avg($"duration" * $"duration") - avg($"duration") * avg($"duration") )).alias("duration_sd")) You can of course create a function to reduce the clutter: import org.apache.spark.sql.Column def mySd(col: Column): Column = { sqrt(avg(col * col) - avg(col) * avg(col)) } df.groupBy($"user").agg(mySd($"duration").a

Creating Classes And Objects Using Bash Scripting

Image
Answer : You can try to do something like this example.sh #!/bin/bash # include class header . obj.h . system.h # create class object obj myobject # use object method myobject.sayHello # use object property myobject.fileName = "file1" system.stdout.printString "value is" system.stdout.printValue myobject.fileName obj.h obj(){ . <(sed "s/obj/$1/g" obj.class) } obj.class # Class named "obj" for bash Object # property obj_properties=() # properties IDs fileName=0 fileSize=1 obj.sayHello(){ echo Hello } obj.property(){ if [ "$2" == "=" ] then obj_properties[$1]=$3 else echo ${obj_properties[$1]} fi } obj.fileName(){ if [ "$1" == "=" ] then obj.property fileName = $2 else obj.property fileName fi } system.h . system.class system.class system.stdout.printValue(){ echo $($@) } system.stdout.printString(){ echo $@ } Link for refer

Font Awesome 5 Free Reset Icon Code Example

Example: fa fa reset <i class= "fa fa-refresh" aria-hidden= "true" ></i>

Css Text Color W3schools Code Example

Example 1: text color css .class { color: white; } Example 2: text color css body { color: blue; } h1 { color: green; }

Scss Add Class In Class Code Example

Example: sass class with another class .myclass { font-weight : bold ; font-size : 90 px ; } .myotherclass { @extend .myclass ; color : #000000 ; }

Add Stripe Bank Account Api Code Example

Example: stripe api accounts transfer to bank EDIT: On newer API versions (>= 2017-04-06), "internal transfers" are now simply known as "transfers", and "external transfers" are now known as "payouts". Cf. this doc page for more information.

CSS Table And Max-width In Chrome Not Working

Answer : Technically Chrome is following the rules because max-width should only apply to block elements . From MSDN docs: The min-width/max-width attributes apply to floating and absolutely positioned block and inline-block elements, as well as some intrinsic controls. They do not apply to non-replaced inline elements, such as table rows and row/column groups. (A "replaced" element has intrinsic dimensions, such as an img or textArea.) The table (or in your case display:table) should technically not work or be supported. FF apparently obeys it fine, but you'll probably need to come up with another solution, either removing the display:table or the max-width . max-width property MSDN Doc The solution I found was using table-layout: fixed and width: 100% Create a div and give it a styling to display block and a max width. You may use traditional <table> and give it a styling of 100% width.