Posts

Showing posts from May, 2011

Convert Enum To String Java Code Example

Example 1: enum value to string class Program. static void Main(string[] args) { Enum wkday = Weekday.Friday; Console.WriteLine("Enum string is '{0}'", wkday.ToString()); Console.ReadKey(); } Example 2: java enum to string public enum MyEnum{ SOMETHING,SOMETHING_ELSE } MyEnum enumObject=MyEnum.SOMETHING; System.out.println(enumObject.toString()); System.out.println(enumObject.name()); Example 3: enum to string java yourEnum.name()

Create Video Playlist Using Jquery Code Example

Example: create video playlist using jquery function handler(e) { e.preventDefault(); videotarget = this.getAttribute("href"); filename = videotarget.substr(0, videotarget.lastIndexOf('.')) || videotarget; video = document.querySelector("#video_player video"); video.removeAttribute("controls"); video.removeAttribute("poster"); source = document.querySelectorAll("#video_player video source"); source[0].src = filename + ".mp4"; source[1].src = filename + ".webm"; video.load(); video.play(); }

How To Convert A Char To An Int C++ Code Example

Example 1: convert char to int c++ char a = '6' ; //bounded by 0 and 9 int n1 = a - '0' ; int n2 = a - 48 ; int n3 = std :: stoi ( & a ) ; Example 2: char to int c++ int x = ( int ) character - 48 ; Example 3: char* to int in cpp int x = std :: stoi ( "42" ) Example 4: converting char to integer c++ int x = '9' - 48 ; // x now equals 9 as an integer Example 5: convert char to int c++ int x = character - '0'

Converting String To Array Php Code Example

Example: string to array php str_split ( string $string [ , int $split_length = 1 ] ) : array

Nunito Google Font Wordpress Code Example

Example: nunito font family To embed a font , copy the code into the <head> of your html <link href= "https://fonts.googleapis.com/css2?family=Nunito:wght@200&display=swap" rel= "stylesheet" > font-family : 'Nunito' , sans-serif ;

Css Transition Padding Code Example

