Posts

Showing posts from June, 2017

Animator Trigger Unity Code Example

Example 1: c# unity animation trigger //Attach this script to a GameObject with an Animator component attached. //For this example, create parameters in the Animator and name them “Crouch” and “Jump”. //Apply these parameters to your transitions between states. //This script allows you to trigger an Animator parameter and reset the other that could possibly still be active. Press the up and down arrow keys to do this. using UnityEngine ; public class Example : MonoBehaviour { Animator m_Animator ; void Start ( ) { //Get the Animator attached to the GameObject you are intending to animate. m_Animator = gameObject . GetComponent < Animator > ( ) ; } void Update ( ) { //Press the up arrow button to reset the trigger and set another one if ( Input . GetKey ( KeyCode . UpArrow ) ) { //Reset the "Crouch" trigger m_Animator . ResetTrigger ( "Crouch" )

Core I7 With 4GB - Go 64 Bit Or Stay 32bit..?

Answer : There may well be some annoyances along the way. A few of the proprietary components of Ubuntu (like the Oracle Java runtime and Adobe Flash) might be a bit harder to install that you would expect. There may also be problems with some obscure wireless drivers and the like - but this is the exception rather than the rule. Other than that, Linux' great 32 bit compatibility layer ensures that your system will be pretty much rock solid and, often time, quite a bit better at computational task that benefit from the larger address size. Ubuntu server is now recommended by canonical in its 64 bit form per default. There is, all in all, much trust in the 64 bit linux architecture. It is no longer experimental, it is no longer just an add on. And even though some of the applications haven't caught up (flash is the only one of them that matters, really), the Linux kernel is now considered a 64 bit system with a 32 bit compatibility layer, rather than the other way round.

Convert String To Int In Javascript Code Example

Example 1: how to convert string to int js let string = "1" ; let num = parseInt ( string ) ; //num will equal 1 as a int Example 2: Javascript string to int var myInt = parseInt ( "10.256" ) ; //10 var myFloat = parseFloat ( "10.256" ) ; //10.256 Example 3: convert string to number javascript var myString = "869.99" var myFloat = parseFloat ( myString ) var myInt = parseInt ( myString ) Example 4: how to change a string to number in javascript let theInt = parseInt ( "5.90123" ) ; //5 let theFloat = parseFloat ( "5.90123" ) ; //5.90123 Example 5: string to int javascript var text = '42px' ; var integer = parseInt ( text , 10 ) ; // returns 42 let myNumber = Number ( "5.25" ) ; //5.25 Example 6: javascript convert string to number or integer //It accepts two arguments. //The first argument is the string to convert. //The second argument is called the radix. This is the base number

56cm To Inches Code Example

Example: cm to inches const cm = 1 ; console . log ( ` cm: ${ cm } = in: ${ cmToIn ( cm ) } ` ) ; function cmToIn ( cm ) { var in = cm / 2.54 ; return in ; }

Get Css Value Using Jquery Code Example

Example 1: jquery css $ ( '#element' ) . css ( 'display' , 'block' ) ; /* Single style */ $ ( ' #element ' ) .css ( { 'display' : 'block' , 'background-color' : '#2ECC40' } ) ; /* Multiple style */ Example 2: styling element using jquery Syntax : $ ( selector ) . css ( property-name : property-value ) ; Example : $ ( '.bodytext' ) . css ( 'color' : 'red' ) ;

How To Change An Object Transform With Transform.position In Unity Code Example

Example 1: how to get the transform of an object in unity Transform YourGameObjectsTransfrom = YourGameObject . transform ; Example 2: how to reference a transform unity //how to reference the position of a gameObject in unity using System . Collections ; using System . Collections . Generic ; using UnityEngine ; public class ExampleScript : MonoBehaviour { private Transform player ; private void Start ( ) { player = GameObject . Find ( "Player" ) . transform ; } }

Convert Quill Delta To HTML

Answer : Not very elegant, but this is how I had to do it. function quillGetHTML(inputDelta) { var tempCont = document.createElement("div"); (new Quill(tempCont)).setContents(inputDelta); return tempCont.getElementsByClassName("ql-editor")[0].innerHTML; } Obviously this needs quill.js. I guess you want the HTML inside it. Its fairly simple. quill.root.innerHTML If I've understood you correctly, there's a quill thread of discussion here, with the key information you're after. I've quoted what should be of most value to you below: Quill has always used Deltas as a more consistent and easier to use (no parsing) data structure. There's no reason for Quill to reimplement DOM APIs in addition to this. quill.root.innerHTML or document.querySelector(".ql-editor").innerHTML works just fine ( quill.container.firstChild.innerHTML is a bit more brittle as it depends on child ordering) and the previous getHTML implementation

