Posts

Answer : Resolving the operation not permitted error: sudo chmod u+x my_script.sh You created the file via: sudo vi my_script.sh # editing This means, the owner and group of the file is root. You are not allowed to change files of it by default. You need to change permission (chmod does it) or change the owner: sudo chown you:yourgroup my_script.sh This should do it. Save the trouble, without creating the file via sudo. You've created file my_script.sh with the root user as the owner (because you used sudo ), which is why you're not permitted to change the permissions as yourself . Thus, use sudo chmod u+x my_script.sh , but note that that will make the file only executable for the root user. To make the file executable by everyone, use sudo chmod a+x my_script.sh .

Blob Code Download Much Slower Than MS Azure Storage Explorer

Answer : You should specify which version of MS Azure Storage explorer your're using. If you're using some newer versions of 1.9.0 / 1.8.1 / 1.8.0 etc.(please find more details in this link), then Azure Storage Explorer is integrated with azcopy which is using simple commands designed for optimal performance. So you can have a good-performance for downloading / uploading etc. When using code for downloading / uploading blobs, you can take use of this Microsoft Azure Storage Data Movement Library. This library is based on the core data movement framework that powers AzCopy, which also provides you high-performance uploading, downloading. I eventually tried 2 solutions proposed by @Ivan and @mjwills: DownloadToFileParallelAsync resulted in 10min 12secs Microsoft Azure Storage Data Movement Library resulted in 9min 35secs Both solutions much faster than the original DownloadToFileAsync. DownloadToFileParallelAsync is only available in later versions of the library...

Bootstrap 3 Colors Code Example

Example 1: bootstrap text color <p class= "text-primary" >.text-primary</p> <p class= "text-secondary" >.text-secondary</p> <p class= "text-success" >.text-success</p> <p class= "text-danger" >.text-danger</p> <p class= "text-warning" >.text-warning</p> <p class= "text-info" >.text-info</p> <p class= "text-light bg-dark" >.text-light</p> <p class= "text-dark" >.text-dark</p> <p class= "text-muted" >.text-muted</p> <p class= "text-white bg-dark" >.text- white </p> Example 2: bootstrap background color <div class= "p-3 mb-2 bg-primary text-white" >.bg-primary</div> <div class= "p-3 mb-2 bg-secondary text-white" >.bg-secondary</div> <div class= "p-3 mb-2 bg-success text-white" >.bg-success</div> <di...

Accessing JPEG EXIF Rotation Data In JavaScript On The Client Side

Image
Answer : If you only want the orientation tag and nothing else and don't like to include another huge javascript library I wrote a little code that extracts the orientation tag as fast as possible (It uses DataView and readAsArrayBuffer which are available in IE10+, but you can write your own data reader for older browsers): function getOrientation(file, callback) { var reader = new FileReader(); reader.onload = function(e) { var view = new DataView(e.target.result); if (view.getUint16(0, false) != 0xFFD8) { return callback(-2); } var length = view.byteLength, offset = 2; while (offset < length) { if (view.getUint16(offset+2, false) <= 8) return callback(-1); var marker = view.getUint16(offset, false); offset += 2; if (marker == 0xFFE1) { if (view.getUint32(offset += 2, false) != 0x45786966) { ...

Cannot Resolve Class Android.support.design.widget.CoordinatorLayout Code Example

Example: Cannot resolve class android.support.design.widget.CoordinatorLayout Replace <android.support.design.widget.coordinatorlayout with <androidx.coordinatorlayout.widget.CoordinatorLayout

Accessing External Storage In Android API 29

Answer : On Android 10 Environment.getExternalStorageDirectory() and Environment.getExternalStoragePublicDirectory() will return storage paths but paths are not readable or writable. For Android 10 you can continue to use paths provided by Environment.getExternalStorageDirectory() and Environment.getExternalStoragePublicDirectory() if you add android:requestLegacyExternalStorage="true" to application tag in manifest file. At runtime your app can call Environment.isExternalStorageLegacy() to check if the request has been done. Another (not known) possibility (only for Android 10) is to add <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> to manifest file. The user has to go to the advanced settings of the app and enable from Advanced settings Install unknown apps | Allow from this source . The nice thing with this is that the user can switch the access rights. You can make it easier for the user if you implement an int...

Bootstrap Rounded Button Code Example

