2017年11月8日 星期三

How to fix .NET Framework 3.5 Error 0x800f081f in Windows 10

0x800f081f Error Messages While Installing .Net Framework 3.5 in Windows 10. Download: http://www.mediafire.com/file/44jx5cn4m1bk6i1/microsoft-windows-netfx3-ondemand-package.cab Paste this: Dism.exe /online /enable-feature /featurename:NetFX3 /source:C:\ /LimitAccess

from : https://www.youtube.com/watch?v=ZHQqb7IOHZE

2017年10月18日 星期三

Functional Programming in Javascript

This is a series of interactive exercises for learning Microsoft's Reactive Extensions (Rx) Library for Javascript. So why is the title "Functional Programming in Javascript"? Well it turns out that the key to learning Rx is training yourself to use functional programming to manipulate collections. Functional programming provides developers with the tools to abstract common collection operations into reusable, composable building blocks. You'll be surprised to learn that most of the operations you perform on collections can be accomplished with five simple functions:
  1. map
  2. filter
  3. mergeAll
  4. reduce
  5. zip
Here's my promise to you: if you learn these 5 functions your code will become shorter, more self-descriptive, and more durable. Also, for reasons that might not be obvious right now, you'll learn that these five functions hold the key to simplifying asynchronous programming. Once you've finished this tutorial you'll also have all the tools you need to easily avoid race conditions, propagate and handle asynchronous errors, and sequence events and AJAX requests. In short, these 5 functions will probably be the most powerful, flexible, and useful functions you'll ever learn.

from : https://github.com/ReactiveX/learnrx

2017年10月1日 星期日

How to get html elements with multiple css classes

The expression you're looking for is:
//div[contains(@class, 'class1') and contains(@class, 'class2')]
I highly suggest XPath visualizer, which can help you debug xpath expressions easily. It can be found here:

from : https://stackoverflow.com/questions/3881044/how-to-get-html-elements-with-multiple-css-classes

2017年9月17日 星期日

Headless Chrome Node API

page : https://github.com/GoogleChrome/puppeteer

2017年8月17日 星期四

GivenWhenThen of BDD

Given-When-Then is a style of representing tests - or as its advocates would say - specifying a system's behavior using SpecificationByExample. It's an approach developed by Dan North and Chris Matts as part of Behavior-Driven Development (BDD). [1] It appears as a structuring approach for many testing frameworks such as Cucumber. You can also look at it as a reformulation of the Four-Phase Test pattern.
The essential idea is to break down writing a scenario (or test) into three sections:
  • The given part describes the state of the world before you begin the behavior you're specifying in this scenario. You can think of it as the pre-conditions to the test.
  • The when section is that behavior that you're specifying.
  • Finally the then section describes the changes you expect due to the specified behavior.
Since we're talking about using examples as specifications, it makes sense to show this with an example [2]
Feature: User trades stocks
  Scenario: User requests a sell before close of trading
    Given I have 100 shares of MSFT stock
       And I have 150 shares of APPL stock
       And the time is before close of trading

    When I ask to sell 20 shares of MSFT stock
     
     Then I should have 80 shares of MSFT stock
      And I should have 150 shares of APPL stock
      And a sell order for 20 shares of MSFT stock should have been executed
  
The above example uses Cucumber [3], which a popular way of writingBusinessFacingTests but you can use the Given-When-Then style with any kind of tests. Some people like to put Given-When-Then as comments to mark informal blocks inside unit tests [4]. I've also seen this convention to structure informal prose.
It's usual with this approach to see "ands" used to combine multiple expressions within each clause.
I've characterized the given as a description of the pre-condition state because that's the way I prefer to think of it. A testing framework, however, interprets the givens as a set of commands to bring the system-under-test into the correct state before executing the when command. (Which is why other naming conventions often call this "setup".) Testing frameworks provide various query methods for the then commands - these should be free of side-effects.
Although Given-When-Then style is symptomatic to BDD, the basic idea is pretty common when writing tests or specification by example. Meszaros describes the pattern as Four-Phase Test. His four phases are Setup (Given), Exercise (When), Verify (Then) and Teardown [5]. Bill Wake came up with the formulation as Arrange, Act, Assert.

Notes

1: In review comments on this, Dan credits Ivan Moore for a significant amount of inspiration in coming up with this.
2: from Pete Hodgson
3: Or to be strict it uses Gherkin, which is the name of Cucumber's DSL.
4: Test frameworks tend to follow either naming style of xunit or BDD, the latter tend to name methods in the Given-When-Then style.
5: Teardown isn't always needed when implementing tests (particularly if you are using Automated Teardown) and doesn't add much to the communication aspect of specification by example. So it's reasonable to see it missing from the BDD style.
Translations: French · Ukrainian · Hungarian

from : https://martinfowler.com/bliki/GivenWhenThen.html

2017年7月11日 星期二

Laravel - No whitelist configured, no code coverage will be generated



Add phpunit.xml to Default configuration file for PHPUnit settings

Error when mocking interfaces in PHP using Mockery

You should call mock() method at the and of mock declaration.
$mock = Mockery::mock('MyNamespace\SomeSubFolder\MyInterface');

$mock->shouldReceive('method1')
     ->andReturn('foo')
     ->mock();

from : https://stackoverflow.com/questions/19479052/error-when-mocking-interfaces-in-php-using-mockery

wibiya widget