I haven't tried this but I'm theoretically assuming its bad practice to add multiple backgrounds in one feature file on Cucumber.
Background:
Given I am on the SignIn Page
Scenario: I am able to . .. . . .
When I . . . . .
Then I . . . . .
Background:
Given I signin
Scenario: I am able to . . . .
When I . . . .
Then I . . . .
Wanted to know if it is possible?
Thanks
Answer:
"You can only have one set of Background steps per Feature or Rule. If you need different Background steps for different scenarios, consider breaking up your set of scenarios into more Rules or more Features."
https://cucumber.io/docs/gherkin/reference/#background
Related
I am interested in creating multiple files based on a simple pattern.
a.kf
b.kf
c.kf
...
fss1.lsk
fss2.lsk
fss3.lsk
...
Of course I could use a loop, however I would prefer a more elegant solution. Perhaps using the tee command, however I've had difficulty implementing this idea.
Use brace expansions.
$ touch {a..c}.kf fss{1..3}.lsk
$ ls
a.kf b.kf c.kf fss1.lsk fss2.lsk fss3.lsk
I am hoping that you folks can help me as I am new to Haskell and Haskell-fu is rather weak.
I am trying to create a quake-like terminal that drops down when called upon. For the most part I figured that storing a named urxvt terminal in layout managed by a simpleDrawer (XMonad.Layout.Drawer) works well for this. What I am having a problem with is binding a key to it so that it will pop up on whatever workspace I happen to be in.
The bringSelected option doesn't work for me as I do not want to have to deal with the grid menu. What I have tried that has gotten me the closest is:
raiseMaybe (spawnHere "urxvt -name drawer") (resource =? "drawer")
And:
ifWindows (resource =? "drawer") (mapM_ focus) (spawn "urxvt -name drawer")
The problem is that both essentially do the same thing in that instead of bringing said window (with resource =? "drawer") to my current workspace, it shifts me away from my current workspace to wherever it was last invoked.
Ideally I am looking for something along the lines of:
ifWindows (resource =? "drawer") ({- bring window to current workspace -})
(spawnHere "urxvt -name drawer")
Going over the contrib docs it seems that I am trying to reinvent the wheel as I can just easily use scratchpad. That should do the trick.
But...if anyone has any ideas regarding the question above, i.e. using ifWindows to pull another window from one workspace to another I would love to know how you went about it.
Added the following myKeys:
, ("M-`", scratchpadSpawnActionTerminal myScratchTerm)
Defined the ManageHook:
myScratchPadHook :: ManageHook
myScratchPadHook =
scratchpadManageHook (W.RationalRect fLeft fTop tRight fBottom)
where
fLeft = 0.0
fTop = 0.75
tRight = 1.0
fBottom = 0.25
and added
<+> myScratchPadHook
I have built a form using PowerShell to help my kids learn French numbers. The form plays the French pronunciation of a random number from a section of an MP3 audio file that contains all French pronunciations of 0 to 100. This all works fine using:
$zMediaPlayer = New-Object system.windows.media.mediaplayer;
$zMediaPlayer.Open($zMediaFile);
. . . .
$zMediaPlayer.Position = New-Object System.TimeSpan(0, 0, 0, 0, $zStartAt);
$zMediaPlayer.Play();
Sleep -Milliseconds $zDuration;
$zMediaPlayer.Pause();
$zMediaPlayer.Stop();
. . . . .
$zMediaPlayer.Close();
I have seen mention of a "clock" property of System Media Player that allows both 'StartAt' and 'Duration' to be used in a 'TimeLine' to play a section of a media file:
Public property Clock Gets or sets the MediaClock associated with the MediaTimeline to be played.
But I cannot find how to use this type of functionality in a PowerShell script as I have another idea for a script where such functionality would be very useful. Can someone describe how to use this functionality, thanks.
UPDATE
I have simplified the demonstration of this with an actual project created from the scaffold - you can check it out here: https://github.com/tetigi/yesod-bug-test
Follow the README to set up the repo and replicate the issue! Thanks :)
ORIGINAL POST
I've recently been trying to create a simple website using yesod - in one particular handler, it makes a couple of runDB calls (selecting and inserting some values into a ~200 item DB). However, on medium load, such as reloading the page rapidly in a browser, the page starts to hang.
Doing some debugging, I found that it seems the yesod app is not releasing the connections to the DB pool in a timely fashion and ends up waiting for them to release. To correborate this, I found the other following things:
Reducing the DB pool to 2 gave me a freeze after only a couple of clicks
The default (10) froze after about 5 seconds of clicking
Increasing the DB pool to 100 gave me a much longer click period, up to about 10-15 seconds of rapid clicking
The issue is the same whether I'm using postgres or sqlite
In postgres, it was possible to see the 'COMMIT' transactions stacking up over time
These transactions would eventually dissappear over time and the website would be responsive again
Is there something I'm missing here? The webpage does not do anything complicated, as the snippet below will show. Any ideas? As it stands, the website will be unuseable for multiple users until I find a way to fix this!
I'm using the standard scaffolded yesod application via stack as is recommended in the documentation.
Cheers!
Luke
Example handler code (abridged)
getCompareR :: Handler Html
getCompareR = do
-- Get all entities from the db. Throws error if < 2 elems in the DB.
entities <- fmap (\xs -> assert (length xs >= 2) xs) $ runDB $ selectList [] []
-- Pick an entity at random
Entity _ thisThingEntity <- liftIO $ runRVar (choice entities) DevRandom
-- Pull out everything NOT the thing we just picked
otherEntities <- runDB $ selectList [ComparisonHash !=. (comparisonHash thisThingEntity)] []
-- Pick one at random
Entity _ thatThingEntity <- liftIO $ runRVar (choice otherEntities) DevRandom
-- Some stuff including some inserts
-- ...
-- ...
runDB $ sequence [update thisId [ComparisonElo =. thisElo], update thatId [ComparisonElo =. thatElo]]
-- Start laying out the webpage
defaultLayout $ do
-- Fill in the rest with compare.hamlet
$(widgetFile "compare")
The issue lies within Data.Random - replacing the choice call with something like:
import System.Random (randomRIO)
...
-- Pick an entity at random
randomInt1 <- liftIO $ randomRIO (0, length entities -1)
let Entity _ thisThingEntity = entities !! randomInt1
Fixed everything and we no longer get slow down. Not really sure why Data.Random is doing this, but at least it works now!
Another interesting thing to note - the issue is NOT present on Mac OS X, only on Linux flavours (CentOS, Arch, Ubuntu being the ones we tried)
How to check logs in this case .
Actually from our Application , we are contacting some third party Service (Application )
The way they provided their log file is different . (Only one log file no matter what the date is )
For instance , this looks this way
11:29:32,862 - INFO main:http-8082-2 <ServicePlugger> <gurthu>DE</gurthu>
11:29:32,862 - INFO main:http-8082-2 <ServicePlugger> <enni>0</enni>
11:29:32,862 - INFO main:http-8082-2 <ServicePlugger> <konadate>0</konadate>
11:29:32,862 - INFO main:http-8082-2 <ServicePlugger> <costentha>0</costentha>
Now my question is how to check log files ??
Whether the starting lines indicate time (11:29:32,862) ??
Thank you .
I am not sure if I understand your question correctly. Can you not use regular expression to match the string?