Posts

Showing posts from May, 2019

Bootstrap Center Navbar Items

Answer : You will need to modify some CSS rules for Navbar component. So add a class center to nav.navbar and the following rules: .navbar.center .navbar-inner { text-align: center; } .navbar.center .navbar-inner .nav { display:inline-block; float: none; } Working demo (Bootstrap 3.3.7) To extend upon the selected answer, adding vertical align top will prevent the space from appearing under the nav items. .navbar.center .navbar-inner { text-align: center; } .navbar.center .navbar-inner .nav { display:inline-block; float: none; vertical-align: top; } Demo Use text-center or mx-auto or container-fluid or use flexbox technique, flex justify-center You could use this hack text-center (this does not only apply for text) Or use the exact boostrap class mx-auto example class="text-center" or class="mx-auto" in context <div class="btn-group text-center"> or <div class="btn-group mx-auto&

Calling Private Function Within The Same Class Python

Answer : There is no implicit this-> in Python like you have in C/C++ etc. You have to call it on self . class Foo: def __bar(self, arg): #do something def baz(self, arg): self.__bar(arg) These methods are not really private though. When you start a method name with two underscores Python does some name mangling to make it "private" and that's all it does, it does not enforce anything like other languages do. If you define __bar on Foo , it is still accesible from outside of the object through Foo._Foo__bar . E.g., one can do this: f = Foo() f._Foo__bar('a') This explains the "odd" identifier in the error message you got as well. You can find it here in the docs. __bar is "private" (in the sense that its name has been mangled), but it's still a method of Foo , so you have to reference it via self and pass self to it. Just calling it with a bare __bar() won't work; you have to call i

Cp-algorithms.com Articulation Points Code Example

Example: cp algorithm articulation points int n ; // number of nodes vector < vector < int >> adj ; // adjacency list of graph vector < bool > visited ; vector < int > tin , low ; int timer ; void dfs ( int v , int p = - 1 ) { visited [ v ] = true ; tin [ v ] = low [ v ] = timer ++ ; int children = 0 ; for ( int to : adj [ v ] ) { if ( to == p ) continue ; if ( visited [ to ] ) { low [ v ] = min ( low [ v ] , tin [ to ] ) ; } else { dfs ( to , v ) ; low [ v ] = min ( low [ v ] , low [ to ] ) ; if ( low [ to ] >= tin [ v ] && p != - 1 ) IS_CUTPOINT ( v ) ; ++ children ; } } if ( p == - 1 && children > 1 ) IS_CUTPOINT ( v ) ; } void find_cutpoints ( ) { timer = 0 ; visited . assign ( n , false ) ; tin . assig

Beacon Design Minecraft Code Example

Example: how many iron blocks for a full beacon You need 81 iron blocks for a full beacon

Ansible - Print Message - Debug: Msg="line1 \n {{ Var2 }} \n Line3 With Var3 = {{ Var3 }}"

