Posts

Showing posts from January, 2016

Android M Light And Dark Status Bar Programmatically - How To Make It Dark Again?

Answer : The solution posted by @Aracem is valid but, doesn't work if you try change also the background color of the status bar. In my case I do it in the following way. To enable windowLightStatusBar(programatically,inside a Utils class for example): public static void setLightStatusBar(View view,Activity activity){ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { int flags = view.getSystemUiVisibility(); flags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; view.setSystemUiVisibility(flags); activity.getWindow().setStatusBarColor(Color.WHITE); } } To restore to StatusBar to the previous state: public static void clearLightStatusBar(Activity activity) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { Window window = activity.getWindow(); window.setStatusBarColor(ContextCompat .getColor(activity,R.color.colorPrimaryDa

C# Unity What Does GetComponent Code Example

Example 1: how to get component in unity c# GetComponent < Rigidbody > ( ) ; //used to find component on character (rigid body can be changed) GameObject . FindGameObjectWithTag ( "player" ) ; //finds any game object in the scene with this tag Example 2: getcomponent c# //First script public class Enemy : MonoBehaviour { public int health = 10 ; public void saySomething ( ) { Debug . Log ( "Hi, i am an enemy." ) ; } } //Second script //There is one thing though, //if the script is located on another gameobject, //which will be most likely, you have to somehow //find that gameobject first. There are many ways of //doing it, via raycast, collision, //trigger, find by tag, find by gameobject etc. //But i will use the simplest way to understand, //that is declaring public GameObject in player script, //which contains Enemy, and later you just drag and drop the //gameobject in the inspector. public class Player : M

Abstract In Interface Java Code Example

Example 1: abstract classes and interfaces in java abstract class have no implementation of methods functions inside it. the classes which extending abstract class have to implement it Example 2: abstract class example in java //abstract parent class abstract class Animal{ //abstract method public abstract void sound(); } //Dog class extends Animal class public class Dog extends Animal{ public void sound(){ System.out.println("Woof"); } public static void main(String args[]){ Animal obj = new Dog(); obj.sound(); } }

Boto3 Dynamodb Update Item Code Example

Example: get item dynamodb boto3 def get_movie(title, year, dynamodb=None): if not dynamodb: dynamodb = boto3.resource('dynamodb', endpoint_url="http://localhost:8000") table = dynamodb.Table('Movies') try: response = table.get_item(Key={'year': year, 'title': title}) except ClientError as e: print(e.response['Error']['Message']) else: return response['Item']

Text Break Line Css Code Example

Example: text break css /* Schlüsselwortwerte */ word-break : normal ; word-break : break-all ; word-break : keep-all ; /* Globale Werte */ word-break : inherit ; word-break : initial ; word-break : unset ;

Add Id Autoincrement Column To Existing Table Mysql Code Example

Example 1: add auto_increment column to existing table mysql ALTER TABLE ` users ` ADD ` id ` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ALTER TABLE ` users ` ADD ` id ` INT NOT NULL AUTO_INCREMENT UNIQUE FIRST Example 2: mysql add auto increment id existing table ALTER TABLE ` users ` ADD ` id ` INT NOT NULL AUTO_INCREMENT PRIMARY KEY

Font Awesome Cdnjs.com Code Example

Example 1: fontawesome cdn <link href= "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css" rel= "stylesheet" > Example 2: font awesome cdn <link rel= "stylesheet" href= "https://pro.fontawesome.com/releases/v5.10.0/css/all.css" integrity= "sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p" crossorigin= "anonymous" /> Example 3: font-awsome cdn <link rel= "stylesheet" href= "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css" > Example 4: font awesome cdn <link href= "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css" rel= "stylesheet" > Example 5: font awesome cdn <link rel= "stylesheet" href= "path/to/font-awesome/css/font-awesome.min.css" >

Css Set Font Bold Code Example

Example 1: css bold text .text { font-weight: bold; } Example 2: css text bold font-weight: bold; Example 3: css bold text we can set text bold using css property named 'font-weight' Syntax: selector{ font-weight: bold; }

53 Inches I Cm Code Example

Example: inch to cm 1 inch = 2.54 cm

Javascript Array Remove Element By Value Code Example

