w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Can protractor test a login that is not angular based
After placing the issue on github I received the answer I was looking for. This can be found HERE! Protractor requires that Angular be present on the page and the way around this is to use the driver directly. Following the link above should stear anyone stuck on the same issue in the right direction. Kudos to JulieMR and the others who helped out with this issue.

Categories : C#

Not seeing OSX desktop notifications with test app closed (Lion)
PushyMac app code was written during OSX 10.7 and the only notification type available was Badge. If you are running OSX 10.8, then add the alert notification type as well, as shown below. [NSApp registerForRemoteNotificationTypes:(NSRemoteNotificationTypeBadge | NSRemoteNotificationTypeAlert)] However, after doing this, I am not able to launch the app by clicking on the alert in notification area. If you find an answer for that, please do reply.

Categories : Objective C

Finalizing a Cursor that has not been deactivated or closed or database not closed error
When you are done with the cursor, you need to call Cursor.close(). Leaving it not closed leads to memory leaks. E.g.: Cursor cursor = null; try { cursor = getContentResolver().query(myUri, MY_PROJECTION, null, null, null); if (cursor != null && cursor.moveToFirst()) { // moar code } } finally { if (cursor != null) { cursor.close(); } }

Categories : Android

Link resx files in Unit Test
What you are describing is not really a unit test. A unit test should not relay on external resources. When you say "I managed to mock GetGlobalResourceObject method", I assume that you are working with HttpContextBase.GetGlobalResourceObject (accessible in your controller). So, for unit test purposes, you don't need any resx files. Just setup the proper calls on that mocked method, so it returns whatever is needed.

Categories : C#

Application gets closed when terminal is closed, how to stop this?
Use nohup to prevent child processes from being killed when the terminal closes. spawn nohup /usr/bin/firefox https://www.google.com/ I assume there's more to the script, since there's no need to use Expect just to start firefox.

Categories : Python

XPath not resolving to link when running test using Splinter
I think your xpath is not quite right. Here's what works for me: from splinter import Browser import time URL = 'https://mail.google.com/mail/u/0/?shva=1#trash' with Browser() as browser: browser.visit(URL) username = browser.find_by_id('Email') username.fill(...) password = browser.find_by_id('Passwd') password.fill(...) button = browser.find_by_id('signIn') button.click() time.sleep(5) browser.visit(URL) empty_button = browser.find_by_xpath("//div[5]/div[2]/div/div[2]/div[1]/div[2]/div/div/div/div[2]/div[1]/div[1]/div/div[2]/div[3]/div/span") empty_button.click() Though, you should think about simplifying the xpath expression, xpaths with absolute paths are too fragile. Hope that helps.

Categories : Python

where can I find a valid JSON link that I can use to test my applications?
Why not try out the free stackexchange api? burhan@lenux:~$ http "http://api.stackexchange.com/2.1/users/1755023?site=stackoverflow" HTTP/1.1 200 OK Access-Control-Allow-Credentials: false Access-Control-Allow-Methods: GET, POST Access-Control-Allow-Origin: * Cache-Control: private Content-Encoding: gzip Content-Length: 433 Content-Type: application/json; charset=utf-8 Date: Thu, 25 Jul 2013 16:54:31 GMT { "has_more": false, "items": [ { "accept_rate": 91, "account_id": 1950909, "age": 27, "badge_counts": { "bronze": 9, "gold": 0, "silver": 0 }, "creation_date": 1350528803, "display_name": "Rj.", "is_employee": false,

Categories : Json

TFS link Unit Test Methods to a Task so in Gated Check-in it can be verified
Potentially. You would have to customise the gated check in workflow and inspect the check in, see if a task (or multiple tasks) were linked to it and then, before calling the unit test runner, change it so that the call only executes the tests you want. Good luck with that :-)

Categories : Visual Studio 2010

How to draw closed spline 3D (closed curve 3d) through unordered list of points3D. How to arrange points3D?
It sounds like you're looking for the Concave Hull of the data set. Unfortunately, I don't know of any pre-canned algorithms, but the link references a paper that another developer was starting from, as well as some sample code, so maybe that'll help you in the right direction.

Categories : C#

Nunit loads all test Test data for all the test before the test gets executed
I think that's by design. NUnit is designed to clean up the environment before any test, to generate same conditions for any test independent their execution order. If Test A would change the XDocument, Test B would be run with that changes. That might led to indeterminate test results. If Test B expects changes made from Test A, then your tests are not fully isolated, that's a bad practice. If you wan't to change that behaviour, implement a lazy field and load the test data only on first access. You can increase performance if you know that you are not changing data in any of your tests, but pay attention. private static Lazy<IEnumerable> testData = new Lazy<IEnumerable>(GetExample); private static IEnumerable GetExample() { var doc = XDocument.Load("Example.xml");

Categories : Xml

The underlying connection was closed: The connection was closed unexpectedly wcf service
The first thing i will do is, instead of returning the full list of candidates i will return an empty list. If that works fine, then it is very clear that the size of the data is a problem. To modify the size play with your binding parameters.

Categories : Wcf

Set colours RGB
One option is to create your own function (a kind of wrapper), something like (you need to apply the validations necessary): /* CODE FOR DEMONSTRATION PURPOSES */ function setColorToRange() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getActiveSheet(); var colorsRGB = [ [ [255, 0, 0], [0, 255, 0], [0, 0, 255], [0, 0, 0] ], [ [0, 0, 0], [0, 0, 255], [0, 255, 0], [255, 0, 0] ], [ [0, 255, 0], [0, 255, 0], [0, 255, 0], [0, 255, 0] ] ]; var cell = sheet.getRange("B5:E7"); setBackgroundsRGB(cell, colorsRGB); } function setBackgroundsRGB(range, colors) { var row = range.getRow(), lastRow = range.getLastRow(); var initColumn = range.getColumn(), lastColumn = range

Categories : Google Apps Script

Colours for geom_histogram
You need to define the "fill" variable in the aes() section: ggplot(repex, aes(x=salesfromtarget, fill=..x..)) +geom_histogram(binwidth=.1) +scale_fill_gradient("Legend",low = "green", high = "blue") Since the histogram bars are the count of each x-axis value, if you want to use the original x value you should use "..x..". You can fill with the histogram count using "..count..": ggplot(repex, aes(x=salesfromtarget, fill=..count..)) +geom_histogram(binwidth=.1) +scale_fill_gradient("Legend",low = "green", high = "blue")

Categories : R

Active Link on javascript menu to work on parent link not just child link
Look at this JSFiddle. $('#nav li a').click( (...) // Here I removed the "active" class from all siblings "li" $(this).parent().siblings().removeClass("active"); (...) // Here I add the "active" class to this "li" $(this).parent().addClass("active"); (...) ) Note 1: The new JSFiddle

Categories : Javascript

VS2012: Clear the test results in Test Explorer when re-running a test that previously failed
You cant do that. Instead you can filter which test are shown to you, if that suits your needs. You can find more information about test here: http://msdn.microsoft.com/en-us/library/hh270865.aspx

Categories : Unit Testing

Grails Spock integration test redirectedUrl different between localhost test-app and build server test-app
I've also just experienced this same issue, and it seems that it comes down to the test framework extracting the controller name from the the name of the testing class. The convention is that the test class is named <controller name>ControllerSpec In the above case, the test class should be named PriceTierControllerSpec so that the test framework will successfully resolve the controller to PriceTeir. Naming the class according to these guidelines seems to fix this problem. Further reference can be found here: https://jira.grails.org/browse/GRAILS-10962

Categories : Grails

OpenCV pixel colours all the same
From my understanding you should get the color of the inner circle, because you're drawing it before accessing the color value. But since the values returning aren't 0, 0, 255 the coordinates have to be swapped. orig print is: print "Center Colour (orig)", cimg[i[0], i[1]] swapped print is: print "Center Colour (swapped)", cimg[i[1], i[0]] Output after drawing: Center Colour (orig) [126 126 126] Center Colour (orig) [116 116 116] ... Center Colour (swapped) [ 0 0 255] Center Colour (swapped) [ 0 0 255] ... If you now use the swapped print before painting the inner circle, the output will look like: Center Colour (swapped) [128 128 128] Center Colour (swapped) [27 27 27] ... Is that what you're looking for?

Categories : Python

Branch colours in the graph
I'm not sure this an answer (in that it doesn't solve your problem), but I don't think that feature is currently available in SourceTree, at the moment the colours for the branches are assigned at random (although picked in a particular order). There are requests for such a feature: https://jira.atlassian.com/browse/SRCTREE-1191 There's also a response from an Atlassian developer highlighting the difficulty in implementation: In git, branches are never an attribute of a commit, they're simply pointers to a single commit which move as you commit to that branch, so the history is built by association via the parent links, and each commit has no branch information associated with it. This means moving branches around is very easy in Git, which is one of its strengths, although it can be

Categories : GIT

Calculating heat map colours
What you really want is an HSV color, because the Hue (H value) is cyclical. if the hue is between 0 and 1, then it indicates how far along your color gradient you want to be. The saturation and value components are always 1 in this case. Follow the HSV to RGB conversion code here: HSV to RGB Stops at yellow C# public string ConvertTotalToRgb(int low, int high, int cell) { int range = high - low; float h= cell/ (float)range; rgb = HSVtoRGB(h,1.0f,1.0f); return "#" + rgb.R.ToString("X2") + rgb.G.ToString("X2") + rgb.B.ToString("X2"); } If you know you can target browsers that support it (CSS3), you can just render the hsv value directly.

Categories : C#

How can I fix shell colours in Emacs?
Try running ls --color=always; ls may not recognize that colors are available, and this will tell it to use them anyway. If that works, then an easy way to use that all the time is to define an alias: alias ls='ls --color=always (note that aliases are a Bash feature, not an Emacs feature). It's likely that you already have an alias or two defined in your Bash profile, so it may just be a matter of editing that one to make the change permanent.

Categories : Shell

Putting two colours in listview
You need to customize css in jQuery. Like for example .ui-grid-a .ui-block-a { customization goes here } .ui-grid-a .ui-block-b { customization goes here } I have set up a sample jsFiddle, it will get you started. http://jsfiddle.net/Akki619/z3BQ2/ The fiddle may not provide the exact solution you are looking for but you can always play along for desired results. In your case: You need to customize data-theme a/c to your need. It might be a tricky to get the desired result as you want.

Categories : HTML

How to keeps colours from msbuild output?
I don't know about how can do this specifically for msbuild with all the warnings/errors/other things that do different colours, but you can change the console colour by using Console.ForegroundColor = ConsoleColor.Red; before you write to it, and reset it with Console.ResetColor(); So you would change ErrorDataRecieved subscription to do change the colour to red before you write, and reset the colour after you write the output.

Categories : C#

How to get first three average colours of an image?
NSMutableDictionary *dicColors; loop through each pixel if entry in the dicColors then increment the value other wise add a new entry in dicColors for this color with initial value of 1. convert to NSArray and sort get the first 3 elements of the array. If your image is blank or solid color this array may have only 1 or 2 entries so check that too.

Categories : Iphone

Can you run two test cases simultaneously in a Test Suite in Microsoft Test Manager 2010?
Yes, you can with modified TestSettings file. http://blogs.msdn.com/b/vstsqualitytools/archive/2009/12/01/executing-unit-tests-in-parallel-on-a-multi-cpu-core-machine.aspx

Categories : Testing

How to test single test modules in intellij in maven project having test dependency?
Got my answer there : http://youtrack.jetbrains.com/issue/IDEA-112978 That's because a run configuration is created by template. And that template has default setting to pick classes across module dependencies. For me in 132.46 the following helps: 1. Open Run Configuration dialog, Defaults section. 2. Find respective template. I tried JUnit. 3. "Test kind" combo, select All in package. 4. Set "In single module". 5. Apply to save the template. After that delete created configurations and repeat "Run All tests". It picks only classes from current module for me. The possible improvement in IDEA is to modify these defaults specially for Maven-based projects. Rather specific change...

Categories : Maven

Creating a horizontal navigation with different colours
You'll want to do the following with your code: CSS: #session-nav { list-style: none; } #session-nav li { display: inline-block; padding: 5px 10px; } #session-nav li.session1 { background: green; } EDIT: Here is a jsfiddle http://jsfiddle.net/hgJ68/

Categories : HTML

Automatically assigning colours in ggplot
You should put all data frames in one and then add some column that have identifier for each line. new.df<-rbind(A,B,C) new.df$ID<-rep(c("A","B","C"),c(nrow(A),nrow(B),nrow(C))) Then use this new column to set color. ggplot(new.df,aes(x,y,color=ID))+geom_line()

Categories : R

Changing Row Colours on DevExpress GridView
For changing the row colour in runtime handle the RowStyle event: public Color color1; public Color color2; public int rowhandle; private void gridView1_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e) { try { if (e.RowHandle == rowhandle) { if (color1 != null && color2 != null) { e.Appearance.BackColor = color1; e.Appearance.BackColor2 = color2; } } } catch { } } private void button1_Click(object sender, EventArgs e) { color1 = Color.BurlyWood; color2 = Color.DarkOrchid; rowhandle = gridView1.FocusedRowHandle; gridView1

Categories : C#

How to paint colours over a background image?
It's a kind of a tricky task... There's probably a better way to implement it, but here's my first thought: You could pre-break the image into separate segments before the app runs. As far as I know the only type of View you can create is a rectangle. But you can create many small rectangles to fill in parts of your image. Then you can get the clicks on those little areas and make a corresponding segment of your image: int color= res.getColor(R.color.my_color); image.setColorFilter(color, Mode.SRC_ATOP); Hope this helps!

Categories : Android

Passing dictionary of colours to view MVC
The problem is that your dictionary cannot have non-string keys because they won't be understood correctly by javascript. However fix in your case seems to be simple enough - just turn your dictionary into one that uses string representation of numbers as keys: public Dictionary<string, Color> Colourlist = new Dictionary<string, Color>(); public Dictionary<string, Color> CreateColourPalette() { Colourlist.Add("1", System.Drawing.ColorTranslator.FromHtml("#f2dcdb")); ...

Categories : C#

Define scatter3 colours in MATLAB
You are nearly there. scatter3 provides several options to define the color scheme (see the doc here). One is indexing with scalars as you do right now. The coloring scheme is automatic in this case. Another option is to use triplets of values representing RGB colors. For instance, for three colors you can define a custom colormap cmap. color_1 = [1 0.2 0.4]; color_2 = [0.34 0.65 0.87]; color_3 = [0.5 0.5 0.5]; cmap = [color_1; color_2; color_3]; and then create an INDEX_color (Nx3) matrix based on your actual indexing INDEX_color = cmap(INDEX,:); For more groups, you can automatically create INDEX_color based on buil-in colormaps. cmap = colormap(jet(10)); will produce a 10x3 RGB matrix folowwing the jet colormap. The following figure is given by this code A = [rand(20,3); ra

Categories : Matlab

How do I turn an Image into a matrix of colours?
sequence is the magic function you are looking for. sequence takes a list of IO actions and makes it an IO list of values. In type signature terms: sequence :: Monad m => [m a] -> m [a] Or, more specifically in your case: sequence :: [IO a] -> IO [a] So you can do, for example: do putStrLn "Enter three lines of input:" irritatedUser <- sequence [getLine, getLine, getLine] putStrLn (irritatedUser !! 2) and the last line the user writes will be printed back. Anyway, in your case, this means you want to do rectFromImage img = do size <- imageSize img sequence [sequence [getPixel (x,y) img | x <- [1 .. fst size]] | y <- [1 .. snd size]] I snuck two sequence calls into there, to go from your [[IO Color]] to an [IO [Color]] and then on to an IO [[Color

Categories : Haskell

AS3 mobile app multiple background colours
If you're using flat colours you can simply create Quads: private var _bg1:starling.display.Quad; _bg1 = new Quad(_stageWidthValue, _stageHeightValue, 0xFF0000); _bg1.touchable = false; addChildAt(_bg1, 0);

Categories : Actionscript

Multiple Foreground Colours In ControlTemplate
First, in template is better to use the ContentPresenter, instead of ContentControl, which is a common practice. Quote reply Nir (Question: What's the difference between ContentControl and ContentPresenter?): ContentControl is a base class for controls that contain other elements and have a Content-property (for example, Button). ContentPresenter is used inside control templates to display content. ContentControl, when used directly (it's supposed to be used as a base class), has a control template that uses ContentPresenter to display it's content. Inside ControlTemplate use ContentPresenter; Outside of ControlTemplate (including DataTemplate and outside templates) try not to use any of them, if you need to, you must prefer ContentPresenter; Subclass ContentCont

Categories : C#

Change Colours In Eclipse Diff
Inside of the properties you can change all the colors and fonts. You are looking for General -> Appearance -> Colors and Fonts -> Text Compare

Categories : Java

heatmap layer colours based on value
You may increase the weight to get a result that is more differentiated based on the weight, e.g. by using Math.pow weight:Math.pow(signalStrength, 2) (Modify the exponent to get a result that fits your needs)

Categories : Google Maps

Painting rows based on value,using only 2 colours
Well, some type details and framework info would be nice, but as a pure algorithm: for(int i = 0;i<columns[0].Count;i++) { Colour colour = Utils.GetColourFromValue(columns[0][i].Value); for(int j = 0;i<columns.Count;j++) { columns[j][i].Colour = colour; } }

Categories : C#

"The underlying connection was closed: The connection was closed unexpectedly"
The first request does not utilize a header that indicates the length of the result. It closes the connection when it finishes. The second request utilizes the length header, reads the designated number of bytes, then closes the connection gracefully. (under the client side control instead of server driven disconnection) -or- The url you sent caused an error on the server. Is there an error in the server log or event viewer?

Categories : C#

Powershell Listview OwnerDrawFixed custom colours
Once you've created a WinForms ListView object, set the OwnerDraw property to $true and subscribe to the DrawColumnHeader event e.g: $listView.OwnerDraw = $true $listView.add_DrawColumnHeader({ $eventArgs.DrawBackground() $eventArgs.Graphics.DrawString($eventArgs.SubItem.Text, $listView.Font, ...) }) See this MSDN topic for more info.

Categories : Powershell

Alternating colours of lists in jquery mobile
<div data-demo-html="true"> <ul data-role="listview"> <li data-theme="a">Acura</li> <li data-theme="b">Audi</li> </ul> </div><!--/demo-html --> Alternating the data-theme attribute should do the trick.

Categories : Jquery

© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.