Example 1: css transition all -webkit-transition : all .3 s ease-in-out ; -moz-transition : all .3 s ease-in-out ; -o-transition : all .3 s ease-in-out ; -ms-transition : all .3 s ease-in-out ; transition : all .3 s ease-in-out ; Example 2: css background color transition /* Answer to: "css background color transition" */ /* Transitions currently work in Safari, Chrome, Firefox, Opera and Internet Explorer 10+. The following should produce a fade effect for you on the browsers mentioned above: */ a { background-color : #FF0 ; } a :hover { background-color : #AD310B ; -webkit-transition : background-color 1000 ms linear ; -ms-transition : background-color 1000 ms linear ; transition : background-color 1000 ms linear ; }

Shake Animation Css Code Example

Example: error shake animation css .face :hover { animation : shake 0.82 s cubic-bezier ( .36 , .07 , .19 , .97 ) both ; transform : translate3d ( 0 , 0 , 0 ) ; backface-visibility : hidden ; perspective : 1000 px ; } @keyframes shake { 10% , 90% { transform : translate3d ( -1 px , 0 , 0 ) ; } 20% , 80% { transform : translate3d ( 2 px , 0 , 0 ) ; } 30% , 50% , 70% { transform : translate3d ( -4 px , 0 , 0 ) ; } 40% , 60% { transform : translate3d ( 4 px , 0 , 0 ) ; } }

How To Import Local Font In Html Code Example

Example 1: import font css @font-face { font-family : "Open Sans" ; src : url ( "/fonts/OpenSans-Regular-webfont.woff2" ) format ( "woff2" ) , url ( "/fonts/OpenSans-Regular-webfont.woff" ) format ( "woff" ) ; } Example 2: css font face @font-face { // Defining what the font will be called font-family : thisSpecialFont ; // Linking to the font file src : url ( linkToFontFile.woff ) ; } body { font-family : thisSpecialFont ; } Example 3: use font on website html <style type= "text/css" > @font-face { font-family : "My Custom Font" ; src : url ( http://www.example.org/mycustomfont.ttf ) format ( "truetype" ) ; } p .customfont { font-family : "My Custom Font" , Verdana , Tahoma ; } </style> <p class= "customfont" >Hello world!</p>

Create Programmatically A WooCommerce Product Variation With New Attribute Values

Image
Answer : Update January 2020: Changed to WC_Product method get_name() instead of get_title() Update September 2018: Handling taxonomy creation (Thanks to Carl F. Corneil) From a defined variable product ID You will find below, a custom function that will add (create) a Product variation. The variable parent product needs to have set for it the needed attributes. You will need to provide some information as: the array of attributes/values the Sku, prices and stock…. This data has to be stored in a formatted multi dimensional array (see an example at the end) . This function will check if the attributes values (term name) already exist and if not: it create it for the product attribute set it in the parent variable product. The custom function code: /** * Create a product variation for a defined variable product ID. * * @since 3.0.0 * @param int $product_id | Post ID of the product parent variable product. * @param array $variation_data | The data to insert in the product.

Print Array Of Int C Code Example

Example: print an array in c int array [ 10 ] = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 } ; int i ; for ( i = 0 ; i < 10 ; i ++ ) { printf ( "%d " , array [ i ] ) ; }

Can I Create A Flow Chart (no Tree Chart) Using D3.js

Image
Answer : can I create a flowchart like this one? D3 is capable of doing it. starting form a json object using the D3.js library? Yes What should the json structure look like? Depends on how you approach the project. I'm using force layout and removing the force, so my JSON is {node: [{ id: 1, title: 'title' }], link: [{ source: 0, target: 1 }] } Have you got any example I can analyse? For your inspiration http://marvl.infotech.monash.edu/webcola/ http://www.coppelia.io/2014/07/an-a-to-z-of-extra-features-for-the-d3-force-layout/ Starting point https://github.com/mbostock/d3/wiki/Force-Layout how to wrap your text in block http://bl.ocks.org/mbostock/7555321 D3.js is not suited very well for this kind of visualization. The visualization is just too complex to do a simple mapping from data to SVG Not sure why, but IMO flowcharts are one of the simplest types of diagrams, blocks and lines that c

Shadows Bootstrap Code Example

Example: boostrap shadow <div class= "shadow-none p-3 mb-5 bg-light rounded" >No shadow</div> <div class= "shadow-sm p-3 mb-5 bg-white rounded" >Small shadow</div> <div class= "shadow p-3 mb-5 bg-white rounded" >Regular shadow</div> <div class= "shadow-lg p-3 mb-5 bg-white rounded" >Larger shadow</div>

156 In Binary Number Code Example

Example: how to make a binary number inaudrino byte binary_number = 0b00000000;

HTML Mdn Code Example

Example: input radio html <form> <p>Veuillez choisir la meilleure méthode pour vous contacter : </p> <div> <input type= "radio" id= "contactChoice1" name= "contact" value= "email" > <label for= "contactChoice1" >Email</label> <input type= "radio" id= "contactChoice2" name= "contact" value= "telephone" > <label for= "contactChoice2" >Téléphone</label> <input type= "radio" id= "contactChoice3" name= "contact" value= "courrier" > <label for= "contactChoice3" >Courrier</label> </div> <div> <button type= "submit" >Envoyer</button> </div> </form>

Css Tables W3schools Code Example

Example 1: table border css table, th, td { border: 1px solid black; } Example 2: table css tr , th , td { border: 1px solid black; padding: 5%; text-align: center; }

Angular-ui-router: Ui-sref-active And Nested States

Answer : Instead of this- <li ui-sref-active="active"> <a ui-sref="posts.details">Posts</a> </li> You can do this- <li ng-class="{active: $state.includes('posts')}"> <a ui-sref="posts.details">Posts</a> </li> Currently it doesn't work. There is a discussion going on here (https://github.com/angular-ui/ui-router/pull/927) And, it will be added soon. UPDATE: For this to work, $state should be available in view. angular.module('xyz').controller('AbcController', ['$scope', '$state', function($scope, $state) { $scope.$state = $state; }]); More Info UPDATE [2]: As of version 0.2.11 , it works out of the box. Please check the related issue: https://github.com/angular-ui/ui-router/issues/818 Here's an option for when you are nesting multiple states that are not hierarchically related and you don't have a controller ava

.ps1 Cannot Be Loaded Because Running Scripts Is Disabled On This System. F Code Example

Example 1: tsc.ps1 cannot be loaded because running scripts is disabled on this system Set-ExecutionPolicy -ExecutionPolicy RemoteSigned Example 2: file_check.ps1 cannot be loaded because running scripts is disabled on this system. Set-ExecutionPolicy Unrestricted