Posts

Showing posts from April, 2018

390 F To C Code Example

Example: 14 f to c 14°F = -10°C

'sleep' Was Not Declared In This Scope C++ Code Example

Example 1: error: ‘sleep’ was not declared in this scope Solution : # include <unistd.h> Include unistd . h header file will solve the error . Explanation : "sleep" function in c ++ context , include in header file "unistd.h" . otherwise we can see compilation error like below . prashad@ubuntu : ~ / test$ g ++ open_videofile . cpp `pkg - config -- cflags -- libs opencv` - g open_videofile . cpp : In function ‘ int main ( int , char * * ) ’ : open_videofile . cpp : 34 : 2 : error : ‘sleep’ was not declared in this scope sleep ( 5 ) ; ^ ~ ~ ~ ~ Example 2: sleep not declared in this scope c++ " 's' should be in the form of uppercase in Sleep"

C++ Cannot Get Value Of Double Pointr Code Example

Example: double pointers C++ # include <stdio.h> int main ( void ) { int value = 100 ; int * value_ptr = & value ; int * * value_double_ptr = & value_ptr ; printf ( "Value: %d\n" , value ) ; printf ( "Pointer to value: %d\n" , * value_ptr ) ; printf ( "Double pointer to value: %d\n" , * * value_double_ptr ) ; }

Connect To Mongodb With Username And Password Mongoose Code Example

Example: mongoose.connect mongoose.connect('mongodb://localhost:27017/myapp', {useNewUrlParser: true});

Bootstrap Text Align Center Horizontal And Vertical Code Example

Example: bootstrap center text vertically < div class = ”row” > < div class = ”col-6 align-self-center” > < div class = ”card card-block” > Center </ div > </ div > </ div >

Brew Update Not Working After Mac 10.9

Answer : This fixed it for me cd `brew --prefix`/Homebrew git fetch origin git reset --hard origin/master brew update worked fine after that Solution You might still find.. brew update not working after git pull origin master Here what you need to do. cd /usr/local git pull origin master brew install git Now you might already have git on your System, but what this will do it that now. Your broken brew update will automatically be updated before at first run.. Here is the link to the origin issue in HomeBrew. brew stuck I simply removed the .git directory inside of the /usr/local directory, then ran the command brew update .

Text Gradient Css Generator Code Example