Example 1: remove a particular element from array var colors = [ "red" , "blue" , "car" , "green" ] ; var carIndex = colors . indexOf ( "car" ) ; //get "car" index //remove car from the colors array colors . splice ( carIndex , 1 ) ; // colors = ["red","blue","green"] Example 2: js remove from array by value const index = array . indexOf ( item ) ; if ( index != = - 1 ) array . splice ( index , 1 ) ; Example 3: js remove item from array by value var arr = [ 'bill' , 'is' , 'not' , 'lame' ] ; arr . splice ( output_items . indexOf ( 'not' ) , 1 ) ; console . log ( arr ) //returns ['bill', 'is', 'lame'] Example 4: remove array elements javascript let forDeletion = [ 2 , 3 , 5 ] let arr = [ 1 , 2 , 3 , 4 , 5 , 3 ] arr = arr . filter ( item = > ! forDeletion . includes ( item ) ) // !!!

Convert Float To Int In Python Code Example

Example 1: convert float to int python # convert float to int x = 3.1415 y = int ( x ) print ( y ) #outputs 3 Example 2: decimal to int python print "%.4f" % 3.3333333333 3.3333 print "%.4f" % 6.6666666666 6.6667 Example 3: float to int in python # convert float to int int ( 2.0 ) #output :2 Example 4: how to convert int in python score = 89 score = str ( score )

Copyright Sign Html Code Example

Example 1: copyright symbol html &#169; &copy; Example 2: copyright symbol html <!-- Copyright (©) Symbol in HTML --> HTML ENTITY: &copy; HTML CODE: &#169; Example 3: copyright symbol html &#169; or &copy;

Html Bold And Italic Code Example

Example 1: html italic text <i>This text will be in italics</i> Example 2: html bold text <html> <head> <title>Bold text</title> </head> <body> <p>Use the strong element to <strong>indicate strongly emphasized</strong> content.</p> </body> </html> Example 3: how to make html text italic <!-- To make text italic in HTML --> <p> You have to use <em> To make you text italic instead of </em> <i> because this tag styles the text to be italic not changes real text</i> </p> Example 4: how to write a text in html <p> this is a text </p> <! --paragraph text--> Example 5: html text bold <b>This is bold text.</b> <strong>This is emphasized bold text.</strong>

CSS: Position:fixed Inside Of Position: Fixed

Answer : The fixing and the positioning are two separate things. They're positioned the same as absolutely positioned elements: relative to their containing block. But in contrast with absolutely positioned elements, they remain fixed to that position with respect to the viewport (i.e. they don't move when scrolling): http://www.w3.org/TR/CSS2/visuren.html#propdef-position The box's position is calculated according to the 'absolute' model, but in addition, the box is fixed with respect to some reference. Positioning The definition of containing block says: If the element has 'position: fixed', the containing block is established by the viewport in the case of continuous media (...) and If the element has 'position: absolute', the containing block is established by the nearest ancestor with a 'position' of 'absolute', 'relative' or 'fixed' (...) which suggests that while their positioning algorithm is the same (they&

Css :root Example

The :root CSS pseudo-class matches the root element of a tree representing the document. In HTML, :root represents the <html> element and is identical to the selector html , except that its specificity is higher. /* Selects the root element of the document: <html> in the case of HTML */ :root { background : yellow ; } Syntax :root Examples Declaring global CSS variables :root can be useful for declaring global CSS variables: :root { --main-color : hotpink ; --pane-padding : 5px 42px ; } Specifications Specification Status Comment Selectors Level 4 The definition of ':root' in that specification. Working Draft No change. Selectors Level 3 The definition of ':root' in that specification. Recommendation Initial definition. Browser compatibility Desktop Mobile Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet :root 1 12 1

Alternatives To JavaScript

Answer : The problem with javascript is not the language itself - it's a perfectly good prototyped and dynamic language. If you come from an OO background there's a bit of a learning curve, but it's not the language's fault. Most people assume that Javascript is like Java because it has similar syntax and a similar name, but actually it's a lot more like lisp. It's actually pretty well suited to DOM manipulation. The real problem is that it's compiled by the browser, and that means it works in a very different way depending on the client. Not only is the actual DOM different depending on the browser, but there's a massive difference in performance and layout. Edit following clarification in question Suppose multiple interpreted languages were supported - you still have the same problems. The various browsers would still be buggy and have different DOMs. In addition you would have to have an interpreter built into the browser or somehow i