Posts

Showing posts from January, 2019

Title Case Css Code Example

Example 1: css all caps .uppercase { text-transform : uppercase ; } #example { text-transform : none ; /* No capitalization, the text renders as it is (default) */ text-transform : capitalize ; /* Transforms the first character of each word to uppercase */ text-transform : uppercase ; /* Transforms all characters to uppercase */ text-transform : lowercase ; /* Transforms all characters to lowercase */ text-transform : initial ; /* Sets this property to its default value */ text-transform : inherit ; /* Inherits this property from its parent element */ } Example 2: conveert text to uppercase in input field <input type= "text" class= "normal" name= "Name" size= "20" maxlength= "20" style= "text-transform:uppercase" /> Example 3: How do you make each word in a text start with a capital letter? h1 { text-transform : capitalize ; } Example 4: css all uppercase to c

Convert String Json To Object Java Code Example

Example 1: convert json string to json object in java try { JSONObject jsonObject = new JSONObject ( "{\"phonetype\":\"N95\",\"cat\":\"WP\"}" ) ; } catch ( JSONException err ) { Log . d ( "Error" , err . toString ( ) ) ; } Example 2: how to convert json to java object Jackson Data - bind depdendency that take care of Converting between JSON to Java Object and Java Object to JSON < dependency > < groupId > com . fasterxml . jackson . core < / groupId > < artifactId > jackson - databind < / artifactId > < version > 2.12 .0 < / version > < / dependency >

Print Long Double In C Code Example

Example: print double in c # include <stdio.h> int main ( ) { double d = 123.32445 ; //using %f format specifier printf ( "Value of d = %f\n" , d ) ; //using %lf format specifier printf ( "Value of d = %lf\n" , d ) ; return 0 ; }

How Do You Comment Out In Html Code Example

Example 1: commenting in html <!-- a comment in html --> Example 2: how to comment in html <!-- your comment goes here --> Example 3: html note <!-- This is an HTML note -->

Add Velocity To Rigidbody Unity Code Example

Example 1: unity how to set rigidbody velocity Vector3 velocity = new Vector3 ( 10f /*x*/ , 10f /*y*/ , 10f /*z*/ ) ; GetComponent < Rigidbody > ( ) . velocity = velocity ; Example 2: rigidbody velocity c# unity //for rigidbody2D GetComponent < Rigidbody2D > ( ) . velocity = new Vector2 ( 40 , 0 ) ;

A Sql Query Automatically Eliminates Duplicates Code Example

Example 1: sql delete duplicate -- Oracle DELETE films WHERE rowid NOT IN ( SELECT min ( rowid ) FROM films GROUP BY title , uk_release_date ) ; Example 2: how to query without duplicate rows in sql SELECT DISTINCT col1 , col2 . . . FROM table_name where Condition ; Example 3: how to remove duplicate in sql Distinct : helps to remove all the duplicate records when retrieving the records from a table . SELECT DISTINCT FIRST_NAME FROM VISITORS ; Example 4: sql delete duplicate rows but keep one # Step 1: Copy distinct values to temporary table CREATE TEMPORARY TABLE tmp_user ( SELECT id , name FROM user GROUP BY name ) ; # Step 2: Remove all rows from original table DELETE FROM user ; # Step 3: Remove all rows from original table INSERT INTO user ( SELECT * FROM tmp_user ) ; # Step 4: Remove temporary table DROP TABLE tmp_user ; Example 5: sql query to delete duplicate records --ID should be pri

Scroll To The Top Of The Page Javascript Code Example

Example 1: javascript scroll to top of page //Instant scroll to top of page window. scrollTo ( 0 , 0 ) ; Example 2: javascript go to top of page window .scroll ( { top : 0 , left : 0 , behavior : 'smooth' } ) ; Example 3: javascript go to top of page window .scroll ( { top : 0 , left : 0 } ) ; //Or with jQuery $ ( 'html,body' ) . scrollTop ( 0 ) ; //with animation $ ( 'html , body' ) .animate ( { scrollTop : 0 } , 'fast' ) ; Example 4: scroll to top $ ( " #scroll_icon " ) .click ( function ( ) { jQuery ( 'html , body' ) .animate ( { scrollTop : 0 } , 2000 ) ; } )

Concat Function Javascript Code Example

