Posts

Showing posts from January, 2014

Adb Server Kill And Start Code Example

Example: adb server kill and start adb kill-server adb start-server

Bootstrap 3 Download Link Code Example

Example 1: bootstrap only cdn < link rel = "stylesheet" href = "https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" > Example 2: bootstrap latest version cdn < ! doctype html > < html lang = "en" > < head > < ! -- Required meta tags -- > < meta charset = "utf-8" > < meta name = "viewport" content = "width=device-width, initial-scale=1, shrink-to-fit=no" > < ! -- Bootstrap CSS -- > < link rel = "stylesheet" href = "https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity = "sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin = "anonymous" > < title > Hello, world ! < /title > < /head > < body > < h 1 > Hello, world ! < /h 1 > < ! -- Optional JavaScript -- &

Add An Item In A Seq In Scala

Answer : Two things. When you use :+ , the operation is left associative , meaning the element you're calling the method on should be on the left hand side. Now, Seq (as used in your example) refers to immutable.Seq . When you append or prepend an element, it returns a new sequence containing the extra element, it doesn't add it to the existing sequence. val newSeq = customerList :+ CustomerDetail("1", "Active", "Shougat") But appending an element means traversing the entire list in order to add an item, consider prepending: val newSeq = CustomerDetail("1", "Active", "Shougat") +: customerList A simplified example: scala> val original = Seq(1,2,3,4) original: Seq[Int] = List(1, 2, 3, 4) scala> val newSeq = 0 +: original newSeq: Seq[Int] = List(0, 1, 2, 3, 4) It might be worth pointing out that while the Seq append item operator, :+ , is left associative , the prepend operator, +: , is right as

Bootstrap 4 File Input

Answer : Updated 2021 Bootstrap 5 Custom file input no longer exists so to change Choose file... you'd need to use JS or some CSS like this. Bootstrap 4.4 Displaying the selected filename can also be done with plain JavaScript. Here's an example that assumes the standard custom-file-input with label that is the next sibling element to the input... document.querySelector('.custom-file-input').addEventListener('change',function(e){ var fileName = document.getElementById("myInput").files[0].name; var nextSibling = e.target.nextElementSibling nextSibling.innerText = fileName }) https://codeply.com/p/LtpNZllird Bootstrap 4.1+ Now in Bootstrap 4.1 the "Choose file..." placeholder text is set in the custom-file-label : <div class="custom-file" id="customFile" lang="es"> <input type="file" class="custom-file-input" id="exampleInputFile" aria-describedby=&q

Are Triangles The Strongest Shape?

Answer : Here's one part of it. As far as polygons go, a triangle is the only one that is defined by its side lengths. If you have a triangle of sides 5,6, and 7, there is only one shape it can take. The same cannot be said of other polygons. Imagine a square. It can be squished into a diamond with the same side lengths. There is SSS congruence for triangles, but no analogous congruence for other polygons. That's what diagonal bracing does in physical structures. Creates triangles. As you asked about the strength of a triangular shape then let me introduce to the triangular chain consisting of three rigid links or bars connected to each other by pin joints(allowing rotation between two joined links) . The degree of freedom (n) of a plane chain is given by the Grasshoff's law as n = 3 ( l − 1 ) − 2 j − h n=3(l-1)-2j-h n = 3 ( l − 1 ) − 2 j − h for a triangular chain we have l = no. of links = 3 l=\text{no. of links}=3 l = no. of links = 3 j = no. of bin

Index Pandas Dataframe By Row Number Code Example

Example: pandas df by row index indices = [ 133 , 22 , 19 , 203 , 14 , 1 ] df_by_indices = df . iloc [ indices , : ]

Array Findindex Javascript Example

Example 1: javascript findindex const array1 = [ 5 , 12 , 8 , 130 , 44 ] ; const search = element => element > 13 ; console . log ( array1 . findIndex ( search ) ) ; // expected output: 3 const array2 = [ { id : 1 , dev : false } , { id : 2 , dev : false } , { id : 3 , dev : true } ] ; const search = obj => obj . dev === true ; console . log ( array2 . findIndex ( search ) ) ; // expected output: 2 Example 2: findindex js // findIndex(callback fn) // .... return index (when condition meets) // .... return -1 (if condition not meets) const array = [ 5 , 12 , 8 , 130 , 44 ] ; /// it returns the index of number which satisfy the condition true const index = array . findIndex ( ( item ) => item > 10 ) ; //1 /// now we can check what element at that index... console . log ( array [ index ] ) ; // array[1] Example 3: .findIndex( array . findIndex ( call back function ) //index of ......

10 Inch To Cm Code Example

Example: inch to cm 1 inch = 2.54 cm

Centos Version Check Command Code Example

Example 1: check centos version $ cat / etc / redhat - release output : CentOS Linux release 7.4 . 1708 ( Core ) Example 2: how to know which centos version is installed < p > On the GUI ( Gnome ) upper right corner click on settings and then on details < / p > By command line cat / etc / centos - release This command works also changing the word centos by os ( os - release )

Add Default Value Of Datetime Field In SQL Server To A Timestamp

