Posts

Showing posts from March, 2018

Adjust Bootstrap Tooltip Width

Answer : I hope I'm not too late to post this for future programmers looking for answers. There's a question like this one. Go to this link: How do you change the width and height of Twitter Bootstrap's tooltips? One of the answers there is very useful. It was answered by @knobli. I don't know how to link the answer but I hope you can go to that page and vote it up. Anyway, I'll just copy it right here. For CSS: .tooltip-inner { max-width: 100% !important; } For HTML: <a href="#" data-toggle="tooltip" data-placement="right" data-container="body" title="" data-original-title="Insert Title">Insert Title</a> Just add data-container="body" and you're ready to go.

Js Get Max Value From Array Code Example

Example 1: max value in array javascript // For large data, it's better to use reduce. Supose arr has a large data in this case: const arr = [ 1 , 5 , 3 , 5 , 2 ] ; const max = arr . reduce ( ( a , b ) = > { return Math . max ( a , b ) } ) ; // For arrays with relatively few elements you can use apply: const max = Math . max . apply ( null , arr ) ; // or spread operator: const max = Math . max ( . . . arr ) ; Example 2: get highest value from array javascript //For Values var arr = [ 1 , 10 , 3 ] var min = Math . min . apply ( null , arr ) , max = Math . max . apply ( null , arr ) ; //For Objects var arr = [ { a : 1 } , { a : 10 } , { a : 3 } ] var values = arr . map ( val = > val . a ) ; var max = Math . max . apply ( null , values ) ; console . log ( max ) Example 3: Find the maximum number of an array js var arr = [ 1 , 2 , 3 ] ; var max = arr . reduce ( function ( a , b ) { return Math . max ( a , b

Light Grey Colour Code Example

Example 1: light grey color code HTML / CSS Color Name Hex Code #RRGGBB Decimal Code ( R , G , B ) gainsboro #DCDCDC rgb ( 220 , 220 , 220 ) lightgray / lightgrey #D3D3D3 rgb ( 211 , 211 , 211 ) silver #C0C0C0 rgb ( 192 , 192 , 192 ) darkgray / darkgrey #A9A9A9 rgb ( 169 , 169 , 169 ) Example 2: css light grey #selector { color : lightgrey ; } Example 3: grey rgb values #808080 rgb ( 128 , 128 , 128 )

59 Inches In Cm Code Example

Example 1: cm to inches 1 cm = 0.393701 inch Divide the cm value by 2.54. Example 2: cm to inches const cm = 1; console.log(`cm:${cm} = in:${cmToIn(cm)}`); function cmToIn(cm){ var in = cm/2.54; return in; }

20cm In Inches Uk 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; }

Datetime.now( Code Example

Example 1: c# get time //Return the time from DateTime object in string format var timeString = DateTime . Now . ToString ( "hh:mm:ss" ) ; //Return time in 24h format var time24 = DateTime . Now . ToString ( "HH:mm:ss" ) ; //Use short time format to return string value var timeString = DateTime . Now . ToString ( "t" ) ; var shortTimeStr = DateTime . Now . ToShortTimeString ( ) ; //Use long time format var longTimeStr = DateTime . Now . ToLongTimeString ( ) ; var longtimestr = DateTime . Now . ToString ( "T" ) ; //Return a TimeSpan from midnight var timeSpan = DateTime . Now . TimeOfDay ; Example 2: python date and time from datetime import datetime now = datetime . now ( ) print ( now . strftime ( "%Y-%m-%d %H:%M:%S" ) ) Output : 2020 - 06 - 19 10 : 34 : 45 Example 3: datetime year python import datetime now = datetime . datetime . now ( ) print ( now . year , now . month , now . day , now . hour , now . min

Get Mouse Position Unity 3d Code Example

Example 1: unity get mouse position Vector3 worldPosition = Camera . main . ScreenToWorldPoint ( Input . mousePosition ) ; Example 2: how to find the mouse position unity Vector2 mousePosition = new Vector2 ( Input . mousePosition . x , Input . mousePosition . y ) ;

66 Edge Errors: HTTP403 FORBIDDEN

Image
Answer : This is because the LESS files are not available in the CDN. Maybe other browsers manage to hide this error ? Here is the result in chrome for instance : Be sure to only use the CSS and JS files from bootstrap or host the less versions yourself. :)

Apple - Can I Stream Any Video Played With VLC Player To Apple TV?