Answer : debug module support array, so you can do like this: debug: msg: - "First line" - "Second line" The output: ok: [node1] => { "msg": [ "First line", "Second line" ] } Or you can use the method from this answer: In YAML, how do I break a string over multiple lines? The most convenient way I found to print multi-line text with debug is: - name: Print several lines of text vars: msg: | This is the first line. This is the second line with a variable like {{ inventory_hostname }}. And here could be more... debug: msg: "{{ msg.split('\n') }}" It splits the message up into an array and debug prints each line as a string. The output is: ok: [example.com] => { "msg": [ "This is the first line.", "This is the second line with a variable like example.com", "And

Tab Space In Latex Overleaf Code Example

Example: give space in latex Horizontal \hspace { 1 cm } spaces can be inserted manually . Useful to control the fine - tuning in the layout of pictures . Left Side \hfill Right Side

Append Multiple Pandas Data Frames At Once

Answer : I think you can use concat : print pd.concat([t1, t2, t3, t4, t5]) Maybe you can ignore_index : print pd.concat([t1, t2, t3, t4, t5], ignore_index=True) More info in docs. Have you simply tried using a list as argument of append? Or am I missing anything? import numpy as np import pandas as pd dates = np.asarray(pd.date_range('1/1/2000', periods=8)) df1 = pd.DataFrame(np.random.randn(8, 4), index=dates, columns=['A', 'B', 'C', 'D']) df2 = df1.copy() df3 = df1.copy() df = df1.append([df2, df3]) print df

Android Studio Emulator Does Not Come With Play Store For API 23

Image
Answer : I've had to do this recently on the API 23 emulator, and followed this guide. It works for API 23 emulator, so you shouldn't have a problem. Note: All credit goes to the author of the linked blog post (pyoor). I'm just posting it here in case the link breaks for any reason. .... Download the GAPPS Package Next we need to pull down the appropriate Google Apps package that matches our Android AVD version. In this case we’ll be using the 'gapps-lp-20141109-signed.zip' package. You can download that file from BasketBuild here. [pyoor@localhost]$ md5sum gapps-lp-20141109-signed.zip 367ce76d6b7772c92810720b8b0c931e gapps-lp-20141109-signed.zip In order to install Google Play, we’ll need to push the following 4 APKs to our AVD (located in ./system/priv-app/): GmsCore.apk, GoogleServicesFramework.apk, GoogleLoginService.apk, Phonesky.apk [pyoor@localhost]$ unzip -j gapps-lp-20141109-signed.zip \ system/priv-app/GoogleServicesFramework/GoogleSer

Android GetSharedPreferences Code Example

Example 1: android save int public void saveInt(int val, String key){ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mainActivity); SharedPreferences.Editor editor = prefs.edit(); editor.putInt(key, val); editor.apply(); } public int getInt(String key){ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mainActivity); int val = prefs.getInt(key, 0); return val; } Example 2: android sharedpreferences SharedPreferences sharedPref = getSharedPreferences("name", Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPref.edit(); editor.putString("key", "Value"); editor.commit(); Example 3: set preference value android boolean committed = PreferenceManager.getDefaultSharedPreferences(yourContext).edit().putBoolean(key, mValue).commit(); //you can also use putInt, putFloat, putLong, putString, putStringSet and change the value of mValue //committed is true if everything we

&amp Symbol In Html Code Example

Example: . and # in html <! DOCTYPE html > < html > < head > < style > .classname { background-color : green ; color : white ; } #idname { background-color : pink ; color : white ; } </ style > </ head > < body > < div class = " classname " > I am green colour < div > < div id = " idname " > I am pink colour </ div > </ body > </ html >

Advantages Of "Premier Color" On A Dell 4k Monitor

Answer : What Dell calls "Premier Color" and HP calls "Dreamcolor" is marketing-speak for 10-bits per channel color. They are also pre-calibrated with a selection of color profiles for professional work in (especially) video and television, also applicable to photography and graphic design, which you can find in their specs. You can use the full capabilities of a 10-bit monitor only if you have an OS that supports it and have a professional-grade GPU that will output 10-bit color. There is a good answer here with more details on that topic. Unless you are doing truly color-critical work, the extra color depth and color presets may not be worth the extra cost, but it's worth noting that they can display sRGB, Adobe RGB (almost!), and several television standards, which are not achievable with the usual 8-bit/channel displays. The details are, frankly, highly technical and tl;dr for most purposes. If you Google "10 bit displays" you'll find a

No Indent Latex Code Example

Example: no indentation latex \usepackage { parskip } % http : //ctan.org/pkg/parskip \setlength { \parindent } { 0 pt } \noindent

Bootstrap Overflow Horizontal Scroll Code Example

Example 1: make a container scrollable bootstrap .anyClass { height:150px; overflow-y: scroll; } Example 2: overflow hidden in bs4 < div class = " overflow-auto " > ... </ div > < div class = " overflow-hidden " > ... </ div >

Can PHP CURL Retrieve Response Headers AND Body In A Single Request?

Answer : One solution to this was posted in the PHP documentation comments: http://www.php.net/manual/en/function.curl-exec.php#80442 Code example: $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 1); // ... $response = curl_exec($ch); // Then, after your curl_exec call: $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); $header = substr($response, 0, $header_size); $body = substr($response, $header_size); Warning: As noted in the comments below, this may not be reliable when used with proxy servers or when handling certain types of redirects. @Geoffrey's answer may handle these more reliably. Many of the other solutions offered this thread are not doing this correctly. Splitting on \r\n\r\n is not reliable when CURLOPT_FOLLOWLOCATION is on or when the server responds with a 100 code. Not all servers are standards compliant and transmit just a \n for new lines. Detecting the size of the headers via CURLINFO_HEA

AltGr Randomly Stops Working On Windows 10

Answer : The issue happens when you open a RDP connection. Just bring the RDP window in foreground and press Alt + Enter . The issue will disappear on all other windows too Source: How to Fix Alt Gr Key Not Working. In my case left Shift + Caps Lock + AltGr helped. I have no idea what it does, but it works. Some utility programs can also "steal" the keyboard stroks. In my case it appeared that the VirtualDesktopManager resulted in non-functional AltGr, so I could not write [ and ] .

Autoplay Video Embed Code Example

Example: wistia embed autoplay video < script src = " https://fast.wistia.com/embed/medias/6as3hbcx4f.jsonp " async > </ script > < script src = " https://fast.wistia.com/assets/external/E-v1.js " async > </ script > < div class = " wistia_responsive_padding " style = " padding : 56.25 % 0 0 0 ; position : relative ; " > < div class = " wistia_responsive_wrapper " style = " height : 100 % ; left : 0 ; position : absolute ; top : 0 ; width : 100 % ; " > < div class = " wistia_embed wistia_async_6as3hbcx4f videoFoam=true " style = " height : 100 % ; position : relative ; width : 100 % " > < div class = " wistia_swatch " style = " height : 100 % ; left : 0 ; opacity : 0 ; overflow : hidden ; position : absolute ; top : 0 ; transition : opacity 2

Check Palindrom Python Code Example

Example: palindrome words python mes = input ( "Enter the word and see if it is palindrome " ) if mes == mes [ :: - 1 ] : print ( "This word is palindrome" ) else : print ( "This word is not palindrome" )

Are Rivers And Aquifers Guaranteed To Come Together In Dwarf Fortress?

Answer : No, they're not guaranteed to come together, at least not when considering a brook the same as a river. A brook is easier for beginners to start with, and has the same benefits as a river. I usually use the following settings in the f ind dialog to find a good place for starters: Evil: Medium Temperature: Medium Rain: Medium Flux Stone: Yes Aquifer: No River: Yes You might also want to read my reponse on the question for a good starting location for beginners. I know you can find brooks in areas that do not also have aquifers. In fact, brooks are easier to work with because they can be walked over, so I really recommend them over rivers for starting with. If you can't find a good starting area (there's a lot of places to look, don't give up too soon!) you might have generated a difficult world. You can always regenerate.

Center Title Ggplot2 Code Example

Example: centering ggplot2 titles # Add a theme argument: theme(plot.title = element_text(hjust = 0.5))