Angular Material Dialog: How To Update The Injected Data When They Change In The Parent Component?

Answer : You can just change data of the component instance, like this: this.dialogRef.componentInstance.data = {numbers: value}; Example here: https://stackblitz.com/edit/angular-dialog-update There are 2 ways I can think of at the moment, I don't really like either, but hey... Both ways involve sending an observable to the dialog through the data. You could pass on the observable of the part to the part component, and then pass the observable in the data to the dialog. The dialog could then subscribe to the observable and get the updates that way. AreaComponent @Component({ selector: 'app-area', template: '<app-part *ngFor="let part of planAsync$ | async; i as index" [partData]="part" [part$]="part$(index)"></app-part>' }) export class AreaComponent { plan = []; constructor(private wampService: WampService) { } part$(index) { return this.planAsync$ .map(plan => plan[index]);

Angular Firestore Get Document By Id Code Example

Example 1: firestore get id of new document async function addCity(newCity) { const { id } = await db.collection("cities").add(newCity) console.log("the new city's id:", id) } Example 2: get doc id firestore const racesCollection: AngularFirestoreCollection < Race > ; return racesCollection.snapshotChanges().map(actions => { return actions.map(a => { const data = a.payload.doc.data() as Race; data.id = a.payload.doc.id; return data; }); });

Youtube Playlist Downloader Mp3 Code Example

Example: youtube dl download playlist mp3 youtube - dl -- extract - audio -- audio - format mp3 - o "%(title)s.%(ext)s" < url to playlist >

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

Crontab Every 10 Minutes Code Example

Example 1: crontab every 5 minutes */5 * * * * Example 2: cron job every 10 seconds */10 * * * * * will run every 10 sec.

Bridged Vs. NAT: A Virtualbox And VMWare Comparison

Answer : This all looks normal to me. Anything under 10.0.0.0/8 (and also 172.16.0.0/12) are perfectly normal NAT addresses. When you put your VMs in NAT mode, the software is essentially acting as it's own dhcp server for the guest machines and will do translations to the host network, so that all the guests on a particular host share an IP with the host. Anything in any of those ranges are fair game for NAT. It appears that VMWare uses a 192.168.0.0/24 range by default, and VirtualBox uses a 10.0.0.0 range. Both are just fine, and neither is better than the other (though I personally prefer 10.0.0.0 ranges because there are 255 times more addresses available). It sounds like maybe you expected NAT mode to use the NAT between your host network and the internet, but that just doesn't happen. In fact, that is what bridge mode does. Switching to bridged mode means your VM guests are now connected directly to your home router's dhcp server for addresses. VirtualB

Apple - Alternative To TotalTerminal That Works With El Capitan

Answer : If you're willing to disable System Integrity Protection to continue using TotalTerminal, you can do that. If not, the developer of TotalTerminal says the reason he stopped working on it is that he switched to iTerm 2, which he says "offers similar functionality to Visor and comparable features to build-in [sic] Terminal.app." I've never used either, but another question on this site explains how to set up iTerm to work in a similar manner.

Maxint In C Code Example

Example: C largest unsigned int The sizeof function will help you here . sizeof ( data type ) returns a size_t //Number of bytes whatever the input for sizeof takes Example : //This statement will return 2 or 4 (depending on your system) return sizeof ( int )

Instagram Color Code Gradient Css Code Example

Example: linear gradient instagram background : #f09433 ; background : -moz-linear-gradient ( 45 deg , #f09433 0 % , #e6683c 25 % , #dc2743 50 % , #cc2366 75 % , #bc1888 100 % ) ; background : -webkit-linear-gradient ( 45 deg , #f09433 0 % , #e6683c 25 % , #dc2743 50 % , #cc2366 75 % , #bc1888 100 % ) ; background : linear-gradient ( 45 deg , #f09433 0 % , #e6683c 25 % , #dc2743 50 % , #cc2366 75 % , #bc1888 100 % ) ; filter : progid : DXImageTransform.Microsoft. gradient ( startColorstr= '#f09433' , endColorstr= '#bc1888' , GradientType= 1 ) ;

CreateBottomTabNavigator Import Code Example