Example 1: round button css .btn { display:block; height: 300px; width: 300px; border-radius: 50%; border: 1px solid red; } Example 2: bootstrap soft corner < div class = " container border rounded " > </ div > Example 3: button radius bootstrap 4 < span class = " border " > </ span > < span class = " border-top " > </ span > < span class = " border-right " > </ span > < span class = " border-bottom " > </ span > < span class = " border-left " > </ span >

Badges Bootstrap 3 Code Example

Example 1: bootstrap 4 badge <span class= "badge badge-primary" >Primary</span> <span class= "badge badge-secondary" >Secondary</span> <span class= "badge badge-success" >Success</span> <span class= "badge badge-danger" >Danger</span> <span class= "badge badge-warning" >Warning</span> <span class= "badge badge-info" >Info</span> <span class= "badge badge-light" >Light</span> <span class= "badge badge-dark" >Dark</span> Example 2: bootstrap Badges Badges scale to match the size of the immediate parent element by using relative font sizing and em units. <h1>Example heading <span class= "badge badge-secondary" >New</span></h1> <h2>Example heading <span class= "badge badge-secondary" >New</span></h2> <h3>Example heading <span class= ...

Print Array Elements Without Loop C++ Code Example

Example: print the elements of the array without using the [] notation in c++ # include <iostream> using namespace std ; int main ( ) { int arr [ ] = { 2 , 4 , 8 } ; int size = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; for ( int i = 0 ; i < size ; i ++ ) { cout << * ( arr + i ) << " " ; // prints.. 2 4 8. } }

After Before Css Sample Code Example

Example 1: css before after The ::before and ::after pseudo-elements in CSS allows you to insert content onto a page without it needing to be in the HTML. While the end result is not actually in the DOM, it appears on the page as if it is, and would essentially be like this: div::before { content: "before"; } div::after { content: "after"; } < div > before <!-- Rest of stuff inside the div --> after </ div > The only reasons to use one over the other are: You want the generated content to come before the element content, positionally. The ::after content is also “after” in source-order, so it will position on top of ::before if stacked on top of each other naturally. Example 2: how use befor after for image /* for child */ .custom_img:after { content: ""; background-color: #2359cf; height: 400px; width: 70%; top: -15px; right: -6px; position: absolute; z-index: 999; }

Can An Interface Extend Multiple Interfaces In Java?

Answer : Yes, you can do it. An interface can extend multiple interfaces, as shown here: interface Maininterface extends inter1, inter2, inter3 { // methods } A single class can also implement multiple interfaces. What if two interfaces have a method defining the same name and signature? There is a tricky point: interface A { void test(); } interface B { void test(); } class C implements A, B { @Override public void test() { } } Then single implementation works for both :). Read my complete post here: http://codeinventions.blogspot.com/2014/07/can-interface-extend-multiple.html An interface can extend multiple interfaces . A class can implement multiple interfaces . However, a class can only extend a single class . Careful how you use the words extends and implements when talking about interface and class . Can an interface extend multiple interfaces in java? Answer is: Yes. According to JLS An interface ma...

Column Contains A String Pyspark Dataframe Code Example

Example 1: pyspark filter column contains df.filter("location like '%google.com%'") Example 2: pyspark filter column contains df.filter(df.location.contains('google.com'))

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...

Colour Picker Chrome Extension Code Example

Example: chrome color picker To open the Eye Dropper simply: 1. Open DevTools F12. 2. Go to Elements tab. 3. Under Styles side bar click on any color preview box.

Browser Reset Css Code Code Example

Example 1: css browser reset stylesheet /* http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 License: none (public domain) */ html , body , div , span , applet , object , iframe , h1 , h2 , h3 , h4 , h5 , h6 , p , blockquote , pre , a , abbr , acronym , address , big , cite , code , del , dfn , em , img , ins , kbd , q , s , samp , small , strike , strong , sub , sup , tt , var , b , u , i , center , dl , dt , dd , ol , ul , li , fieldset , form , label , legend , table , caption , tbody , tfoot , thead , tr , th , td , article , aside , canvas , details , embed , figure , figcaption , footer , header , hgroup , menu , nav , output , ruby , section , summary , time , mark , audio , video { margin : 0 ; padding : 0 ; border : 0 ; font-size : 100 % ; font : inherit ; vertical-align : baseline ; } /* HTML5 display-role reset for older browsers */ article , as...

Base64 Decode Encode Php Code Example

Example: base64 decode in php base64_decode ( 'base64' ) ;