Posts

Showing posts from June, 2008

Make First Letter Capital In Css Code Example

Example: css all caps .uppercase { text-transform : uppercase ; } #example { text-transform : none ; /* No capitalization, the text renders as it is (default) */ text-transform : capitalize ; /* Transforms the first character of each word to uppercase */ text-transform : uppercase ; /* Transforms all characters to uppercase */ text-transform : lowercase ; /* Transforms all characters to lowercase */ text-transform : initial ; /* Sets this property to its default value */ text-transform : inherit ; /* Inherits this property from its parent element */ }

React Native Expo Vector Icons Code Example

Example: expo vector icons install npm install @expo/vector-icons

Css To Change Hr Color Code Example

Example 1: how to change the color of the hr tag in html < style > hr { height : 1 px ; background-color : #ccc ; border : none ; } </ style > Example 2: html horizontal line style <!-- HTML --> <!-- You can change the style of the horizontal line like this: --> < hr style = " width : 50 % " , size = " 3 " , color = black > <!-- Or like this: --> < hr style = " height : 2 px ; width : 50 % ; border-width : 0 ; color : red ; background-color : red " >

Fixed Left Menu In Page Css Code Example

Example: how to fix the nav bar to the left of the page .sidenav { height : 100 % ; width : 160 px ; position : fixed ; z-index : 1 ; top : 0 ; left : 0 ; overflow-x : hidden ; }

Angular 5 Download Excel File With Post Request

Answer : I struggle with this one all day. Replace angular HttpClient and use XMLHttpRequest as follows: var oReq = new XMLHttpRequest(); oReq.open("POST", url, true); oReq.setRequestHeader("content-type", "application/json"); oReq.responseType = "arraybuffer"; oReq.onload = function (oEvent) { var arrayBuffer = oReq.response; if (arrayBuffer) { var byteArray = new Uint8Array(arrayBuffer); console.log(byteArray, byteArray.length); this.downloadFile(byteArray, 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'export.xlsx'); } }; oReq.send(body); Then modified the creation of the Blob in your downloadFile function: const url = window.URL.createObjectURL(new Blob([binaryData])); In your case the service will look something like this: DownloadData(model:requiredParams):Observable<any>{ return new Observable(obs => { var oReq = new XMLHttpReques

Python Length Array Code Example

Example 1: size array python size = len ( myList ) Example 2: python get array length # To get the length of a Python array , use 'len()' a = arr . array ( ‘d’ , [ 1.1 , 2.1 , 3.1 ] ) len ( a ) # Output : 3 Example 3: find array length python array = [ 1 , 2 , 3 , 4 , 5 ] print ( len ( arr ) ) Example 4: python array length len ( my_array ) Example 5: find array length in python a = arr . array ( 'd' , [ 1.1 , 2.1 , 3.1 ] ) len ( a )

How To Place Cards Side By Side In Html Code Example

Example: css card grid /* https://codepen.io/travishorn/pen/bzXEjd */ <---------------------------------- HTML -------------------------------- > <div class="cards" > <div class="card" > ONE</div > <div class="card" > TWO</div > <div class="card" > THREE</div > <div class="card" > FOUR</div > <div class="card" > FIVE</div > <div class="card" > SIX</div > <div class="card" > SEVEN</div > <div class="card" > EIGHT</div > <div class="card" > NINE</div > <div class="card" > TEN</div > <div class="card" > ELEVEN</div > <div class="card" > TWELVE</div > </div > <---------------------------------- CSS ---------------------------------- > html { font-size : 22 px ; } bod

Html Scroll To W3 Code Example

Example: smooth scroll css html { scroll-behavior : smooth ; } /* No support in IE, or Safari You can use this JS polyfill for those */ http : //iamdustan.com/smoothscroll/

C Program To Print Individual Digits Of A Number Code Example

Example 1: print digits of a number in c # include <stdio.h> int main ( ) { int num = 1024 ; while ( num != 0 ) { int digit = num % 10 ; num = num / 10 ; printf ( "%d\n" , digit ) ; } return 0 ; } Example 2: print digits of a number in c # include <stdio.h> int printDigits ( int n ) { int digit ; if ( n < 10 ) { //caso base digit = n ; printf ( "%d\n" , digit ) ; } else { digit = printDigits ( n / 10 ) ; digit = printDigits ( n % 10 ) ; } return digit ; } int main ( ) { int num = 3467678 ; printDigits ( num ) ; return 0 ; }

Can't Push Refs To Remote Try Running Pull First To Integrate Your Changes

Answer : You get this try running pull first to integrate your changes whenever your local branch and your remote branch are not on the same point, before your changes. remote branch commits : A -> B -> C -> D local branch commits : A -> B -> C -> Local_Commits Now clearly, there's a change D that you don't have integrated locally. So you need to rebase , then push, which will lead to the following. remote branch commits : A -> B -> C -> D local branch commits : A -> B -> C -> D -> Local_Commits To solve your issue, do the following git pull --rebase origin branchname git push origin branchname I was getting this message in my Azure DevOps Repos environment because the server had a branch policy on the master branch that requires pull request approval and I was trying to push to master directly. Even after pull and rebase the same message appears. I don't think VS Code really knows how to interpret this specific err

Android: How Do You Check If A Particular AccessibilityService Is Enabled

Answer : I worked this one out myself in the end: public boolean isAccessibilityEnabled() { int accessibilityEnabled = 0; final String LIGHTFLOW_ACCESSIBILITY_SERVICE = "com.example.test/com.example.text.ccessibilityService"; boolean accessibilityFound = false; try { accessibilityEnabled = Settings.Secure.getInt(this.getContentResolver(),android.provider.Settings.Secure.ACCESSIBILITY_ENABLED); Log.d(LOGTAG, "ACCESSIBILITY: " + accessibilityEnabled); } catch (SettingNotFoundException e) { Log.d(LOGTAG, "Error finding setting, default accessibility to not found: " + e.getMessage()); } TextUtils.SimpleStringSplitter mStringColonSplitter = new TextUtils.SimpleStringSplitter(':'); if (accessibilityEnabled==1) { Log.d(LOGTAG, "***ACCESSIBILIY IS ENABLED***: "); String settingValue = Settings.Secure.getString(getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILIT

How To Make Text Bold In Css Code Example

Example 1: css bold text .text { font-weight : bold ; } Example 2: css text bold font-weight : bold ; Example 3: how bold text in css p .normal { font-weight : normal ; } p .thick { font-weight : bold ; } p .thicker { font-weight : 900 ; } Example 4: css bold text /* Keyword values */ font-weight : bold ; /* Keyword values relative to the parent */ font-weight : bolder ; /* Numeric keyword values */ font-weight : 700 ; // bold font-weight : 800 ; font-weight : 900 ; Example 5: how to bold text css inline <p style= "font-weight:bold" >Hey there</p> Example 6: css bold text we can set text bold using css property named 'font-weight' Syntax: selector { font-weight : bold ; }

Css Text Overflow Ellipsis Dynamic Width Code Example

Example 1: css ellipsis div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } Example 2: overflow ellipsis css .truncate { width: 250px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } Example 3: css paragraph ellipsis max-width: 100px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; Example 4: show ellipsis after text length max-width: 100px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; // div in a flex - assign width% , no need of even max-width !

Android Notification SetSound Is Not Working

Answer : below code will help you: String CHANNEL_ID="1234"; Uri soundUri = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://"+ getApplicationContext().getPackageName() + "/" + R.raw.mysound); NotificationManager mNotificationManager = (NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE); //For API 26+ you need to put some additional code like below: NotificationChannel mChannel; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { mChannel = new NotificationChannel(CHANNEL_ID, Utils.CHANNEL_NAME, NotificationManager.IMPORTANCE_HIGH); mChannel.setLightColor(Color.GRAY); mChannel.enableLights(true); mChannel.setDescription(Utils.CHANNEL_SIREN_DESCRIPTION); AudioAttributes audioAttributes = new AudioAttributes.Builder() .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATIO

Image Overlay Online Code Example

Example: overlapping picture with the background position : relative ; top : -168 px ;

37 Inch To Cm Code Example

Example: inch to cm 1 inch = 2.54 cm

Add Jquery To Html Code Example

Example 1: import js in html < script type = "text/javascript" src = "yourfile.js" > < / script > Example 2: jquery cdn google < script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js" > < / script > Example 3: html include jquery < ! -- Wrap inside the head tag -- > < script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js" > < / script > Example 4: how to use jquery < ! -- First either download , or use CDN and reference it -- > < ! -- Here we grab it from a CDN -- > < script src = "https://code.jquery.com/jquery-3.4.1.js" integrity = "sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin = "anonymous" > < / script > < ! -- Lets say we have some < p > , with simple text we give it an id -- > < p id = "example" > Hello , world

Advantages And Disadvantages Of Array In Data Structure Code Example

Example 1: advantages and disadvantages of array Advantage of Java Array Code Optimization: It makes code optimized, we can retrieve/sort the data easily. Random access: We can get any data located at any index position. Disadvantage of Java Array Size Limit: We can store only fixed size of elements in the array. It doesn't grow its size at runtime. To solve this problem, collection framework is used in java. Example 2: disadvantages of array Size Limit: We can store only fixed size of elements in the array. It doesn't grow its size at runtime. To solve this problem, collection framework is used in java.

Android: Test Push Notification Online (Google Cloud Messaging)

Answer : Found a very easy way to do this. Open http://phpfiddle.org/ Paste following php script in box. In php script set API_ACCESS_KEY, set device ids separated by coma. Press F9 or click Run. Have fun ;) <?php // API access key from Google API's Console define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' ); $registrationIds = array("YOUR DEVICE IDS WILL GO HERE" ); // prep the bundle $msg = array ( 'message' => 'here is a message. message', 'title' => 'This is a title. title', 'subtitle' => 'This is a subtitle. subtitle', 'tickerText' => 'Ticker text here...Ticker text here...Ticker text here', 'vibrate' => 1, 'sound' => 1 ); $fields = array ( 'registration_ids' => $registrationIds, 'data' => $msg ); $headers = array ( 'Autho

CSS Transition Shorthand With Multiple Properties?

Answer : Syntax: transition: <property> || <duration> || <timing-function> || <delay> [, ...]; Note that the duration must come before the delay, if the latter is specified. Individual transitions combined in shorthand declarations: -webkit-transition: height 0.3s ease-out, opacity 0.3s ease 0.5s; -moz-transition: height 0.3s ease-out, opacity 0.3s ease 0.5s; -o-transition: height 0.3s ease-out, opacity 0.3s ease 0.5s; transition: height 0.3s ease-out, opacity 0.3s ease 0.5s; Or just transition them all: -webkit-transition: all 0.3s ease-out; -moz-transition: all 0.3s ease-out; -o-transition: all 0.3s ease-out; transition: all 0.3s ease-out; Here is a straightforward example. Here is another one with the delay property. Edit: previously listed here were the compatibilities and known issues regarding transition . Removed for readability. Bottom-line: just use it. The nature of this property is non-breaking for all applications and compatibility is now well ab

Button Data Attribute Jquery Code Example

Example 1: jquery get data attribute value /* html */ < a data - id = "123" > link < / a > /* js */ $ ( this ) . attr ( "data-id" ) // returns string "123" $ ( this ) . data ( "id" ) // returns number 123 (jQuery >= 1.4.3 only) Example 2: javascript get data-id attribute //get data-id attribute in plain Javascript var element = document . getElementById ( 'myDivID' ) ; var dataID = element . getAttribute ( 'data-id' ) ; //get data-id using jQuery var dataID = $ ( 'myDivID' ) . data ( 'data-id' ) ; Example 3: jquery get data attribute < a data - id = "123" > link < / a > var id = $ ( this ) . data ( "id" ) ; // Will set id to 123 Example 4: jquery data attribute data attribute in jquery For setting attribute data to the element Html < p id = "assign" > Assigning data attribute < / p > jquery $ ( "#assi

Android Emulator Camera Custom Image

Image
Answer : Under Tools > AVD Manager , select the "pencil" to get to "Virtual Device Configuration". Show Advanced Settings > Camera will give you the option of using emulated, or a device: Device - use host computer webcam or built-in camera If all you need is to get a still image into the camera, starting with Android Studio 3.2 you can put your static images into the virtual scene: as discussed in this entry from Android developers blog. Note that you'll need to move the camera position into the dining room to see your images (turn around and use Alt-w to move forward). Finally! Append to file ~/Android/Sdk/emulator/resources/Toren1BD.posters poster custom size 2 2 position 0 0 -1.8 rotation 0 0 0 default custom.png Place 'custom.png' in ~/Android/Sdk/emulator/resources/ Restart! emulator @Phone -no-snapshot -no-boot-anim (replace 'Phone' with the name of your avd! (see: emulator -list-avds) Profit! Now you have a

304 Response Code Meaning Code Example

Example: 304 http status code 304 Not Modified The HTTP 304 Not Modified client redirection response code indicates that there is no need to retransmit the requested resources. It is an implicit redirection to a cached resource. This happens when the request method is safe, like a GET or a HEAD request, or when the request is conditional and uses a If-None-Match or a If-Modified-Since header. The equivalent 200 OK response would have included the headers Cache-Control, Content-Location, Date, ETag, Expires, and Vary.

90 Degrees To Radians Code Example

Example 1: degrees to radians radians = degrees * pi / 180 ; Example 2: degrees to radians double radians = Math . toRadians ( degrees ) ;