Example 1: css gradient text h1 { font-size : 72 px ; background : -webkit-linear-gradient ( #eee , #333 ) ; -webkit-background-clip : text ; -webkit-text-fill-color : transparent ; } Example 2: gradient font color css h1 { font-size : 72 px ; background : -webkit-linear-gradient ( #eee , #333 ) ; -webkit-background-clip : text ; -webkit-text-fill-color : transparent ; } Example 3: 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

Css Title Attribute Style Examples

Example 1: css attribute selector a [ target = "_blank" ] { background-color : yellow ; } /*w3schools*/ Example 2: how to stilize title property css /* use for any tag on your page */ [ data-title ] :hover :after { opacity : 1 ; transition : all 0.1 s ease 0.5 s ; visibility : visible ; } /* box for title text */ [ data-title ] :after { content : attr ( data-title ) ; /* position for title view box */ position : absolute ; bottom : -1.6 em ; left : 100 % ; z-index : 99999 ; visibility : hidden ; /* optional */ white-space : nowrap ; /* stilization */ background-color : #00FF00 ; color : #111 ; font-size : 150 % ; padding : 1 px 5 px 2 px 5 px ; box-shadow : 1 px 1 px 3 px #222222 ; opacity : 0 ; border : 1 px solid #111111 ; } [ data-title ] { position : relative ; } /* on html page in your tags */ /* <a href="example.com" data-title="M

CSS Image Overlay With Color And Transparency

Answer : CSS Filter Effects It's not fully cross-browsers solution, but must work well in most modern browser. <img src="image.jpg" /> <style> img:hover { /* Ch 23+, Saf 6.0+, BB 10.0+ */ -webkit-filter: hue-rotate(240deg) saturate(3.3) grayscale(50%); /* FF 35+ */ filter: hue-rotate(240deg) saturate(3.3) grayscale(50%); } </style> EXTERNAL DEMO PLAYGROUND CSS Filter Effects IN-HOUSE DEMO SNIPPET (source:simpl.info) #container { text-align: center; } .blur { filter: blur(5px) } .grayscale { filter: grayscale(1) } .saturate { filter: saturate(5) } .sepia { filter: sepia(1) } .multi { filter: blur(4px) invert(1) opacity(0.5) } <div id="container"> <h1><a href="https://simpl.info/cssfilters/" title="simpl.info home page">simpl.info</a> CSS filters</h1> <img src="https://simpl.info/cssfilters/balham.jpg" alt="No filter: B

C++: Printing ASCII Heart And Diamonds With Platform Independent

Answer : If you want a portable way, then you should use the Unicode code points (which have defined glyphs associated to them): ♠ U+2660 Black Spade Suit ♡ U+2661 White Heart Suit ♢ U+2662 White Diamond Suit ♣ U+2663 Black Club Suit ♤ U+2664 White Spade Suit ♥ U+2665 Black Heart Suit ♦ U+2666 Black Diamond Suit ♧ U+2667 White Club Suit Remember that everything below character 32 in ASCII is a control character . They have a meaning associated with them and you don't have a guarantee of getting a glyph or a behavior there (even though most control characters to have glyphs, although they were never intended to be printable). Still, it's not a safe bet. However, using Unicode needs proper font and encoding support which may or may not be a problem on UNIX-likes. On Windows at least some of the above code points map to the ASCII control character glyphs you're outputting if the console is set to raster fonts (and therefore not supporting Unicode or anything else th

15.04 And Nvidia: Login Loop

Answer : it's you from the future. Here's how I fixed it: I didn't! I re-downloaded the 15.04 image from the Ubuntu website and created a startup "disk" on a USB thumb drive. Today it worked, wehereas it didn't last night :( Perhaps Canonical fixed their image... So I booted from the thumb drive and removed my existing 15.04 and installed a fresh copy! Sure I lost all of my files (VirtualBox, all installed games, etc.) but now Linux works again. Let this be a lesson to you Dustin! Never try and upgrade an Ubuntu OS! Just backup all of your files and do a clean install... just like you used to have to do with Windows! I had the exact same problem. I'm not sure exactly why it happened, but it seems my kernel was not updated. To solve that I used Ctrl + Alt + F1 to go to a text-based virtual console, logged on there, then ran: sudo apt-get install linux-generic Everything started working again. My fix for my laptop Dell xps l502x, so it

CSS Zoom Image Magnifier Code Example

Example 1: zoom image css /*Zoom on hover*/ <style > .zoom { padding : 50 px ; background-color : green ; transition : transform .2 s ; /* Animation */ width : 200 px ; height : 200 px ; margin : 0 auto ; } .zoom :hover { transform : scale ( 1.5 ) ; /* (150% zoom)*/ } </style> <div class= "zoom" ></div> /*credits: w3schools.com */ Example 2: how to use image zoom effect in css .parent :hover .child , .parent :focus .child { transform : scale ( 1.2 ) ; } Example 3: how to use image zoom effect in css .parent { width : 400 px ; height : 300 px ; } .child { width : 100 % ; height : 100 % ; background-color : black ; /* fallback color */ background-image : url ( "images/city.jpg" ) ; background-position : center ; background-size : cover ; }

Add Multiple Class To Html Element Code Example

Example 1: css assign multiple classes to one element To specify multiple classes , separate the class names with a space , e . g . < span class = "classA classB" > . This allows you to combine several CSS classes for one HTML element . Example 2: multiple classes in element html < article class = "column wrapper" >

Bootstrap Range Slider 2 Points Code Example

Example 1: price range slider bootstrap 4 < input type = " range " name = " range " step = " 50000 " min = " 100000 " max = " 1000000 " value = " " onchange = " rangePrimary.value=value " > < input type = " text " id = " rangePrimary " /> Example 2: bootstrap range slider < label for = " customRange3 " class = " form-label " > Example range </ label > < input type = " range " class = " form-range " min = " 0 " max = " 5 " step = " 0.5 " id = " customRange3 " >

Convert String To Enum In Python

Answer : This functionality is already built in to Enum [1]: >>> from enum import Enum >>> class Build(Enum): ... debug = 200 ... build = 400 ... >>> Build['debug'] <Build.debug: 200> [1] Official docs: Enum programmatic access Another alternative (especially useful if your strings don't map 1-1 to your enum cases) is to add a staticmethod to your Enum , e.g.: class QuestionType(enum.Enum): MULTI_SELECT = "multi" SINGLE_SELECT = "single" @staticmethod def from_str(label): if label in ('single', 'singleSelect'): return QuestionType.SINGLE_SELECT elif label in ('multi', 'multiSelect'): return QuestionType.MULTI_SELECT else: raise NotImplementedError Then you can do question_type = QuestionType.from_str('singleSelect') def custom_enum(typename, items_dict): class_definition = """ from

Advantages Of Using Bundle Instead Of Direct Intent PutExtra() In Android

Answer : It makes little (if any difference). The code using an additional bundle is slightly heavier (it won't make any difference in any practical application) and slightly easier to manage, being more general. If one day you decide that - before sending information inside an intent - you want to serialize the data to database - it will be a bit cleaner to have a bundle that you can serialize, add to an intent and then feed to a PendingBundle - all with one object. [update] A clarification (because of some other answers). Extras is an additional bundle that each Intent might carry (but doesn't have to), so there is no alternative between using a bundle or not using it. You are using a bundle either way. The first time you use putExtra , a mExtras bundle inside Intent is initialized and all the following putExtra are delegated to it. The bundle itself is inaccessible to you (this is by design, to avoid certain kind of bugs). putExtras does not put your bundle

Android VectorDrawables.useSupportLibrary = True Is Stopping App

Answer : You cannot use Vector Drawables in any other views except ImageView in pre-lollipop. Please see this SO Answer by google developer advocate. For AppCompat users, we’ve decided to remove the functionality which let you use vector drawables from resources on pre-Lollipop devices due to issues found in the implementation in version 23.2.0/23.2.1 [ https://code.google.com/p/android/issues/detail?id=205236, https://code.google.com/p/android/issues/detail?id=204708 ]. Using app:srcCompat and setImageResource() continues to work. If you want to use the Vector Drawables pre-lollipop, use can set it programatically by converting it into a drawable. Drawable drawable; if (android.os.Build.VERSION.SDK_INT > Build.VERSION_CODES.M) { drawable = context.getResources().getDrawable(drawableResId, context.getTheme()); } else { drawable = VectorDrawableCompat.create(context.getResources(), drawableResId, context.getTheme()); } button.setCompoundDrawablesWithIn

Android SDK Location Should Not Contain Whitespace, As This Cause Problems With NDK Tools

Answer : As the warning message states, the SDK location should not contain whitespace. Your SDK is at C:\Users\Giacomo B\AppData\Local\Android\sdk . There is a whitespace character in Giacomo B . The easiest solution is to move the SDK somewhere else, where there is no space or other whitespace character in the path, such as C:\Android\sdk . You can point both Android Studio installations to the new location. There is another way: Open up CMD ( as Administrator ) Type: mklink /J C:\Program-Files "C:\Program Files" ( Or in my case mklink /J C:\Program-Files-(x86) "C:\Program Files (x86)" ) Hit enter Magic happens! ( Check your C drive ) Now you can point to C:\Program-Files ( C:\Program-Files-(x86) ). just change the path: "c:\program files\android\sdk" to "c:\progra~1\android\sdk" or "c:\program files (x86)\android\sdk" to "c:\progra~2\android\sdk" note that the paths should not contain spaces.

CSS Position:fixed Inside A Positioned Element

Answer : You can use the position:fixed; , but without set left and top . Then you will push it to the right using margin-left , to position it in the right position you wish. Check a demo here: http://jsbin.com/icili5 The current selected solution appears to have misunderstood the problem. The trick is to neither use absolute nor fixed positioning. Instead, have the close button outside of the div with its position set to relative and a left float so that it is immediately right of the div. Next, set a negative left margin and a positive z index so that it appears above the div. Here's an example: #close { position: relative; float: left; margin-top: 50vh; margin-left: -100px; z-index: 2; } #dialog { height: 100vh; width: 100vw; position: relative; overflow: scroll; float: left; } <body> <div id="dialog"> **** </div> <div id="clo

How To Add Multiple Classes In Html Code Example

Example 1: html add two classes <a href= "#" class= "class1 class2" >My Text</a> Example 2: how to write 2 class in html <div class= "nav nav-centered nav-reversed navbar navigation-block" ></div> Example 3: css assign multiple classes to one element To specify multiple classes , separate the class names with a space , e.g. <span class= "classA classB" >. This allows you to combine several CSS classes for one HTML element. Example 4: multiple classes in element html <article class= "column wrapper" >

Convert Input To Int Python Code Example

Example 1: python convert character to integer >> > chr ( 97 ) 'a' >> > ord ( 'a' ) 97 >> > int ( '1' ) 1 Example 2: python input integer # To prompt the user to input an integer we do the following: valid = False while not valid : #loop until the user enters a valid int try : x = int ( input ( 'Enter an integer: ' ) ) valid = True #if this point is reached, x is a valid int except ValueError : print ( 'Please only input digits' ) Example 3: how to get int input in python num = int ( input ( "inter your number: " ) ) print ( num ) Example 4: user input of int type in python #python program #taking int input from user #printing them #num1 from user num1 = int ( input ( "Enter a number of type int" ) ) print ( num1 ) Example 5: how to make string to int in python string = "324501763" integer = int ( string )

Dynamic Memory Allocation Base And Liit Code Example

Example: dynamic memory allocation int * p = new int ; // request memory * p = 5 ; // store value cout << * p << endl ; // Output is 5 delete p ; // free up the memory cout << * p << endl ; // Output is 0

Html Multiple Divs Side By Side Code Example

Example 1: how to align two divs side by side .wrapper { display : flex ; flex-wrap : wrap ; } .wrapper > div { flex : 1 1 150 px ; height : 500 px ; } Example 2: place div side by side <div style= "width: 100%; display: table;" > <div style= "display: table-row" > <div style= "width: 600px; display: table-cell;" > Left </div> <div style= "display: table-cell;" > Right </div> </div> </div> Example 3: css position side by side /************ How to position elements side by side? ***************/ /* We can use the property "display: inline" to place blocks of elements side by side, however, this does not allow an aesthetic alignment of all elements and we can't position a stack or group of two or more blocks beside another block. For example, placing a header and a paragraph on the left side of an image. For that, we use the "flo