Example 1: combine two arrays javascript let arr1 = [ 0 , 1 , 2 ] ; let arr2 = [ 3 , 5 , 7 ] ; let primes = arr1 . concat ( arr2 ) ; // > [0, 1, 2, 3, 5, 7] Example 2: string concatenation in js var str1 = "Hello " ; var str2 = "world!" ; var res = str1 . concat ( str2 ) ; console . log ( res ) ; Example 3: string concat javascript //This method adds two or more strings and returns a new single string. let str1 = new String ( "This is string one" ) ; let str2 = new String ( "This is string two" ) ; let str3 = str1 . concat ( str2 . toString ( ) ) ; console . log ( "str1 + str2 : " + str3 ) output : str1 + str2 : This is string oneThis is string two Example 4: javascript concat let chocholates = [ 'Mars ' , 'BarOne ' , 'Tex ' ] ; let chips = [ 'Doritos ' , 'Lays ' , 'Simba ' ] ; let sweets = [ 'JellyTots ' ] ; let snacks = [ ] ; snacks .

Cristiano Ronaldo Gif Code Example

Example: cristiano ronaldo CR7 is the GOAT

C# Unity Animation Loop Code Example

Example: how to loop an animation in unity Its probably too late to help you with this, but just incase anyone else has this issue, your looping options are greyed out because your animation from the asset store is read-only, select your animation in the project window, and press Ctrl+D to duplicate it, and you should be able to now set the looping options on the new animation as the other answerers have described.

Convert A Pandas DataFrame To A Dictionary

Answer : The to_dict() method sets the column names as dictionary keys so you'll need to reshape your DataFrame slightly. Setting the 'ID' column as the index and then transposing the DataFrame is one way to achieve this. to_dict() also accepts an 'orient' argument which you'll need in order to output a list of values for each column. Otherwise, a dictionary of the form {index: value} will be returned for each column. These steps can be done with the following line: >>> df.set_index('ID').T.to_dict('list') {'p': [1, 3, 2], 'q': [4, 3, 2], 'r': [4, 0, 9]} In case a different dictionary format is needed, here are examples of the possible orient arguments. Consider the following simple DataFrame: >>> df = pd.DataFrame({'a': ['red', 'yellow', 'blue'], 'b': [0.5, 0.25, 0.125]}) >>> df a b 0 red 0.500 1 yellow 0.250 2 blue 0.125 The

Android Studio Design Editor Is Unavailable Until After A Successful Project Sync

Answer : Just sync your project with gradles. File --> Sync Project with Gradle Files Build -> Clean Project Build -> Rebuild Project File -> Sync project with gradle files . If not worked then try File -> Invalidate Caches / Restart . It's work for me !!!

Convert Inline SVG To Base64 String