Example: react native tab navigation import * as React from 'react'; import { Text, View } from 'react-native'; import { NavigationContainer } from '@react-navigation/native'; import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; function HomeScreen() { return ( < View style = {{ flex: 1, justifyContent: 'center', alignItems: 'center' }} > < Text > Home! </ Text > </ View > ); } function SettingsScreen() { return ( < View style = {{ flex: 1, justifyContent: 'center', alignItems: 'center' }} > < Text > Settings! </ Text > </ View > ); } const Tab = createBottomTabNavigator(); export default function App() { return ( < NavigationContainer > < Tab.Navigator > < Tab.Screen name = " Home " component = {HomeScreen} /> < Tab.Screen name = " S

Hello World Welcome To C Programming Code Example

Example 1: c hello world # include <stdio.h> int main ( ) { printf ( "Hello, world!" ) ; return 0 ; } Example 2: c print hello world # include <stdio.h> int main ( ) { // printf() displays the string inside quotation printf ( "Hello, World!" ) ; return 0 ; }

Css Spin Image Button Code Example

Example: css rotate animation <img class="image" src="http://i .stack .imgur .com /pC1Tv .jpg " alt="" width="120" height="120" > .image { position : absolute ; top : 50 % ; left : 50 % ; width : 120 px ; height : 120 px ; margin : -60 px 0 0 -60 px ; -webkit-animation : spin 4 s linear infinite ; -moz-animation : spin 4 s linear infinite ; animation : spin 4 s linear infinite ; } @-moz-keyframes spin { 100% { -moz-transform : rotate ( 360 deg ) ; } } @-webkit-keyframes spin { 100% { -webkit-transform : rotate ( 360 deg ) ; } } @keyframes spin { 100% { -webkit-transform : rotate ( 360 deg ) ; transform : rotate ( 360 deg ) ; } }

Can I Cleanly Delete Firebase CLI Project?

Answer : You should delete firebase.json and .firebaserc if it exists. Once those files are deleted you should be good to go. I am using the following command npm uninstall firebase and npm uninstall angularfire2 it works for me

Std Map Find Key Code Example

Example: c++ map find // map::find # include <iostream> # include <map> int main ( ) { std :: map < char , int > mymap ; std :: map < char , int > :: iterator it ; mymap [ 'a' ] = 50 ; mymap [ 'b' ] = 100 ; mymap [ 'c' ] = 150 ; mymap [ 'd' ] = 200 ; it = mymap . find ( 'b' ) ; if ( it != mymap . end ( ) ) mymap . erase ( it ) ; // print content: std :: cout << "elements in mymap:" << '\n' ; std :: cout << "a => " << mymap . find ( 'a' ) -> second << '\n' ; std :: cout << "c => " << mymap . find ( 'c' ) -> second << '\n' ; std :: cout << "d => " << mymap . find ( 'd' ) -> second << '\n' ; return 0 ; }

Can I Convert Css To Scss And Scss To Css Parallelly?

Answer : It is possible , but not ideal. Your best bet is to crack open your terminal and run sass-convert --from css --to scss in the directory where your styles are located and then refactor from there . It's a pain, and not a true "conversion". It tries to nest properly, and usually gets it right, but if you're not refactoring the code and using things like mix-ins, extends, and variables, it kind of defeats the purpose of using SASS to begin with. To automate this, you may want to use something like Guard to watch the css files for changes. You'll want to make sure you're not also watching your main style (the one that sass is compiling to), as this will put you in a never-ending loop of conversion! Use a command for installing compass gem install compass Run this command. This will scan defined directory for css files and convert them to scss files. sass-convert -R my_css_dir --from css --to scss Then execute this command compass watch

Componentdidmount To Functional Component Example

Example 1: how to use componentdidmount in functional component // passing an empty array as second argument triggers the callback in useEffect // only after the initial render thus replicating `componentDidMount` lifecycle behaviour useEffect(() => { if(!props.fetched) { props.fetchRules(); } console.log('mount it!'); }, []); // componentDidUpdate useEffect({ your code here }) // For componentDidUpdate useEffect(() => { // Your code here }, [yourDependency]); // For componentWillUnmount useEffect(() => { // componentWillUnmount return () => { // Your code here } }, [yourDependency]); Example 2: useeffect react useEffect(() => { window.addEventListener('mousemove', () => {}); // returned function will be called on component unmount return () => { window.removeEventListener('mousemove', () => {}) } }, [])