Posts

Showing posts from March, 2012

Anaconda Selenium And Chrome

Answer : The easiest would be to install chrome-driver via anaconda (especially when running on a machine where you don't have permissions to install chrome-driver from .deb package) conda install -c conda-forge python-chromedriver-binary (updated based on comment from bgoodr (https://stackoverflow.com/users/257924/bgoodr) - please vote his comment below ). The simplest solution is to install chromedriver as suggested by @bgodr: conda install -c conda-forge python-chromedriver-binary Then at the top of your code, add the following import statement to update your PATH variable appropriately: import chromedriver_binary Download latest chromedriver Update Chrome itself In your code from selenium import webdriver driver_path = '/path to chromedriver.exe/' driver = webdriver.Chrome(driver_path) driver.get('somewebsite')

Collections Counter In Python Code Example

Example 1: collections.counter in python >>> from collections import Counter >>> >>> myList = [1,1,2,3,4,5,3,2,3,4,2,1,2,3] >>> print Counter(myList) Counter({2: 4, 3: 4, 1: 3, 4: 2, 5: 1}) >>> >>> print Counter(myList).items() [(1, 3), (2, 4), (3, 4), (4, 2), (5, 1)] >>> >>> print Counter(myList).keys() [1, 2, 3, 4, 5] >>> >>> print Counter(myList).values() [3, 4, 4, 2, 1] Example 2: collections counter # importing the collections module import collections # intializing the arr arr = [1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3] # getting the elements frequencies using Counter class elements_count = collections.Counter(arr) # printing the element and the frequency for key, value in elements_count.items(): print(f"{key}: {value}") Example 3: counter most_common most_common([n])¶ Return a list of the n most common elements and their counts from the most common to the least. If n is o

At The End Of Dreamfall, What Is The Fate Of April Ryan And Zoe Castillo?

Answer : Unfortunatly there is some speculation as to whether there will be a sequel. The head writer Ragnar Tørnquist seems to be very involved in getting Funcom's latest offering The Secret World MMO developed and launched. He has however indicated that an episodic format of Dreamfall Chapters is floating around at Funcom. I enclose an excerpt of what he said as his blog seems to be down to link to: Nothing major is currently happening on Dreamfall Chapters. The people who will be involved when it does happen – myself included – are tied up in other projects, primarily The Secret World. TSW will continue to be my (and their) primary focus for a while longer…but that doesn’t mean nothing at all is happening with Chapters. It just means that it’s not (at least not officially) in production – for now. Yes, there's at least one hint to the fate of April in The Longest Journey. While it's never explicitly stated, but Lady Alvane, (the mysterious old woman who t

How To Print Binary Value Of An Integer In C Code Example

Example: print binary in c # include <iostream> using namespace std ; int main ( ) { long n , d , r , binary = 0 ; n = 10 ; d = n ; int temp = 1 ; while ( n != 0 ) { r = n % 2 ; n = n / 2 ; binary = binary + r * temp ; temp = temp * 10 ; } printf ( "%ld" , binary ) ; return 0 ; }

Cannot Find Declaration To Go To In PHP Storm On Ubuntu

Image
Answer : My problem was that my whole vendor folder had somehow gotten ignored. To check and fix, navigate to "File > Settings > Project Settings > Directories" and make sure that "vendor" is not excluded . Sources: http://fuelphp.com/forums/discussion/3943/how-to-setup-code-completion-in-phpstorm Please try to enable Laravel plugin: Settings (Preferences) | Other Settings | Laravel Plugin | Enable Plugin for this Project Or here: Languages & Frameworks | Php | Laravel| Enable Plugin for this Project As said on https://confluence.jetbrains.com/display/PhpStorm/Laravel+Development+using+PhpStorm

How To Get Length Of Array In Java Code Example

Example 1: .length array java /** * An Example to get the Array Length is Java */ public class ArrayLengthJava { public static void main ( String [ ] args ) { String [ ] myArray = { "I" , "Love" , "Music" } ; int arrayLength = myArray . length ; //array length attribute System . out . println ( "The length of the array is: " + arrayLength ) ; } } Example 2: find length of array java Int [ ] array = { 1 , 2 , 3 } ; int lengthOfArray = array . length ; /** Finding the length of the array and storing it */ System . out . println ( String . valueOf ( lengthOfArray ) ) ; /** Should print out 3, String.value Of() is optional as printLn does this automatically. */ Example 3: how to find length of array in java let coolCars = [ 'ford' , 'chevy' ] ; //to find length, use the array's built in method let length = coolCars . length ; //length == 2. Example 4: length of array in java arr . leng

AngularJS Loading Progress Bar

Answer : For a progress bar as YouTube has, you can take a look at ngprogress. Then just after the configuration of your app (for example), you can intercept route's events. And do something like: app.run(function($rootScope, ngProgress) { $rootScope.$on('$routeChangeStart', function() { ngProgress.start(); }); $rootScope.$on('$routeChangeSuccess', function() { ngProgress.complete(); }); // Do the same with $routeChangeError }); Since @Luc's anwser ngProgress changed a bit, and now you can only inject ngProgressFactory , that has to be used to create ngProgress instance. Also contrary to @Ketan Patil's answer you should only instantiate ngProgress once : angular.module('appRoutes', ['ngProgress']).run(function ($rootScope, ngProgressFactory) { // first create instance when app starts $rootScope.progressbar = ngProgressFactory.createInstance(); $rootScope.$on("$routeChangeStart", function (

C Programming Rand Function Code Example

Example: random number generator c rand ( ) % ( maxlimit + 1 - minlimit ) + minlimit ;

Are Python Sets Mutable?

Answer : >>>> x = set([1, 2, 3]) >>>> y = x >>>> >>>> y |= set([4, 5, 6]) >>>> print x set([1, 2, 3, 4, 5, 6]) >>>> print y set([1, 2, 3, 4, 5, 6]) Sets are unordered. Set elements are unique. Duplicate elements are not allowed. A set itself may be modified, but the elements contained in the set must be of an immutable type. set1 = {1,2,3} set2 = {1,2,[1,2]} --> unhashable type: 'list' # Set elements should be immutable. Conclusion: sets are mutable. Your two questions are different. Are Python sets mutable? Yes: "mutable" means that you can change the object. For example, integers are not mutable: you cannot change the number 1 to mean anything else. You can, however, add elements to a set, which mutates it. Does y = x; y |= {1,2,3} change x ? Yes. The code y = x means "bind the name y to mean the same object that the name x currently represents"

Bootstrap 4 Carousel Not Working Code Example

Example: carousel bootstrap not working < link rel = " stylesheet " href = " https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css " integrity = " sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm " crossorigin = " anonymous " > < script src = " https://code.jquery.com/jquery-3.2.1.slim.min.js " integrity = " sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN " crossorigin = " anonymous " > </ script > < script src = " https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js " integrity = " sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q " crossorigin = " anonymous " > </ script > < script src = " https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js " integrity = " sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQx

Can I Define Multiple Agent Labels In A Declarative Jenkins Pipeline?

Answer : You can see the 'Pipeline-syntax' help within your Jenkins installation and see the sample step "node" reference. You can use exprA||exprB : node('small||medium') { // some block } This syntax appears to work for me: agent { label 'linux && java' } EDIT: I misunderstood the question. This answer is only if you know which specific agent you want to run for each stage. If you need multiple agents you can declare agent none and then declare the agent at each stage. https://jenkins.io/doc/book/pipeline/jenkinsfile/#using-multiple-agents From the docs: pipeline { agent none stages { stage('Build') { agent any steps { checkout scm sh 'make' stash includes: '**/target/*.jar', name: 'app' } } stage('Test on Linux') { agent { label

Animation Rotate W3schools Code Example

Example 1: css rotate <style > div { width : 80 px ; height : 80 px ; background-color : skyblue ; } .rotated { transform : rotate ( 45 deg ) ; background-color : pink ; } </style> /* In body of html doc */ <div>Normal</div> <div class= "rotated" >Rotated</div> Example 2: transform rotate css <!DOCTYPE html > <html > <head > <style > div .a { width : 150 px ; height : 80 px ; background-color : yellow ; -ms-transform : rotate ( 20 deg ) ; /* IE 9 */ transform : rotate ( 20 deg ) ; } div .b { width : 150 px ; height : 80 px ; background-color : yellow ; -ms-transform : skewY ( 20 deg ) ; /* IE 9 */ transform : skewY ( 20 deg ) ; } div .c { width : 150 px ; height : 80 px ; background-color : yellow ; -ms-transform : scaleY ( 1.5 ) ; /* IE 9 */ transform : scaleY ( 1.5 ) ; } </style> </head> <
Answer : It shows that the assembly you referenced in the project has different version(4.0.0.1) as what you have in web.config(4.0.0.0). Please check that the referenced assembly for System.Web.Mvc is the same as written in the web.config. If not then add reference to the appropriate assembly. Right click References -> Add Reference -> ... Install Nuget Package Microsoft.AspNet.Mvc for all the project referencing System.Web.Mvc dll Example: Install-Package Microsoft.AspNet.Mvc

Bootstrap Loading Spinner Full Screen Code Example

Example: bootstrap spinner/ loader < div class = " spinner-border " > </ div >

Allocatable Character Variables In Fortran

Answer : This character (len=:), allocatable :: input_trim is certainly syntactically correct in Fortran 2003. You don't say what the error that gfortran raises is, so I can't comment on why it doesn't accept the line -- perhaps you have an old version of the compiler installed. With an up-to-date Fortran compiler ( eg Intel Fortran v14.xxx) you don't need to allocate the character variable's size prior to assigning to it, you can simply write input_trim = trim(input) Note that read(*,*) input_trim won't work.

Programiz.com Cpp Code Example

Example: basic cpp programs // Your First C++ Program # include <iostream> int main ( ) { std :: cout << "Hello World!" ; return 0 ; }

Android.permission.INTERNET In Android Manifest Code Example

Example 1: allow internet permission android //add to AndroidManifest.xml < uses-permission android: name = " android.permission.INTERNET " /> Example 2: internet permission android < uses-permission android: name = " android.permission.INTERNET " />

Android Push Notifications: Icon Not Displaying In Notification, White Square Shown Instead

Answer : Cause: For 5.0 Lollipop "Notification icons must be entirely white". If we solve the white icon problem by setting target SDK to 20, our app will not target Android Lollipop, which means that we cannot use Lollipop-specific features. Solution for target Sdk 21 If you want to support Lollipop Material Icons then make transparent icons for Lollipop and the above version. Please refer following: https://design.google.com/icons/ Please look at http://developer.android.com/design/style/iconography.html, and we'll see that the white style is how notifications are meant to be displayed in Android Lollipop. In Lollipop, Google also suggests that we use a color that will be displayed behind the white notification icon. Refer Link: https://developer.android.com/about/versions/android-5.0-changes.html Wherever we want to add Colors https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder.html#setColor(int) Implementation of Noti

Border Radius Only Right Side Flutter Code Example

Example: flutter container border radius only left borderRadius: BorderRadius.only( topRight: Radius.circular(10.0), bottomRight: Radius.circular(10.0)),

Chess Knight Move In 8x8 Chessboard

Answer : Following the suggestion of @BarakManos: Step 1: Construct a graph where each square of the chess board is a vertex. Step 2: Place an edge between vertices exactly when there is a single knight-move from one square to another. Step 3: Dijkstra's algorithm is an algorithm to find the length of a path between two vertices (squares). It is very classical in graph theory, data structures, and algorithms. There's actually few restrictions that are due to the edge of the board. One of these (or the only case) is moving from A1 to B2 for example. Normally it would take two moves to move one step diagonally, but here that solution would move you of board. Instead you would have to move to C2 or B3 first and then it's a move one step along file or row which is three steps. Then it should be quite straight forward to just testing for solutions. The reason you don't get that many restrictions from the edges is that there will be similar solutions by symmetry

Change Background Color Jquery W3schools Code Example

Example 1: change background colour jquery $(document).ready(function() { $("button").mouseover(function() { var p = $("p#44.test").css("background-color", "yellow"); p.hide(1500).show(1500); p.queue(function() { p.css("background-color", "red"); }); }); }); Example 2: how to change the background color in jquery $("#co").click(function(){ $(this).css({"backgroundColor" : "blue"}); }); Example 3: jquery css $('#element').css('display', 'block'); /* Single style */ $('#element').css({'display': 'block', 'background-color' : '#2ECC40'}); /* Multiple style */ Example 4: edit css jquery $('.ama').css('color','red'); Example 5: jquery fedein background color $("div" ).hover( function() { $(this).animate({backgroundColor: "#fff"}, 'slow');

Can I Use The PlantUML Language In LaTeX?

Image
Answer : It is possible to use the PlantUML language direcly inside LaTeX using the plantuml package. Here is a minimal example: \documentclass{scrartcl} \usepackage{plantuml} \begin{document} \begin{plantuml} @startuml Alice -> Bob: Hello Alice <- Bob: Hi! @enduml \end{plantuml} \end{document} For building LaTeX with PlantUML the PLANTUML_JAR environment variable has to be set and Java must be installed. To build this document, run lualatex --shell-escape documentname The result should look like this: A more detailed example can be found here: https://koppor.github.io/plantuml/

Charindex In Sql Server Code Example

Example 1: locate sql server SELECT CHARINDEX ( 'b' , 'ab' ) //returns 2 Example 2: charindex DECLARE @document VARCHAR ( 64 ) ; SELECT @document = 'Reflectors are vital safety' + ' components of your bicycle.' ; SELECT CHARINDEX ( 'bicycle' , @document ) ; GO

Create Space In Math Mode Latex Code Example

Example 1: latex space in math mode \ ; - a thick space . \ : - a medium space . \ , - a thin space . \ ! - a negative thin space . Example 2: space latex math Spaces in mathematical mode . \begin { align * } f ( x ) &= x ^ 2 \ ! + 3 x\ ! + 2 \\ f ( x ) &= x ^ 2 + 3 x + 2 \\ f ( x ) &= x ^ 2 \ , + 3 x\ , + 2 \\ f ( x ) &= x ^ 2 \ : + 3 x\ : + 2 \\ f ( x ) &= x ^ 2 \ ; + 3 x\ ; + 2 \\ f ( x ) &= x ^ 2 \ + 3 x\ + 2 \\ f ( x ) &= x ^ 2 \quad + 3 x\quad + 2 \\ f ( x ) &= x ^ 2 \qquad + 3 x\qquad + 2 \end { align * }