Answer : Use XMLSerializer to convert the DOM to a string var s = new XMLSerializer().serializeToString(document.getElementById("svg")) and then btoa can convert that to base64 var encodedData = window.btoa(s); Just prepend the data URL intro i.e. data:image/svg+xml;base64, and there you have it. You can do it relatively straightforwardly as follows. The short version is Make an image not attached to the dom Set its size to match the source svg base64 encode the source svg , append the relevant data, set img src Get the canvas context; .drawImage the image <script type="text/javascript"> window.onload = function() { paintSvgToCanvas(document.getElementById('source'), document.getElementById('tgt')); } function paintSvgToCanvas(uSvg, uCanvas) { var pbx = document.createElement('img'); pbx.style.width = uSvg.style.width; pbx.style.height = uSvg.style.height; pbx.src = 'data:

Can You Split A Stream Into Two Streams?

Answer : A collector can be used for this. For two categories, use Collectors.partitioningBy() factory. This will create a Map from Boolean to List , and put items in one or the other list based on a Predicate . Note: Since the stream needs to be consumed whole, this can't work on infinite streams. And because the stream is consumed anyway, this method simply puts them in Lists instead of making a new stream-with-memory. You can always stream those lists if you require streams as output. Also, no need for the iterator, not even in the heads-only example you provided. Binary splitting looks like this: Random r = new Random(); Map<Boolean, List<String>> groups = stream .collect(Collectors.partitioningBy(x -> r.nextBoolean())); System.out.println(groups.get(false).size()); System.out.println(groups.get(true).size()); For more categories, use a Collectors.groupingBy() factory. Map<Object, List<String>> groups = stream

Js Style Background Image Url Code Example

Example 1: js background image document.body.style.backgroundImage = "url('img_tree.png')" ; Example 2: set an attribute background image javascript function bg ( ) { var imgCount = 3 ; var dir = 'http://local.statamic.com/_themes/img/' ; // I changed your random generator // floor : helps getting a random integer var randomCount = ( Math. floor ( Math. random ( ) * imgCount ) ) ; // I changed your array to the literal notation. The literal notation is preferred. var images = [ '001.png' , '002.png' , '003.png' ] ; // I changed this section to just define the style attribute the best way I know how. document. getElementById ( 'banner' ) . setAttribute ( "style" , "background-image: url(" + dir + images[randomCount] + ");background-repeat: no-repeat;background-size: 388px 388px" ) ; } // Don't forget to run the function instead of just defining it. bg ( )

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

Create XML In Javascript

Answer : Disclaimer: The following answer assumes that you are using the JavaScript environment of a web browser. JavaScript handles XML with 'XML DOM objects'. You can obtain such an object in three ways: 1. Creating a new XML DOM object var xmlDoc = document.implementation.createDocument(null, "books"); The first argument can contain the namespace URI of the document to be created, if the document belongs to one. Source: https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocument 2. Fetching an XML file with XMLHttpRequest var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (xhttp.readyState == 4 && xhttp.status == 200) { var xmlDoc = xhttp.responseXML; //important to use responseXML here } xhttp.open("GET", "books.xml", true); xhttp.send(); 3. Parsing a string containing serialized XML var xmlString = "<root></root>"; var parser = new DOMParser(); var xmlDoc = pa

40 Second Timer Code Example

Example: 20 minute timer for good eyesight every 20 minutes look out the window at something 20 feet away for 20 seconds

Android: How To Initialize A Variable Of Type "Location" (other Than Making It Equal To Null)

Answer : The API documentation is quite clear on this. First create a new Location instance: Location loc = new Location("dummyprovider"); And then use the setter methods to set the location parameters you need, e.g.: loc.setLatitude(20.3); loc.setLongitude(52.6); Location object = new Location("service Provider"); it will create an object of Type Location that contains the initial Latitude and Longitude at location '0' to get the initial values use double lat = object.getLatitude(); double lng = object.getLongitude(); In Kotlin using LocationManager class you can pass the required location provider like: val location = Location(LocationManager.NETWORK_PROVIDER) // OR GPS_PROVIDER based on the requirement location.latitude = 42.125 location.longitude = 55.123

Javafx Padding Betwrrn Buttons Code Example

Example: javafx change button background color /*can address these properties: */ -fx-border-width -fx-border-color -fx-background-color -fx-font-size -fx-text-fill /* see source for more examples see JavaFX CSS Reference Guide for additional properties: https://docs.oracle.com/javafx/2/api/javafx/scene/doc-files/cssref.html */

Css Is Not Working In Html Code Example

Example 1: why is my css code not working # If you havent put this in your code this may be the reason why your CSS code isnt working , its weird but yeah! <link type= "text/css" rel= "stylesheet" href= "http://fakedomain.com/smilemachine/html.css" /> Example 2: css not working <link type= "text/css" rel= "stylesheet" href= "http://yourdomain.com/dir/file.css" />

Css Transition Opacity Fade In Code Example

Example 1: css transition opacity /* Answer to: "css transition opacity" */ /* CSS transitions allows you to change property values smoothly, over a given duration. */ .myClass { vertical-align : top ; transition : opacity 0.3 s ; /* Transition should take 0.3s */ -webkit-transition : opacity 0.3 s ; /* Transition should take 0.3s */ opacity : 1 ; /* Set opacity to 1 */ } .myClass :hover { opacity : 0.5 ; /* On hover, set opacity to 2 */ } /* From `opacity: 1;` to `opacity: 0.5;`, the transition time should take 0.3 seconds as soon as the client starts to hover over the element. */ Example 2: css opacity transition div { transition : opacity seconds ; }

Adb Logcar Code Example

Example: logcat android Logcat is a command - line tool that dumps a log of system messages , including stack traces when the device throws an error and messages that you have written from your app with the Log class .