Image
Answer : It's not using VLC (although it uses some of its components and should be able to open anything VLC can open), but it looks like there's a way to do this. It requires on-the-fly transcoding for formats the AppleTV doesn't support (essentially anything not .mp4 or .m4v), which means it may take a fair bit of CPU power on your Mac, especially for HD stuff. It also means that aside from files the AppleTV natively supports, you're not getting bit-perfect renditions of the files, it's a lossy translation, but if you have a decently fast Mac, it should be pretty good. The main tool you'll want is AirFlick. It's a pretty basic program that sends a URL to the AppleTV that tells it to open a stream from your computer. It also handles transcoding the non-native files. It's not very well documented; it looks like the latest versions use a built-in copy of ffmpeg for transcoding, but some of the resources around the web suggest that it may need VLC ins

Random Gradient Generator Code Example

Example 1: css gradient generator /* 5 Best CSS Gradient Generator Links */ https : //cssgradient.io/ https : //www.colorzilla.com/gradient-editor/ https : //www.css-gradient.com/ https : //mycolor.space/gradient https : //uigradients.com/#Orca Example 2: css gradient generator /*CSS Gradient Generator*/ https : //cssgradient.io/ /*Example*/ .My-Class { background : linear-gradient ( to right , blue /*Color1*/ , dodgerblue /*Color1*/ ) ; } Example 3: ui gradient background : #000428 ; /* fallback for old browsers */ background : -webkit-linear-gradient ( to bottom , #000428 , #004e92 ) ; /* Chrome 10-25, Safari 5.1-6 */ background : linear-gradient ( to bottom , #000428 , #004e92 ) ; /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */ Example 4: color gradient generator /* "element" bieng the target class item to style */ .element { background : rgb ( 2 , 0 , 36 ) !important ; background : linear-gradient ( 331 deg , rgba

Android Shape With Gradient Border And Shadow

Image
Answer : Here you go Create your layout <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#c8c0c0" android:orientation="vertical"> <LinearLayout android:layout_width="120dp" android:layout_height="120dp" android:layout_centerInParent="true" android:background="@drawable/my_rectangle"> </LinearLayout> </RelativeLayout> Create my_rectangle.xml file inside drawable folder <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle"> <gradient

Bootstrap Installer Code Example

Example 1: install bootstrap npm install bootstrap //OR npm install bootstrap@latest Example 2: bootstrap setup <! DOCTYPE html > < html lang = " en " > < head > < meta charset = " utf-8 " > < meta http-equiv = " X-UA-Compatible " content = " IE=edge " > < meta name = " viewport " content = " width=device-width, initial-scale=1 " > <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> < title > Bootstrap 101 Template </ title > <!-- Bootstrap --> < link href = " css/bootstrap.min.css " rel = " stylesheet " > <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> &

Conditional Rendering React Hooks Code Example

Example 1: if else render react render() { const isLoggedIn = this.state.isLoggedIn; return ( < div > {isLoggedIn ? ( < LogoutButton onClick = {this.handleLogoutClick} /> ) : ( < LoginButton onClick = {this.handleLoginClick} /> )} </ div > ); } Example 2: ternary react render() { const isLoggedIn = this.state.isLoggedIn; return ( < div > The user is < b > {isLoggedIn ? 'currently' : 'not'} </ b > logged in. </ div > ); } Example 3: adding a if stement in jsx render() { return ( < View style = {styles.container} > {this.state.value == 'news'? < Text > data </ Text > : null } </ View > ) } Example 4: react native conditional rendering function Mailbox(props) { const unreadMessages = props.unreadMessages; return ( < div > < h1 > Hello! </ h1 >

Adding Data Attribute To DOM

Answer : Use the .data() method: $('div').data('info', '222'); Note that this doesn't create an actual data-info attribute. If you need to create the attribute, use .attr() : $('div').attr('data-info', '222'); jQuery's .data() does a couple things but it doesn't add the data to the DOM as an attribute. When using it to grab a data attribute, the first thing it does is create a jQuery data object and sets the object's value to the data attribute. After that, it's essentially decoupled from the data attribute. Example: <div data-foo="bar"></div> If you grabbed the value of the attribute using .data('foo') , it would return "bar" as you would expect. If you then change the attribute using .attr('data-foo', 'blah') and then later use .data('foo') to grab the value, it would return "bar" even though the DOM says data-foo="blah

Android MVP: What Is An Interactor?

Answer : MVP exists to tackle God Activity problem (An Activity/Fragment that has way too many lines). While it wasn't obligatory (you can code in any pattern that you want), many developers agree that MVP is suitable for Android. It makes your source code cleaner, testable, maintainable and robust. You can think of an interactor as your "Model/Controller". An interactor will fetch data from your database, web services, or any other data source. After getting the data, the interactor will send the data to the presenter. Thus, making changes in your UI. Advantages of using interactor in a separate class is that it will decouple your class, thus making it cleaner and testable. Sure, you can put the interactor in your presenter inner class, but what's the point? The disadvantages of putting the interactor in your presenter is it will make your presenter class bigger and relatively harder to read and manage. Update: Of course this is just an over-simplification