Image
Answer : For modifying an existing column in an existing table: ALTER TABLE YourTable ADD CONSTRAINT DF_YourTable DEFAULT GETDATE() FOR YourColumn This can also be done through the SSMS GUI. Put your table in design view (Right click on table in object explorer-> Design ) Add a column to the table (or click on the column you want to update if it already exists) In Column Properties, enter (getdate()) in Default Value or Binding field as pictured below In that table in SQL Server, specify the default value of that column to be CURRENT_TIMESTAMP . The datatype of that column may be datetime or datetime2 . e.g. Create Table Student ( Name varchar(50), DateOfAddmission datetime default CURRENT_TIMESTAMP );
Note This plugin is part of the ansible.netcommon collection (version 1.5.0). To install it use: ansible-galaxy collection install ansible.netcommon . To use it in a playbook, specify: ansible.netcommon.napalm . New in version 1.0.0: of ansible.netcommon DEPRECATED Synopsis Requirements Parameters Status DEPRECATED Removed in major release after 2022-06-01 Why I am pretty sure no one has ever tried to use these modules Alternative None. If anyone actually wants to use this plugin, open an issue and we’ll rescind the deprecation Synopsis This connection plugin provides connectivity to network devices using the NAPALM network device abstraction library. This library requires certain features to be enabled on network devices depending on the destination device operating system. The connection plugin requires napalm to be installed locally on the Ansible controller. Requirements The below requirements are needed on the local controller node that exe
Note This plugin is part of the google.cloud collection (version 1.0.2). To install it use: ansible-galaxy collection install google.cloud . To use it in a playbook, specify: google.cloud.gcp_iam_role . Synopsis Requirements Parameters Examples Return Values Synopsis A role in the Identity and Access Management API . Requirements The below requirements are needed on the host that executes this module. python >= 2.6 requests >= 2.18.4 google-auth >= 1.3.0 Parameters Parameter Choices/Defaults Comments auth_kind string / required Choices: application machineaccount serviceaccount The type of credential used. description string Human-readable description for the role. env_type string Specifies which Ansible environment you're running this module within. This should not be set unless you know what you're doing. This only alters the User Agent string for any API requests. included_permissio

Printf %g Code Example

Example: c printf /* printf example */ # include <stdio.h> int main ( ) { printf ( "Characters: %c %c \n" , 'a' , 65 ) ; printf ( "Decimals: %d %ld\n" , 1977 , 650000L ) ; printf ( "Preceding with blanks: %10d \n" , 1977 ) ; printf ( "Preceding with zeros: %010d \n" , 1977 ) ; printf ( "Some different radices: %d %x %o %#x %#o \n" , 100 , 100 , 100 , 100 , 100 ) ; printf ( "floats: %4.2f %+.0e %E \n" , 3.1416 , 3.1416 , 3.1416 ) ; printf ( "Width trick: %*d \n" , 5 , 10 ) ; printf ( "%s \n" , "A string" ) ; return 0 ; }

Add Key Value To Javascript Object Code Example

Example 1: js add key to object // given const obj = { key1 : value1 , key2 : value2 } ; // add pair obj [ "key3" ] = value3 ; obj . key4 = value4 ; Example 2: how to add field to object in js // original object { key1: "a", key2: "b"} var obj = { key1 : "a" , key2 : "b" } ; // adding new filed - you can use 2 ways obj . key3 = "c" ; // static // or obj [ "key3" ] = "c" ; // dynamic - 'key3' can be a variable console . log ( obj ) // {key1: "a", key2: "b", key3: "c" } Example 3: javascript add to object var element = { } , cart = [ ] ; element . id = id ; element . quantity = quantity ; cart . push ( element ) ; // Array of Objects in form {element: {id: 10, quantity: 10} } var element = { } , cart = [ ] ; element . id = id ; element . quantity = quantity ; cart . push ( { element : element

Android Toast Example

Example 1: java android show toast Toast myToast = Toast.makeText(this, "I'm a toast!", Toast.LENGTH_LONG); myToast.show(); Example 2: toast code in android studio Toast toast = Toast.makeText(this, "message", Toast.LENGTH_LONG;); toast.show(); Example 3: android java toast Toast.makeText(context this, text "Example of Text", Toast.LENGTH_LONG).show(); Example 4: Toast messag eandroid Toast.makeText(context, text, duration).show(); Example 5: toast.maketext Context context = getApplicationContext(); CharSequence text = "Hello toast!"; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show(); Example 6: android studio Toast usage Context context = getApplicationContext(); CharSequence text = "Hello toast!"; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show();

Bootstrap Background Image Responsive Css Code Example

Example: add background image in bootstrap 5 < div class = " has-bg-img bg-purple bg-blend-screen " > < h4 > Background blend mode: Multiply </ h4 > < img class = " bg-img " src = " ... " > </ div >

Break / Stop Execution In UML Sequence Diagram Mid-way Inside Alt / Opt

Image
Answer : There are three options for this situation. Each of them I illustrate with a diagram showing how the respective combined fragment should be used. The actual behaviour is hidden with interaction references (normalFlow for a flow that should normally be executed and breakFlow for any flow that should happen in case of a required break). The first solution is the most convenient one - it exactly covers your case and you can also use the positive version of a break guard. However each of them provide you a valid possibility. Break combined fragment When a break combined fragment is met and its guard condition is true, only this fragment is still executed and then the execution of the interaction (flow) stops. If the condition is not met, the combined fragment is omitted and the normal flow continues. This is exactly the case you describe. In this case you would put the messages that shouldn't be executed in case of a break condition after the break combined fragment

Uninstall Anaconda On Mac Code Example

Example: delete conda from machine conda install anaconda - clean # install the package anaconda clean anaconda - clean -- yes # clean all anaconda related files and directories rm - rf ~ / anaconda3 # removes the entire anaconda directory rm - rf ~ / . anaconda_backup # anaconda clean creates a back_up of files / dirs , remove it # ( conda list ; cmd shouldn ' t respond after the clean up )