text:
Q: undefined method `keys' for # (NoMethodErr or) Facing problem when try to run 'parallel_tests' in Cucumber + Ruby framework.
Command which I use:
bundle exec parallel_cucumber -n 3 features/someFeature --group-by scenarios

Error I get:
undefined method `keys' for #<Cucumber::Messages::GherkinDocument::Feature:0x07fba0b0> (NoMethodErr
or)
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core/gherkin/ast_builder.rb:81:
in `rubify_keys'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core/gherkin/ast_builder.rb:32:
in `initialize'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core/gherkin/ast_builder.rb:125
:in `initialize'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core/gherkin/ast_builder.rb:106
:in `new'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core/gherkin/ast_builder.rb:106
:in `feature'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core/gherkin/ast_builder.rb:17:
in `feature'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core/gherkin/parser.rb:32:in `d
ocument'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core.rb:30:in `block in parse'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core.rb:29:in `each'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core.rb:29:in `parse'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core.rb:21:in `compile'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-3.1.2/lib/cucumber/runtime.rb:75:in `run!'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-3.1.2/lib/cucumber/cli/main.rb:34:in `execute!'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-3.1.2/bin/cucumber:9:in `<top (required)>'
C:/Ruby26/bin/cucumber:23:in `load'
C:/Ruby26/bin/cucumber:23:in `<main>'
undefined method `keys' for #<Cucumber::Messages::GherkinDocument::Feature:0x07f959d8> (NoMethodErr
or)
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core/gherkin/ast_builder.rb:81:
in `rubify_keys'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core/gherkin/ast_builder.rb:32:
in `initialize'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core/gherkin/ast_builder.rb:125
:in `initialize'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core/gherkin/ast_builder.rb:106
:in `new'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core/gherkin/ast_builder.rb:106
:in `feature'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core/gherkin/ast_builder.rb:17:
in `feature'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core/gherkin/parser.rb:32:in `d
ocument'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core.rb:30:in `block in parse'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core.rb:29:in `each'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core.rb:29:in `parse'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core.rb:21:in `compile'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-3.1.2/lib/cucumber/runtime.rb:75:in `run!'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-3.1.2/lib/cucumber/cli/main.rb:34:in `execute!'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-3.1.2/bin/cucumber:9:in `<top (required)>'
C:/Ruby26/bin/cucumber:23:in `load'
C:/Ruby26/bin/cucumber:23:in `<main>'
undefined method `keys' for #<Cucumber::Messages::GherkinDocument::Feature:0x07f5db90> (NoMethodErr
or)
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core/gherkin/ast_builder.rb:81:
in `rubify_keys'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core/gherkin/ast_builder.rb:32:
in `initialize'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core/gherkin/ast_builder.rb:125
:in `initialize'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core/gherkin/ast_builder.rb:106
:in `new'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core/gherkin/ast_builder.rb:106
:in `feature'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core/gherkin/ast_builder.rb:17:
in `feature'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core/gherkin/parser.rb:32:in `d
ocument'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core.rb:30:in `block in parse'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core.rb:29:in `each'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core.rb:29:in `parse'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-3.2.1/lib/cucumber/core.rb:21:in `compile'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-3.1.2/lib/cucumber/runtime.rb:75:in `run!'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-3.1.2/lib/cucumber/cli/main.rb:34:in `execute!'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-3.1.2/bin/cucumber:9:in `<top (required)>'
C:/Ruby26/bin/cucumber:23:in `load'
C:/Ruby26/bin/cucumber:23:in `<main>'

Thing I want is to run different scenarios in different processes to minimize tests running time.

*

*Cucumber version 3.2.1

*Ruby version 2.6.0

*parallel_tests 3.0

*cuke_modeler 3.1.0

*cucumber-gherkin 14.0.1

Update
After updating cucumber to 4.1 I get another error
Empty stack (RuntimeError)
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-tag-expressions-2.0.4/lib/cucumber/tag_expressions/parser.rb:132:in `pop'

C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-tag-expressions-2.0.4/lib/cucumber/tag_expressions/parser.rb:77:in `push_
expression'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-tag-expressions-2.0.4/lib/cucumber/tag_expressions/parser.rb:24:in `parse
'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/test/case.rb:85:in `match_single_tag_express
ion?'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/test/case.rb:47:in `block in match_tags?'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/test/case.rb:47:in `all?'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/test/case.rb:47:in `match_tags?'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/test/filters/tag_filter.rb:11:in `test_case'

C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/test/case.rb:28:in `describe_to'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/compiler.rb:27:in `pickle'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/gherkin/parser.rb:27:in `block in document'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:38:in `yield'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:38:in `block (
3 levels) in messages'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:37:in `each'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:37:in `block (
2 levels) in messages'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:79:in `yield'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:79:in `block (
2 levels) in sources'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:78:in `each'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:78:in `block i
n sources'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:25:in `each'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:25:in `each'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:25:in `block i
n messages'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/gherkin/parser.rb:21:in `each'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/gherkin/parser.rb:21:in `each'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/gherkin/parser.rb:21:in `document'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core.rb:33:in `block in parse'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core.rb:32:in `each'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core.rb:32:in `parse'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core.rb:24:in `compile'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-4.1.0/lib/cucumber/runtime.rb:79:in `run!'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-4.1.0/lib/cucumber/cli/main.rb:29:in `execute!'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-4.1.0/bin/cucumber:9:in `<top (required)>'
C:/Ruby26/bin/cucumber:23:in `load'
C:/Ruby26/bin/cucumber:23:in `<main>'
Empty stack (RuntimeError)
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-tag-expressions-2.0.4/lib/cucumber/tag_expressions/parser.rb:132:in `pop'

C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-tag-expressions-2.0.4/lib/cucumber/tag_expressions/parser.rb:77:in `push_
expression'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-tag-expressions-2.0.4/lib/cucumber/tag_expressions/parser.rb:24:in `parse
'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/test/case.rb:85:in `match_single_tag_express
ion?'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/test/case.rb:47:in `block in match_tags?'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/test/case.rb:47:in `all?'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/test/case.rb:47:in `match_tags?'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/test/filters/tag_filter.rb:11:in `test_case'

C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/test/case.rb:28:in `describe_to'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/compiler.rb:27:in `pickle'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/gherkin/parser.rb:27:in `block in document'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:38:in `yield'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:38:in `block (
3 levels) in messages'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:37:in `each'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:37:in `block (
2 levels) in messages'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:79:in `yield'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:79:in `block (
2 levels) in sources'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:78:in `each'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:78:in `block i
n sources'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:25:in `each'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:25:in `each'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:25:in `block i
n messages'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/gherkin/parser.rb:21:in `each'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/gherkin/parser.rb:21:in `each'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/gherkin/parser.rb:21:in `document'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core.rb:33:in `block in parse'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core.rb:32:in `each'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core.rb:32:in `parse'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core.rb:24:in `compile'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-4.1.0/lib/cucumber/runtime.rb:79:in `run!'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-4.1.0/lib/cucumber/cli/main.rb:29:in `execute!'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-4.1.0/bin/cucumber:9:in `<top (required)>'
C:/Ruby26/bin/cucumber:23:in `load'
C:/Ruby26/bin/cucumber:23:in `<main>'
Empty stack (RuntimeError)
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-tag-expressions-2.0.4/lib/cucumber/tag_expressions/parser.rb:132:in `pop'

C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-tag-expressions-2.0.4/lib/cucumber/tag_expressions/parser.rb:77:in `push_
expression'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-tag-expressions-2.0.4/lib/cucumber/tag_expressions/parser.rb:24:in `parse
'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/test/case.rb:85:in `match_single_tag_express
ion?'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/test/case.rb:47:in `block in match_tags?'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/test/case.rb:47:in `all?'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/test/case.rb:47:in `match_tags?'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/test/filters/tag_filter.rb:11:in `test_case'

C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/test/case.rb:28:in `describe_to'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/compiler.rb:27:in `pickle'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/gherkin/parser.rb:27:in `block in document'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:38:in `yield'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:38:in `block (
3 levels) in messages'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:37:in `each'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:37:in `block (
2 levels) in messages'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:79:in `yield'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:79:in `block (
2 levels) in sources'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:78:in `each'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:78:in `block i
n sources'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:25:in `each'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:25:in `each'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-gherkin-14.0.1/lib/gherkin/stream/parser_message_stream.rb:25:in `block i
n messages'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/gherkin/parser.rb:21:in `each'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/gherkin/parser.rb:21:in `each'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core/gherkin/parser.rb:21:in `document'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core.rb:33:in `block in parse'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core.rb:32:in `each'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core.rb:32:in `parse'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-core-7.1.0/lib/cucumber/core.rb:24:in `compile'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-4.1.0/lib/cucumber/runtime.rb:79:in `run!'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-4.1.0/lib/cucumber/cli/main.rb:29:in `execute!'
C:/Ruby26/lib/ruby/gems/2.6.0/gems/cucumber-4.1.0/bin/cucumber:9:in `<top (required)>'
C:/Ruby26/bin/cucumber:23:in `load'
C:/Ruby26/bin/cucumber:23:in `<main>'

A: I've solved the problem. Seems that something went wrong with dependencies and versions.
Combination of:

*

*cucumber (3.1.2)

*parallel_tests (2.32.0)

*NO cuke_modeler AT ALL

works fine for me!

A: Your original combination of dependencies was transitively including both the gherkin gem and the cucumber-gherkin gem, which cannot co-exist (see https://github.com/cucumber/cucumber/issues/1063). Upgrading your cucumber from 3.x to 4.x as you did should have solved the problem but, presumably, you still had gherkin in your dependency tree somewhere (without seeing your Gemfile.lock, it's difficult to tell).
Regarding your final dependency set, I can say with great confidence (I wrote the dang thing after all) that the presence of the cuke_modeler gem would not, on its own, cause a problem and that it has been both used and tested with both cucumber and parallel_tests. Additionally, cuke_modeler can work with either gherkin or cucumber-gherkin. You just have to be sure to use cuke_modeler 2.x if you are using gherkin and to use cuke_modeler 3.x if you are using cucumber-gherkin. If adding cuke_modeler back into your final set of dependencies causes a problem, I would again start by looking at your transitive dependencies and see if the gherkin/cucumber-gherkin conflict is present.


text:
Q: Conditionally remove row from data frame using dates and means I'd like to conditionally remove row from data frame using dates and means. In my example:
# Package
library(tidyverse)

# Open dataset
RES_all_files_better <- read.csv("https://raw.githubusercontent.com/Leprechault/trash/main/RES_all_files_better_df.csv")
str(RES_all_files_better)
# 'data.frame': 507 obs. of  11 variables:
#  $ STAND     : chr  "ARROIOXAVIER024B" "ARROIOXAVIER024B" "ARROIOXAVIER024B" "ARROIOXAVIER024B" ...
#  $ ESPACAMENT: int  6 6 6 6 6 6 6 6 6 6 ...
#  $ ESPECIE   : chr  "benthamii" "benthamii" "benthamii" "benthamii" ...
#  $ IDADE     : int  6 6 6 6 6 6 6 7 7 7 ...
#  $ DATE_S2   : chr  "2019-01-28" "2019-02-22" "2019-03-24" "2019-05-18" ...
#  $ NDVI_avg  : num  0.877 0.895 0.879 0.912 0.908 ...
#  $ NDVI_sd   : num  0.0916 0.0808 0.0758 0.1175 0.1132 ...
#  $ NDVI_min  : num  -0.235 -0.1783 0.0844 -0.5666 -0.6093 ...
#  $ NDVI_max  : num  0.985 0.998 0.993 0.999 0.999 ...
#  $ MONTH     : int  1 2 3 5 7 8 9 11 12 12 ...
#  $ NDVI_ref  : num  0.823 0.823 0.823 0.823 0.823 ...

In my case, I search some operation for remove rows in data set, if NDVI_max+NDVI_min/2 is lower than NDVI_avg grouped by (ESPACAMENT,ESPECIE,IDADE) in the date (DATE_S2) before the actual date. An example for RES_all_files_better$STAND=="QUEBRACANGA012F":
# Original dataset:
              STAND    DATE_S2  NDVI_avg  NDVI_min  NDVI_max
...
208 QUEBRACANGA012F 2021-08-30 0.8748818 0.8238573 0.9072955
209 QUEBRACANGA012F 2021-11-08 0.5707210 0.2847520 0.8908801
210 QUEBRACANGA012F 2021-11-13 0.5515253 0.2275358 0.8940712
211 QUEBRACANGA012F 2021-12-28 0.5956103 0.2469136 0.9122636
212 QUEBRACANGA012F 2022-01-12 0.5952482 0.2084076 0.9031508
213 QUEBRACANGA012F 2022-01-22 0.5773518 0.2088580 0.8783236
214 QUEBRACANGA012F 2022-02-16 0.4246735 0.1674446 0.6224726
215 QUEBRACANGA012F 2022-02-26 0.4064463 0.1378491 0.6111995

#Final dataset:
              STAND    DATE_S2  NDVI_avg  NDVI_min  NDVI_max
...
208 QUEBRACANGA012F 2021-08-30 0.8748818 0.8238573 0.9072955

The lines 209 to 215 were removed because (NDVI_max+NDVI_min/2)=0.5878161 that is lower than NDVI_avg = 0.8748818 in last date 2021-08-30.
Please, any help with it?

A: We may need to filter on the min computed value ('new')
library(dplyr)
RES_all_files_better %>%
  # convert to `Date` class and create a sequence column for checking
  mutate(rn = row_number(), DATE_S2 = as.Date(DATE_S2)) %>%
  # grouped by columns
  group_by(ESPACAMENT,ESPECIE,IDADE) %>%
  # create computed column
  mutate(New = (NDVI_max+NDVI_min/2)) %>%
  # filter the rows where the NDVI_avg is greater than the minimum value
  filter(NDVI_avg > min(New)) %>%
  ungroup #%>%
  # select(-rn, -New)

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to access data in a promise angularjs I wanted to access a data in promise. I have the following code :
function getUser() {
Users.query({username: usersOnline}).$promise.then(function (results) {
  console.log(results);
    $scope.userss = results;
    return results;
  }, function(error) {
  // console.log(error);
   //$scope.meetups = [];
});
//$scope.userss[0].username='oui';
}
$scope.lol=getUser();
$scope.lol.then(function(user){
console.log(user.username);
});

But i get an error saying cant find property then of undefined can you help

A: Return Users.query promise from getUser user function, as caller function is performing .then(expecting promise) there.
function getUser() {
//return promise here
    return Users.query({username: usersOnline}).$promise
    //other code as is

}


text:
Q: How do I interpret the credibility interval in a Bayesian Regularized Regression? A penalized regression provides biased estimates of the regression coefficients (bias-variance trade-off principle).  Therefore, standard errors and confidence intervals are regarded as not very meaningful for those biased estimates arising from (frequentist) penalized regression method, see e.g. the discussion Estimating R-squared and statistical significance from penalized regression model
. I would assume that the same problems exists in an Bayesian approach  but Kyung, Gill, Ghaosh and Casella (2010) say that the Bayesian formulation produces valid standard errors. Does it mean that a 95% credibility intervals includes with 95% probability the true biased estimate and if yes, is this a useful information?


text:
Q: String addition or subtraction operators How to add or subtract the value of string? For example:
    std::string number_string;
    std::string total;

    cout << "Enter value to add";
    std::getline(std::cin, number_string;
    total = number_string + number_string;
    cout << total;

This just append the string so this won't work. I know I can use int data type but I need to use string.

A: You can use atoi(number_string.c_str()) to convert the string to an integer.
If you are concerned about properly handling non-numeric input, strtol is a better choice, albeit a little more wordy. http://www.cplusplus.com/reference/cstdlib/strtol/

A: You will want to work with integers the entire time, and then convert to a std::string at the very end.
Here is a solution that works if you have a C++11 capable compiler:
#include <string>

std::string sum(std::string const & old_total, std::string const & input) {
    int const total = std::stoi(old_total);
    int const addend = std::stoi(input);
    return std::to_string(total + addend);
}

Otherwise, use boost:
#include <string>
#include <boost/lexical_cast.hpp>

std::string sum(std::string const & old_total, std::string const & input) {
    int const total = boost::lexical_cast<int>(old_total);
    int const addend = boost::lexical_cast<int>(input);
    return boost::lexical_cast<std::string>(total + addend);
}

The function first converts each std::string into an int (a step that you will have to do, no matter what approach you take), then adds them, and then converts it back to a std::string. In other languages, like PHP, that try to guess what you mean and add them, they are doing this under the hood, anyway.
Both of these solutions have a number of advantages. They are faster, they report their errors with exceptions rather than silently appearing to work, and they don't require extra intermediary conversions.
The Boost solution does require a bit of work to set up, but it is definitely worth it. Boost is probably the most important tool of any C++ developer's work, except maybe the compiler. You will need it for other things because they have already done top-notch work solving many problems that you will have in the future, so it is best for you to start getting experience with it. The work required to install Boost is much less than the time you will save by using it.


text:
Q: How to prevent pasting over validation drop down cell in Excel VBA I need to stop the user from pasting over my validation drop down cell. I have read and tried various solutions, none of which work just right. This code I have checks if the pasted value follows validation rules, but it doesn't work if the entire cell is pasted over my validation cell (it seems that this event fires after the paste, so the validation gets erased together with the previous cell):
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cell As Range
For Each Cell In Range("D2:F13")
    If Not Cell.Validation.Value Then
        MsgBox "Value violates validation rule"
        Application.Undo
        Exit Sub
    End If
Next

Ideally the code would check if the value of the cell that's being pasted matches validation dropdown options and only allows to paste the value (not the formatting) into the cell.
Thanks!

A: You can disable the Cut\Copy in the specific cell:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    ' TARGET IS YOUR VALIDATION CELL
    If Target.Column = 1 And Target.Row = 1 Then
        Application.CutCopyMode = False
    End If
End Sub

Or more complex you can try to check the clipboard of the user on SelectionChange
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

    ' TARGET IS YOUR VALIDATION CELL
    If Target.Column = 1 And Target.Row = 1 Then

        Set MyData = New DataObject
        MyData.GetFromClipboard

        'In MyData.GetText you have the clipboard data in text format
        If MyData.GetText <> "what you want" then
            '...
        End if

    End If
End Sub

In this case you must add a reference to Microsoft Forms 2.0 Object Library. You can find it in this path: C:\Windows\System32\FM20.DLL


text:
Q: What is wrong with my && operator? I would like to know why this is outputting false when I input 1982. Is there something wrong with my && statement?  I tried using !(t==r), but it didn't work; for some reason, it keeps outputting false.
  def no_repeats?(year)
   out=true
   t=0
   while t<4
     r=0
     while r<4
       if (year[t] == year[r]) && t != r
         out=false
       end
         r+=1

      end
      t+=1
   end

   out
  end

A: You're probably complicating this a bit more than it needs to be.
2.2.0-preview1 :001 > load 'no_repeat.rb'
 => true

Testing as a string
2.2.0-preview1 :002 > no_repeats?("1981")
 => false
2.2.0-preview1 :003 > no_repeats?("1983")
 => true

Testing as an integer
2.2.0-preview1 :004 > no_repeats?(1981)
 => false
2.2.0-preview1 :005 > no_repeats?(1983)
 => true

and no_repeat.rb looks like
  def no_repeats?(year)
    digits = year.to_s.split(//)
    digits.size == digits.uniq.size
  end

Edit: Benchmarks
Using Original Post

real    0m0.598s
user    0m0.583s
sys     0m0.015s

Using .split(//)

real    0m1.322s
user    0m1.321s
sys     0m0.000s

Using .chars.to_a

real    0m0.562s
user    0m0.557s
sys     0m0.004s

So, in efforts to make this more of a complete answer, I've included my benchmarks, each using the method 400,000 times. By using split(//), you will be taking almost a 2x performance hit. By using chars.to_a instead, you'll be up with your original speeds.
def no_repeats?(year)
  digits = year.to_s.chars.to_a
  digits.size == digits.uniq.size
end


text:
Q: How to send an email from an HTML Elementor form I created a form using the HTML Snippets component from Elementor in Wordpress, and now i want to send the data to another .php file to send an email with it, but Wordpress keeps telling me the following:

Failed to open stream: No such file or directory in C:\xampp\htdocs\personalpage\wp-content\send-email.php

Any other way i can send an email with the form data?

A: I suggest you to create your custom shortcode in your child theme file functions.php
<?php
add_shortcode('my_form', 'my_form_callback'); // Use this sortcode in your WordPress page
function my_form_callback($atts) {

    return '
      <form action="' . get_stylesheet_directory_uri() . $atts['link'].'" method="post" enctype="multipart/form-data" accept-charset="utf-8">
        <input>
        ...
      </form>';
}

Then use your shortcode [my_form link="/send-email.php"], your file send-email.php should be in the same paste of functions.php or edit the action="' . get_stylesheet_directory_uri() . $atts['link'].'" removing and insert the correct local.


text:
Q: How do I preserve the frame of a UIScrollView upon entering foreground? This question discusses how to create gaps between views in a UIScrollView. The agreed method is to increase the width of UIScrollView's frame to create gaps between the views which will be scrolled past. However when the scroll view is a subview of a UINavigationController an issue arises. The UINavigationController changes the frame of the UIScrollView after it has been set up in -viewDidLoad. The solution proposed is to alter the frame size in -viewDidAppear, at which point UINavigationController has finished changing things and the alterations will stick.
- (void)viewDidAppear:(BOOL)animated {
    CGRect frame = self.view.frame;
    frame.size.width += 20; // This gives a 20px gap width
    self.view.frame = frame;
}

I've been using this in my application and it has been working fine, but I run into problems when the app is sent to the background and then retrieved again. It seems that UINavigationController changes the frame once again, resetting it to the default width, but this time -viewDidAppear is not called and so the alteration is never made. I've tried registering for UIApplicationWillEnterForegroundNotification and UIApplicationDidBecomeActiveNotification but both of these seem to occur before UINavigationController changes things, so altering the frame at this point has no effect.
At what point should I try to change the frame size such that it will stick, or can I somehow prevent UINavigationController from altering the frame in the first place?
EDIT:
So I subclassed UIScrollView and found that a method called [UIViewControllerWrapperView setFrame:] is being called which is in turn calling my subclass's -setFrame: method to set the frame size. I don't know what UIViewControllerWrapperView is or does and I'm not sure it is going to be possible to jump in after it has done its thing and set the frame size properly. I will continue to investigate.

A: I solved this problem by making the UIScrollView a subview of my View Controller's view. As a result, the UINavigationController leaves the UIScrollView alone and the frame is preserved. This also had the added benefit of allowing me to apply the padding in the same method I use to set up the scroll view, instead of later on in -viewDidLoad.
So in summary, I've done this:
CGRect frame = CGRectMake(0, 0, 320, 460);
scrollView = [[UIScrollView alloc] initWithFrame:frame];

// I do some things with frame here

CGRect f = scrollView.frame;
f.size.width += PADDING; // PADDING is defined as 20 elsewhere
scrollView.frame = f;

[self.view addSubview:scrollView];

A: Try doing it in viewDidLayoutSubviews.  If that doesn't work, I would subclass the UIScrollView and override setFrame to add the required gap.


text:
Q: SQL While Loop takes way too long After days of searching the internet for an answer and trying to improve this myself I have finally decided to ask for help.
I receive a flat file each day from a client that contains about 1.1 million rows of data. I import this data into a staging database with SSIS (SQL Server 2012). This takes only a few seconds. The data is basically appointment information.
There are several fields in the flat file but the ones I have to use to synchronize the reporting table are called:
UpdateType - contains either INSERT, UPDATE or DELETE.
ChangeDate - Date time-stamp of when the row changed.
UniqueKey - UniqueKey + ChangeDate create a unique key for the row
The requirements from the client are that I either INSERT, UPDATE or DELETE the row from the reporting database in the order of the ChangeDate by UniqueKey. I could not figure out how to do this in a set so I created a while loop which takes over 20 hours to run which is way too long.
Here is an example of the flat file data I receive:

UpdateType   UniqueKey   ChangeDate              MoreDate
INSERT       27244595    2013-09-24 08:51:48.367 synchronize data follows
DELETE       27244595    2013-09-25 10:15:08.433 synchronize data follows
INSERT       27244595    2013-09-25 10:15:09.990 synchronize data follows
DELETE       27244595    2013-09-25 15:02:36.287 synchronize data follows
INSERT       27244595    2013-09-25 15:02:36.610 synchronize data follows

As you can see the same record was inserted then deleted many times but this isn't always the case. In this example data, only the last record should appear in the reporting database table, 1 appointment is scheduled.
Here is another example from the same flat file:

UpdateType   UniqueKey   ChangeDate              MoreDate
INSERT       28243572    2013-09-25 10:15:08.610 synchronize data follows
INSERT       28243572    2013-09-25 10:15:09.880 synchronize data follows
DELETE       28243572    2013-09-25 14:01:36.210 synchronize data follows
INSERT       28243572    2013-09-25 14:02:37.287 synchronize data follows

In this example the first and last record should appear in the reporting database table. There are 2 appointments scheduled. There are other times when an update in in the mix.
I don't create the reports and have no idea what they look like.
Here is the code I wrote to synchronize the reporting database from the staging database. If you have any suggestions on how to improve this process I welcome them and appreciate the help.
DECLARE --DECLARE SOME VARIABLES TO USE IN THE LOOP
 @UPDATETYPE VARCHAR(6) --THIS WILL BE INSERT, DELETE OR UPDATE
,@KEY INTEGER --THIS IS THE UNIQUEKEY
,@CHANGEDATE DATETIME --THIS IS THE CHANGE DATE FROM THE FLATFILE

--START A WHILE LOOP TO GO ROW BY ROW
WHILE (SELECT COUNT(*) FROM STAGEDB.DBO.APPIONTMENTCHANGE) > 0
    BEGIN

SELECT @UPDATETYPE = (SELECT TOP 1 [UPDATETYPE] FROM STAGEDB.DBO.APPIONTMENTCHANGE
            ORDER BY [UNIQUEKEY], [CHANGEDATE]) --GET THE UPDATE TYPE FOR THE IF STATEMENTS

SELECT @KEY = (SELECT TOP 1 [UNIQUEKEY] FROM STAGEDB.DBO.APPIONTMENTCHANGE
         ORDER BY [UNIQUEKEY], [CHANGEDATE]) --GET THE KEY

SELECT @CHANGEDATE = (SELECT TOP 1 [CHANGEDATE] FROM STAGEDB.DBO.APPIONTMENTCHANGE
            ORDER BY [UNIQUEKEY], [CHANGEDATE]) --GET THE CHANGEDATE

--IF THIS ROW IS AN INSERT THEN COMPLETE THIS ON THE REPORT DATABASE
IF @UPDATETYPE = 'INSERT'
BEGIN
 INSERT INTO [REPORTDB].[DBO].[APPOINTMENT]
            ([REPORTDB].[DBO].[APPOINTMENT].[UNIQUEKEY]
            ,[REPORTDB].[DBO].[APPOINTMENT].[APPOINTMENT]
            ,[REPORTDB].[DBO].[APPOINTMENT].[CLIENTLEADBK]
            ,[REPORTDB].[DBO].[APPOINTMENT].[FIRSTNAME]
            ,[REPORTDB].[DBO].[APPOINTMENT].[LASTNAME]
            ,[REPORTDB].[DBO].[APPOINTMENT].[PHONENUMBER]
            ,[REPORTDB].[DBO].[APPOINTMENT].[PHONENUMBER2]
            ,[REPORTDB].[DBO].[APPOINTMENT].[PHONENUMBER3]
            ,[REPORTDB].[DBO].[APPOINTMENT].[PHONENUMBER4]
            ,[REPORTDB].[DBO].[APPOINTMENT].[ADDRESSSTREET]
            ,[REPORTDB].[DBO].[APPOINTMENT].[ADDRESSCITY]
            ,[REPORTDB].[DBO].[APPOINTMENT].[ADDRESSSTATE]
            ,[REPORTDB].[DBO].[APPOINTMENT].[ADDRESSZIP]
            ,[REPORTDB].[DBO].[APPOINTMENT].[ADDRESSCOUNTRY])
SELECT TOP 1 [UNIQUEKEY]
            ,[APPOINTMENT]
            ,[CLIENTLEADBK]
            ,[FIRSTNAME]
            ,[LASTNAME]
            ,[PHONENUMBER]
            ,[PHONENUMBER2]
            ,[PHONENUMBER3]
            ,[PHONENUMBER4]
            ,[ADDRESSSTREET]
            ,[ADDRESSCITY]
            ,[ADDRESSSTATE]
            ,[ADDRESSZIP]
            ,[ADDRESSCOUNTRY]
        FROM [STAGEDB].[DBO].[APPIONTMENTCHANGE]
    ORDER BY [UNIQUEKEY], [CHANGEDATE];

--ONCE THE INSERT IS COMPLETED THEN DELETE THE ALREADY WORKED RECORD FROM THE STAGING DATABASE
DELETE FROM [STAGEDB].[DBO].[APPIONTMENTCHANGE]
WHERE [UNIQUEKEY] = @KEY AND [CHANGEDATE] = @CHANGEDATE;

END

--IF THE ROW IS A DELETE REQUEST THEN COMPLETE THIS ON THE REPORT DATABASE
IF @UPDATETYPE = 'DELETE'
BEGIN

DELETE FROM [REPORTDB].[DBO].[APPOINTMENT]
WHERE [UNIQUEKEY] = @KEY AND [CHANGEDATE] = @CHANGEDATE;

--ONCE THE DELETE IS COMPLETED THEN DELETE THE ALREADY WORKED RECORD FROM THE STAGING DATABASE
DELETE FROM [STAGEDB].[DBO].[APPIONTMENTCHANGE]
WHERE [UNIQUEKEY] = @KEY AND [CHANGEDATE] = @CHANGEDATE;

END

--IF THE ROW IS A UPDATE REQUEST DO THAT
IF @UPDATETYPE = 'UPDATE'
BEGIN

    UPDATE [REPORTDB].[DBO].[APPOINTMENT]
       SET [REPORTDB].[DBO].[APPOINTMENT].[APPOINTMENT] = B.[APPOINTMENT]
      ,[REPORTDB].[DBO].[APPOINTMENT].[CLIENTLEADBK] = B.[CLIENTLEADBK]
      ,[REPORTDB].[DBO].[APPOINTMENT].[FIRSTNAME] = B.[FIRSTNAME]
      ,[REPORTDB].[DBO].[APPOINTMENT].[LASTNAME] = B.[LASTNAME]
      ,[REPORTDB].[DBO].[APPOINTMENT].[PHONENUMBER] = B.[PHONENUMBER]
      ,[REPORTDB].[DBO].[APPOINTMENT].[PHONENUMBER2] = B.[PHONENUMBER2]
      ,[REPORTDB].[DBO].[APPOINTMENT].[PHONENUMBER3] = B.[PHONENUMBER3]
      ,[REPORTDB].[DBO].[APPOINTMENT].[PHONENUMBER4] = B.[PHONENUMBER4]
      ,[REPORTDB].[DBO].[APPOINTMENT].[ADDRESSSTREET] = B.[ADDRESSSTREET]
      ,[REPORTDB].[DBO].[APPOINTMENT].[ADDRESSCITY] = B.[ADDRESSCITY]
      ,[REPORTDB].[DBO].[APPOINTMENT].[ADDRESSSTATE] = B.[ADDRESSSTATE]
      ,[REPORTDB].[DBO].[APPOINTMENT].[ADDRESSZIP] = B.[ADDRESSZIP]
      ,[REPORTDB].[DBO].[APPOINTMENT].[ADDRESSCOUNTRY] = B.[ADDRESSCOUNTRY]
      FROM [REPORTDB].[DBO].[APPOINTMENT]
INNER JOIN [STAGEDB].[DBO].[APPIONTMENTCHANGE] B
        ON [REPORTDB].[DBO].[APPOINTMENT].[UNIQUEKEY] = B.[UNIQUEKEY]
     WHERE [REPORTDB].[DBO].[APPOINTMENT].[UNIQUEKEY] = @KEY;

--ONCE THE UPDATE IS COMPLETED THEN DELETE THE ALREADY WORKED RECORD FROM THE STAGING DATABASE
DELETE FROM [STAGEDB].[DBO].[APPIONTMENTCHANGE]
WHERE [UNIQUEKEY] = @KEY AND [CHANGEDATE] = @CHANGEDATE;
END
    END

I would much rather have all the files that need inserted, all that need deleted and all that should be updated not every record change that occurred but this is what I have to work with right now.
All serious ideas for improvements are appreciated. Please provide as much explanation as you can.

A: Use normal sql commands.  First the insert
insert into realtable
(field1, field2, etc)
select field1, field2, etc
from stagingtable
where idfield in
(select idfield
from stagingtable
except
select idfield
from realtable)

updates
update r
set field1 = s.field1
, etc
from realtable r join stagingtable s on something
where whatever

deletions
delete from reatable
where idfield in
(select idfield
from staging table
where you want the record deleted from the real table)


text:
Q: Upgrade mid 2011 27" iMac: replace Superdrive with SSD and create Fusion drive? Are there any caveats when removing the Superdrive from a mid 2011 27" iMac and replacing it with an SSD?
Which SSD should I buy? Is there maybe an installation kit somebody has already installed successfully?
My intention is to combine the SSD and the existing HDD into a Fusion drive.

A: Be carefull when working on an imac and ensure you have the correct tools - corrct size Torx drivers and a suction cup or two to remove the glass safely. Also use iFixit for a guide on how to do this such as https://www.ifixit.com/Guide/iMac+Intel+27-Inch+EMC+2309+and+2374+Optical+Drive+Replacement/1637
I would suggest a superdrive HDD enclosure. You will need a 12.7mm one such as: http://www.amazon.co.uk/adapter-caddy-Apple-iMac-slot-/dp/B00C0NU1TU/ref=sr_1_1?ie=UTF8&qid=1415181905&sr=8-1&keywords=imac+superdrive+enclosure They are around £10-£25.
Ensure that you remove the optical drive thermal sensor and replace it back onto the SSD.
As far as SSD choice I have used Crucial, Samsung and OCZ. The Samsung evo series are very good speed over price.
I would also suggest moving your mac os install to the ssd and using the normal HDD as storage, this will improve speed.


text:
Q: How to check with Jquery if image element exists in DOM based on src attribute? I have some preview images that can be zoomed.
If user clicks "zoom", the image is cached:
var zoomImg = new Image();
      zoomImg.onload = function() {
      image.attr('src', zoomlist[currentFrame]);
   });

What I need to know, is how to check if the image is cached or not, to know if I should show the loader.

A: You can use attribute selector like this.
if($('img[src="imageSource"]').length){
     //Image is present
}

Note: This will find the img element in DOM and not cache.

A: You can check if an image is cached by checking it's complete and readystate properties.
var zoomImg = new Image();
zoomImg.src = zoomlist[currentFrame];
if (zoomImg.complete || zoomImg.readystate === 4) {
    image.attr('src', zoomlist[currentFrame])
}
else {
    showLoader();
    zoomImg.onload = function() {
        hideLoader();
        image.attr('src', zoomlist[currentFrame]);
    });
}


text:
Q: How to find the closed form to the fibonacci numbers?
Possible Duplicate:
Prove this formula for the Fibonacci Sequence

How to find the closed form to the fibonacci numbers?
I have seen is possible calculate the fibonacci numbers without recursion, but, how can I find this formula? Where it come from?
Appreciate helps, thx.

A: The n-th Fibonacci number is given in closed form by
$$F_n=\frac{1}{\sqrt{5}}\left(\frac{1+\sqrt{5}}{2}\right)^n- \frac{1}{\sqrt{5}}\left(\frac{1-\sqrt{5}}{2}\right)^n $$

A: This is probably the most expiated discussion of $n$-th term of Fibonacci series in world wide web.


text:
Q: Docker container to run UDP multicast to outside world I would like to send UDP multicast from my docker container which runs on linux machine.
I failed to see the UDP multicast packets on my other machine in the network.
I tried to use --net=host when I run the docker container and it worked, but I would rather not to do that only because my multicast packets.
Is it possible to expose ports for doing it?
Is it possible to create another network for multicast only (somehow?)
Do you know about any another solution here?
Thanks.

A: You can use macvlan network as in the following code:
docker network create -d macvlan --subnet=192.168.10.0/24 --gateway=192.168.10.1 -o parent=eno1 myvHome


text:
Q: File icon not updated after installation of dreamweaver cs5 After I installed Dreamweaver cs5 the php was not associated with it. I changed the default program to open php file to Dreamweaver but even after that the ICON is still comming of notepad. I even tried to change the icon but couldn't locate the Dreamweaver php file icon

A: Without any information I can't do much.
I'd try rebuilding your icon cache: http://www.intowindows.com/how-to-rebuild-icon-cache-in-windows-7-to-repair-icons/.


text:
Q: Nginx requires port 433 on URL I'm trying to setup Nginx to work with SSL. When I visit the home page, the webserver tells me the page is not available. But when I add the port 433 on the URL, it just works. What should I do to not require the port 433 on the URL?
    server {
            ssl on;
            listen 433 ssl;
            ssl_certificate /etc/ssl/certs/ssl-bundle.crt;
            ssl_certificate_key /etc/ssl/private/server.key;

            server_name mywebsite.com;
            access_log on;

            location / {
                    proxy_pass http://0.0.0.0:8001;
                    proxy_set_header X-Forwarded-Host $server_name;
                    proxy_set_header X-Real-IP $remote_addr;
                    proxy_set_header X-Forwarded-Protocol $scheme;
            }
    }

A: Standard port for SSL is 443, not 433.


text:
Q: The request was denied by service delegate (PBProcessManager) for reason: Security I developed the app for Android TV and Apple TV in React Native. The app is running fine with Android TV. But when I try to run in Apple TV, I get below error:
Installing build/Build/Products/Debug-iphonesimulator/com.xxxx.app
Launching org.reactjs.native.example.xxxx
org.reactjs.native.example.xxxx: -1
An error was encountered processing the command (domain=FBSOpenApplicationServiceErrorDomain, code=1):
The request to open "org.reactjs.native.example.xxxx" failed.
The request was denied by service delegate (PBProcessManager) for reason: Security ("PBD] Denying open-application request for reason: Security (App 'org.reactjs.native.example.xxxx' looks unsafe for use on the internet; <PBApplicationInfo: 0x7f8995e02cd0; org.reactjs.native.example.xxxx (Demo Tv); sdk: 11.4>").
Underlying error (domain=FBSOpenApplicationErrorDomain, code=3):
        The operation couldn't be completed. [PBD] Denying open-application request for reason: Security (App 'org.reactjs.native.example.xxxx' looks unsafe for use on the internet; <PBApplicationInfo: 0x7f8995e02cd0; org.reactjs.native.example.xxxx (Demo Tv); sdk: 11.4>)
        [PBD] Denying open-application request for reason: Security (App 'org.reactjs.native.example.xxxx' looks unsafe for use on the internet; <PBApplicationInfo: 0x7f8995e02cd0; org.reactjs.native.example.xxxx (Demo Tv); sdk: 11.4>)

What I tried:

*

*Clean Project

*Edit scheme from iPhone to TV (Product > Scheme > Edit Scheme)

*Removed ios/build folder

To run the app I used react-native run-ios --simulator "Apple TV 4K" command from the terminal.
React Native version is 0.55.2
Xcode version is 9.4


text:
Q: WPF ComboBox ItemTemplateSelector.Selecttemplate is never called Based on this answer I tried to use the following code to achieve a ComboBox with different templates depending on whether or not the drop down is open.
The ComboBox definition looks like this:
<ComboBox SelectedValuePath="Id"
          DisplayMemberPath="Name">
    <ComboBox.Resources>
        <DataTemplate x:Key="SelectedTemplate">
            <TextBlock Text="Abbreviation" />
        </DataTemplate>

        <DataTemplate x:Key="DropDownTemplate">
            <ContentControl Content="{Binding}">
                <ContentControl.Style>
                    <Style TargetType="{x:Type ContentControl}">
                        <Setter Property="ContentTemplate">
                            <Setter.Value>
                                <DataTemplate>
                                    <Grid Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Border}}, Path=ActualWidth, Mode=OneTime}">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*" />
                                            <ColumnDefinition Width="20" />
                                        </Grid.ColumnDefinitions>

                                        <TextBlock Grid.Column="0"
                                                   Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ComboBox}}, Path=DisplayMemberPath}" />
                                        <TextBlock Grid.Column="1"
                                                   Text="Abbreviation" />
                                    </Grid>
                                </DataTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </ContentControl.Style>
            </ContentControl>
        </DataTemplate>

        <infrastructure:ComboBoxItemTemplateSelector x:Key="ComboBoxItemTemplateSelector"
                                                 DropDownDataTemplate="{StaticResource DropDownTemplate}"
                                                 SelectedDataTemplate="{StaticResource SelectedTemplate}" />
    </ComboBox.Resources>
</ComboBox>

and the ComboBoxItemTemplateSelector looks like this:
public class ComboBoxItemTemplateSelector : DataTemplateSelector
{
    public DataTemplate DropDownDataTemplate { get; set; }
    public DataTemplate SelectedDataTemplate { get; set; }

    public override DataTemplate SelectTemplate(object item, DependencyObject container)
    {
        return DependencyObjectHelper.GetVisualParent<ComboBoxItem>(container) != null ? this.DropDownDataTemplate : this.SelectedDataTemplate;
    }
}

Now the problem is that somehow SelectTemplate is never called, even although I checked all the DynamicResources and StaticResources.

A: You need to assign the ComboBoxItemTemplateSelector to the ComboBox like this:
<ComboBox ItemTemplateSelector="{DynamicResource ComboBoxItemTemplateSelector}">

and you cannot set the DisplayMemberPath or the SelectTemplate method will never be called.


text:
Q: Do I have to buy ESO for Xbox One if I already own it for PC? I own The Elder Scrolls Online for PC and want to switch to Xbox One.
Do I have to buy an Xbox One specific copy of the game or can I activate the game on Xbox One with my PC key?

A: Yes, you have to buy it on every platform you want to play.


text:
Q: What would I use to distribute power in my project? I want to power 10 SG90 servos, which each operate at 4.8v or 6v and need over 1 amp in order to start and use 700ma max during operation (I think). When I look at a kit like this (https://www.amazon.com/gp/product/B073ZC68QG/) on Amazon, it says one of the questions is as follows:
Question:What is the maximum current rating on the power supply module?
Answer:The Power Supply Module Maximum Output Current: < 700ma
Does that mean each servo will only get under 700ma and not be able to start? If so, what tool should I use to distribute power to parts in my robot?

A: I would start by looking at 10 suitable relays,or solid state devices, rated for the task.
Then I would be sourcing a power supply that can deliver 4.8V or 6V at the max load ie that would be assuming all 10 starting at the same time as you always consider the worst or most difficult scenario.

A: For your power suipply look for a 50 to 60W desktop power supply.
eg: https://nz.rs-online.com/web/p/desktop-power-supplies/2008934/
Shop around, that price isn't particularly good.
depending on how many servos are active at any time a less powerful power supply may work.


text:
Q: Sorting array of objects by ISO date I have this array of objects:
let a =
[{
  fecha: '2022-10-28',
  txt: 'some text',
},{
  fecha: '2022-10-26',
  txt: 'some text',
},{
  fecha: '2022-10-27',
  txt: 'some text',
}]

If I try this, it returns the array untouched:
a.sort((c,d) => c.fecha > d.fecha)

Even though, this test throws a boolean:
a[0].fecha > a[1].fecha // true

I don't understand.

A: Sort functions (see the manual) should return a number which is negative, positive or 0 dependent on whether the first value is less than, greater than, or equal to the second.
Sort operates in place so there is no need to assign the output.
Since your dates are in ISO format, you can safely sort them as strings with localeCompare:

let a = [{
  fecha: '2022-10-28',
  txt: 'some text',
}, {
  fecha: '2022-10-26',
  txt: 'some text',
}, {
  fecha: '2022-10-27',
  txt: 'some text',
}]

a.sort((a, b) => a.fecha.localeCompare(b.fecha))

console.log(a)

A: Hope this is what you need, just add Date.parse() it becomes (timestamp)

 let a = [
        {
          fecha: "2022-10-27",
          txt: "some text"
        },
        {
          fecha: "2022-10-28",
          txt: "some text"
        },
        {
          fecha: "2022-10-26",
          txt: "some text"
        }
      ];

      a.sort((a, b) => Date.parse(b.fecha) - Date.parse(a.fecha));

      console.log(a);


text:
Q: Blend 4 Change Window State using GoToStateAction behavior from within an ItemTemplate I've been trying to get this working for a few hours now.
I have a Listbox control with items from a database in it. I have 2 window states, "default", and "details". I'd like to use the GoToStateAction behavior in the ItemTemplate so that when any item in the listbox is clicked it'll change the window state to "details".
I have been trying to set the TargetObject property of the behavior to the window, but I can't.
Am I missing something, or doing something wrong? Any help would be appreciated.

A: Have you tried TargetObject="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"?
You might want to change the type to something like {x:Type local:MyWindowType}.


text:
Q: Calculating the variation of an operator in two different ways Let
$$
H_{T}=\dot{x}^{I}\frac{\partial}{\partial \psi^{I}}T(x,\psi)
$$
and consider the transformation:
$$
x^{I}\mapsto x^{I}+i\epsilon\psi^{I}
\\
\psi^{I}\mapsto\psi^{I}-2\epsilon\dot{x}^{I}
$$
where $T$, $\epsilon$ and $\psi^{I}$ are fermionic and the $x^{I}$ are bosonic (note that $T$ need not commute with its derivatives, but will commute with the $x^{I}$'s and anticommute with the $\psi^{I}$'s).
I am having a really frustrating, but probably very simple issue. In short, I have calculated $\delta H_{T}$ for a specific $T$ in two different ways, and cannot reconcile the results.
To begin with, I derive a general form of $\delta H_{T}$. It is not hard to show that under the above transformation:
$$
\delta H_{T}
=
i\epsilon\left(
\dot{\psi}^{I}\frac{\partial T}{\partial \psi^{I}}
-
\dot{x}^{I}\frac{\partial T}{\partial x^{I}}
+
\psi^{J}\dot{x}^{I}\frac{\partial^{2}T}{\partial\psi^{I}\partial x^{J}}
\right).\tag{1}
$$
So far so good. I now want to take $T(x,\psi)=S(x)-\psi^{I}A_{I}(x)$, where $S$ is fermionic and $A_{I}$ is bosonic. Note that as with $T$ itself, $S$ and $A_{I}$ need not commute with each other or with their derivatives.
It is easy to show directly that with this choice,
$
H_{T}
=
-\dot{x}^{I}A_{I}
$, and so $$\delta H_{T}=-i\epsilon(\dot{\psi}^{I} A_{I}+\dot{x}^{I}\psi^{J}\partial_{J} A_{I}).$$  My issue is with verifying this calculation with the general result $(1)$. Plugging $T$ into $(1)$, we find:
$$
\delta H_{T}
=
-i\epsilon
\left(
\dot{\psi}^{I}A_{I}
+
\dot{x}^{I}\psi^{J}\partial_{J} A_{I}
\right)
-i\epsilon\dot{x}^{I}(\partial_{I} S-\psi^{J}\partial_{I} A_{J})
$$
Which clearly disagrees with my previous result. In fact, one result is $S$-dependent while the other is not! The only thing I can think of is that I have somehow made a mistake deriving $(1)$, but I have retried it many times with no luck. This is really frustrating and probably just a silly oversight, but I have spent many hours staring at this and would really appreciate some help.
EDIT:
I will now add some additional workings in response to Qmechanics's comment.
The second term in $(1)$ arose in my calculations as follows. Firstly, expanding $T$ in a truncating Taylor series shows that:
$$
\delta T = i\epsilon\psi^{I}\frac{\partial T}{\partial x^{I}}-2\epsilon\dot{x}^{I}\frac{\partial T}{\partial\psi^{I}}
$$
and so:
$$
\delta\left(\frac{\partial}{\partial\psi^{I}}T(x,\psi)\right)
=
-i\epsilon\frac{\partial T}{\partial x^{I}}
+
i\epsilon\psi^{J}\frac{\partial^{2}T}{\partial\psi^{I}\partial x^{J}}
+
2\epsilon\dot{x}^{J}\frac{\partial^{2}T}{\partial\psi^{I}\partial\psi^{J}}
$$
The term in question then arises from the $\dot{x}^{I}\delta\left(\frac{\partial}{\partial\psi^{I}}T(x,\psi)\right)$ term of $\delta H_{T}$.
One possibility that I am considering is that when calculating $\delta\left(\frac{\partial}{\partial\psi^{I}}T(x,\psi)\right)$, I need to somehow vary the differentiation variable at the same time, however this does not seem to make much sense.

A: I think your variation does not commute with the derivative $\frac{\partial}{\partial \psi}$. You've shown what happens if you take $H_T = S - \psi A$, do the derivative with respect to $\psi$, and then perform the variation. However if you do things in the opposite order (first vary and then differentiate) I think you get a term proportional to $\frac{\partial S}{\partial x}$. When you apply the variation to $S$, you'll get a term proportional to $i \epsilon \psi \frac{\partial S}{\partial x}$, which then survives when you hit it with $\frac{\partial}{\partial \psi}$. Therefore, I think the issue is simply that you have to be careful about the ordering of the variation and derivative when you calculate the general expression.


text:
Q: unused import statement in android studio and import is colored gray I'm new to android and I can't seemed to figure out what causes this error.
Im trying to experiment a text view or edit view where if you click the button, it will save the inputted text and display it on the text view once you return to the app.
The error prompt error: cannot find symbol variable textView and sometimes even error: cannot find symbol variable Connect.
Question:
why is it that textView got error even if I imported import android.widget.TextView;
Also, why is the import android.widget.TextView; is colored light gray?
below are the screenshots:
Import color to gray and
Compiler error
Here is my code
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.EditText;

public class MainActivity extends AppCompatActivity {

EditText textView;
Button button;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    textView = (EditText) findViewById(R.id.textView);
    button = (Button) findViewById(R.id.button);

    final SharedPreferences sharedPref = getPreferences(Connect.MODE_PRIVATE);
    String oldItem = sharedPref.getString("oldItem", "Nothing created yet...");

    textView.setText(oldItem);

    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            SharedPreferences.Editor editor = sharedPref.edit();
            editor.putString("oldItem", textView.getText().toString());
            editor.commit();
        }
    });
}
}

Update:
I din't add any ID on my EditText XML code thats why the machine cannot find it.
android:id="@+id/textView"

Also, I updated from this
final SharedPreferences sharedPref = getPreferences(Connect.MODE_PRIVATE);

to this
final SharedPreferences sharedPref = getPreferences(Context.MODE_PRIVATE);

I'm not really sure what's the difference between Connect and Context.
Thanks to @Kapil G

A: Problem is: You are not using TextView.
textView = (EditText) findViewById(R.id.textView);

=>
textView = (TextView) findViewById(R.id.textView);

Yes, EditText is a kind of TextView, but it seems that in your xml, it will be TextView. So, how about cast to TextView ?

A: Check you XML file to see if you have declared R.id.textView as TextView or Edittext.
Both are different. Your input field is your EditText and your output field where you want to show the data is TextView.
also not sure what you have declared as Connect. but SharedPreference need the mode from a Context so your line should be like this -
final SharedPreferences sharedPref = getPreferences(Context.MODE_PRIVATE);

Plus your import is coming as gray because you have not used TextView component anywhere in the activity.

A: It is simply nothing but unused.
If you think you need it keep it or else you can remove it.
Also most of the time imports are brought automatically so you dont have to worry.
If you want to bring imports simply just do:
Alt + Enter


text:
Q: TFS client QueryHistory - get the earliest changeset How shall I structure the arguments of versionControlServer QueryHistory to return the earliest changeset of a specified source location?
Perhaps, there is another way other than QueryHistory?

A: Query all changes in path returning 1 result, starting from lowest changeset.
http://msdn.microsoft.com/en-us/library/ff736442(v=vs.100).aspx
versionControlService.QueryHistory(
            path,
            VersionSpec.Latest,
            0,
            RecursionType.Full, //look into all subfolders
            null,
            null, //version from - first
            null, //version to - latest => all
            1, //Return at maximum 1 item
            boolIncludeChanges, // Include information on changes done
            false,
            boolIncludeDLInfo,
            true //sort ascending - C1, C2, .. CLatest
)


text:
Q: Pyinstaller, hidden -imports, WebSocketError I just run into an error that said "No module name socketio", after adding it to the hidden imports I get "No module name server" and after adding to the hidden imports socketio.server I get the new one and so on...
Is there another way to add every import my application needs?
However if I have to go this way, how can I add import:
 from .exceptions import WebSocketError, since geventwebsocket.exceptions.WebSocketError is not working.
[EDIT] Here is more informations.
My application works fine from PyCharm, after I create exe with Pyinstaller I get that error, I was doing research for adding imports that Pyinstaller did not caught and all I could find is to change .spec and to add to the hidden-imports what I need.
However I thought that adding geventwebsocket will be enough but as I said, now I get "Cannot import name WebSocketError ". So I guess my code is ok since it works perfectly before I created exe with Pyinstaller?
[EDIT] Here is my .spec:
# -*- mode: python -*-
a = Analysis(['manage.py'],
pathex=['C:\\path'],
hiddenimports=['greenlet', 'hid', 'flask_bootstrap',
'flask_socketio', 'blueprints',
'hidapi', 'pywin32', 'xlrd', 'flask_wtf',
'flask_sqlalchemy', 'cython',
'flask_login', 'nexus', 'antiorm', 'colorama',
'socket.error','config', 'cython',
'flask_script', 'init','py', 'requests',
'PyInstaller', 'pyDatalog', 'pytest',
 'yaml', 'terminal', 'virtualenv',
 'geventwebsocket.server',
 'gevent.server', 'socketio', 'socketio.server',
 'gevent.pywsgi',
 'gevent.baseserver','geventwebsocket.handler',
 'socketio.handler',
 'geventwebsocket.exceptions.WebSocketError',
 'socketio.transports',
 'socketio.exceptions.WebSocketError'],
  hookspath=None,
  runtime_hooks=None)

  pyz = PYZ(a.pure)
     exe = EXE(pyz,
      a.scripts,
      exclude_binaries=True,
      name='manage.exe',
      debug=False,
      strip=None,
      upx=True,
      console=True )

dict_tree = Tree('app', prefix = 'app')
dict_tree += Tree('.hg', prefix = '.hg')
dict_tree += Tree('.idea', prefix = '.idea')

coll = COLLECT(exe,
           a.binaries,
           dict_tree,
           a.zipfiles,
           a.datas,
           strip=None,
           upx=True,
           name='manage')

And error:
Traceback (most recent call last):
File "C:\Users\path\out00-PYZ.pyz\socketio.transports", line 4, in <module>
ImportError: cannot import name WebSocketError


text:
Q: How do I add class to the next li element and remove it form others? I am trying to add a class to the first list item on click of an anchor link. This first link, will not have the class of active onload.Then after that, onclick of the next  tag add the class of active to the next list item. However, it is selecting all list items and adding the class of active.

NEXT

$('.next').on('click', function() {
    $('ul li').next('li').addClass('active');
});

A: You can do the following (comments in code)

*

*update html so it starts with an active element

*get current active li

*check if active is last in list

*if it is make first active, if not make next active

$('.next').on('click', function() {
  var currentActive = $('li.active'); // get current active
  currentActive.removeClass('active'); // remove class active

  if (currentActive.is(':last-child')) {
    $('li').first().addClass('active'); // add class to first li if last child
  } else {
    currentActive.next('li').addClass('active'); // otherwise add active to next li
  }
});
.active {
  color: #ff0000;
}

start one li off as active otherwise the below won't work

some stuff

some stuff

NEXT

A: Try keeping the index in a variable:
var idx = 0;
var lis = $('ul').children();

$('.next').on('click', function(){
    if (idx + 1 === lis.length){
        idx = 0;
    } else {
        idx++;
    }

    for  (i = 0; i < lis.length; i++){
        if (i === idx){
            lis[i].addClass('active');
        } else {
            lis[i].removeClass('active');
        }
    }
}

A: Have a look:
$('.next').on('click', function() {
    var $activeEl = null;
    if($('ul li.active').length){
       //get the active element
       $activeEl = $('ul li.active');
    }
       //remove the active class
       $('ul li').removeClass('active');

       if($activeEl != null) // set the active class to the first element
          $('ul li:nth-child(1)').addClass('active');
       else        //set the active class to the next one
          $activeEl.next('li').addClass('active');
});

A: Hey Please check the following code and output I guess it will help you.

    $('.next').on('click', function() {
  var activeClass = $('li.active');
  if (activeClass.is(':last-child')) {
    $('li').first().addClass('active');
    $('li').last().removeClass('active');
  }
  else {
    $('ul li.active').next('li').addClass('active');
    $('ul li.active').prev('li').removeClass('active');
  }
});
.active {
  color: #0000ff;
  }

one

two

three

NEXT

A: Use eq with length using if condition like below.

$('body').on('click', '.next', function() {
  if ($('ul li.active').length == 0)
    $('ul li').eq(0).addClass('active');
  else
    $('ul li.active').removeClass('active').next('li').addClass('active');
});
.active {
  background-color: #666;
}

1

2

3

NEXT

A: You can use jQuery class selector to get current active li, modify it using removeClass and modify next li using addClass.
$('.next').on('click', function() {
    $('ul li.active').removeClass('active').next('li').addClass('active');
});


text:
Q: If $a,b < p$, then $p \nmid ab$? I'm trying to prove that if there two positive integers $a$ and $b$ such that they are less than a prime number $p$, then the product  $ab$ will not be divisible by $p$.
I know there must be multiple proofs involved to solve this one, but can you guys help me out? I don't even know like where to start!!

A: $p|ab \iff p|a$ or $p|b$.  However, since $a,b < p$, then $p \nmid a$ and $p \nmid b$.  Hence, $p \nmid ab$.

A: Suppose for contradiction that $ p | ab $, then by euclids theorem,  $ p | a $ or $p | b $. Suppose $a | p $ then there exists $k > 0$ such that $a = pk $ but $pk \geq p $. Hence $ a \geq p $. Similarly for $b$. This is a contradiction and the problem is solved.

A: you can write both $a$ and $b$ as a product of prime numbers, that is
$a= a_1 a_2 a_3 a_4...$
and
$b= b_1 b_2 b_3 b_4...$
where the $a_i$ and $b_i$ are prime numbers
if $a<p$ that implies that $a_i <p$ for all $i$, likewise $b<p$ implies that $b_i <p$ for all $i$
so
$ab=a_1 a_2 a_3 a_4...  b_1 b_2 b_3 b_4...$
and since $a_i <p$ and $b_i <p$, $p$ does not divide $ab$


text:
Q: Worker thread needs to access UI I'm using Visual Studio 2013 and programming in C++ / Xaml. I have a worker thread that splits off from the UI thread to do some calculations. I need this worker thread to be able to access components such as a TextBox or a ProgressBar on the user interface to do things like inform the user on its progress. After some research this is apparently way harder than I anticipated.

A: You may think the worker threads need to access the UI, but you should re-think that idea, it is a bad approach. You already found out that it is way harder than anticipated - look at this as an indicator that you may be on the wrong track.
The better way is to use indirection, i.e. to post a message, raise an event or signal a flag whenever there are new data available to display. The UI thread handles this and does whatever he needs to do when it is appropriate.
This way you leave room for future improvements, e.g. you may wish to replace the graphical UI by some other version (progress bar instead of a percent label) or a completely different UI later (think web-based, think service without own UI, etc).
Having a worker thread accessing controls directly ties your background worker code too closely to a concrete UI, which is nothing more than an arbitrary restriction that comes with no gain1). By using an indirection (this could be even an properly synchronized view model) you prevent this, making later changes a snap.

1 Who says YAGNI? You already need it, right now!


text:
Q: Cómo hacer consulta SQL con QuerySet de Django Tengo que hacer una aplicación que construya un reporte personalizado por el cliente mediante variables seleccionadas desde el lado del cliente. Estoy usando Django 1.11 con BD SQL Server
La cuestión es que necesito armar un Query en función a las variables seleccionadas para consultarlo con mis modelos y enviar una respuesta al template y no encuentro la manera de armar este tipo de Querys con los QuerySet de Django.
Una consulta a procesar sería algo así:
SELECT Gerente.nombre_gte, Local.codigo, Alta.fecha_carga, Alta.cantidad, Homologador.homologado
FROM reporteria_alta Alta
INNER JOIN reporteria_local Local ON Local.gerente_id = Alta.local_key_id
INNER JOIN reporteria_gerente Gerente ON Gerente.id = Local.gerente_id
INNER JOIN reporteria_produccion_plan Produccion ON Produccion.id = Alta.plan_key_id
INNER JOIN reporteria_plan Planes ON Planes.id = Produccion.plan_id
INNER JOIN reporteria_homologador Homologador ON Homologador.id = Planes.homologado_id

Pero no se como llevar esto a QuerySet y necesito alguna idea o colaboración.
Mis Modelos para el ejemplo son:
class Gerente(models.Model):
    nombre_gte = models.CharField(max_length=255)
    coordinador=models.ForeignKey(Coordinador,on_delete=models.CASCADE)
    activo=models.BooleanField(default=False)

    def __str__(self):

        return self.nombre_gte

class Local(models.Model):
    fecha =  models.DateField(auto_now_add=True)
    codigo = models.CharField(max_length=50)
    nombre_local = models.CharField(max_length=255)
    cc =  models.BooleanField(default=False)

    gerente=models.ForeignKey(Gerente,on_delete=models.CASCADE)
    region=models.ForeignKey(Region,on_delete=models.CASCADE)
    canal_venta=models.ForeignKey(Canal_Venta,on_delete=models.CASCADE)
    activo=models.BooleanField(default=False)

    def __str__(self):
        return self.codigo

class Homologador(models.Model):
    homologado=models.CharField(max_length=255)

    def __str__(self):
        return self.homologado

class Plan(models.Model):
    codigo_plan=models.CharField(max_length=20)
    nombre_plan=models.CharField(max_length=255)
    homologado=models.ForeignKey(Homologador,on_delete=models.CASCADE)

    def __str__(self):
        return self.nombre_plan

class Produccion_Plan(models.Model):
    fecha =  models.DateField()
    plan = models.ForeignKey(Plan,on_delete=models.CASCADE)
    renta_mensual = models.FloatField()
    recarga_plan = models.FloatField()

    def __str__(self):
        return self.plan

class Alta(models.Model):
    fecha_carga=models.DateField(auto_now_add=True)
    fecha_actividad=models.DateField()
    plataforma=models.CharField(max_length=30)
    tecnologia=models.CharField(max_length=30)
    cantidad=models.IntegerField()
    plan_key=models.ForeignKey(Produccion_Plan,on_delete=models.CASCADE,null=True)
    local_key=models.ForeignKey(Local,on_delete=models.CASCADE,null=True)

    def __str__(self):
        return "ALTA %s Descrp: CodVend=%s Tecnolg=%s " %(self.cantidad, self.local_key,self.tecnologia)

Alguna sugerencia?

A: el .query() lo que hace es mostrarte el código SQL que se esta ejecutando, con haacer lo siguiente ya se hará la consulta (nuestro amigo django se encarga):
locales = Local.objects.filter(fecha='15-01-2018')

ese código se encargara de  hacer las consultas necesarias y te devuelve los registros de los locales  que tengan esa fecha e incluye los datos de sus tablas relacionadas, lo unico que tendrás que hacer en enviar "locales" al template y dentro de un for acceder de la siguiente manera a los valores:
{% for local in locales %}
     {{local.nombre_local}}, {{local.gerente.nombre_gte}}, {{local.alta.plan_key.plan.plan_nombre}} <br>
{% endfor %}

con respecto al "plan" tengo dudas al estar a un tercer nivel relacional con respecto a local, pero prueba esto y si tienes problemas me escribes.
Saludos


text:
Q: Why do we usually create an index before dropping the primary key? I think the following is a standard coding "pattern" when we need to change the primary key of a table to serve better our queries via the index:
ALTER TABLE employees
  ADD UNIQUE INDEX tmp (employee_id, subsidiary_id);

ALTER TABLE employees
 DROP PRIMARY KEY;

ALTER TABLE employees
  ADD PRIMARY KEY (subsidiary_id, employee_id);

My understanding is that the tmp index is created before dropping the primary key in order to facilitate queries using the current primary key and not lose performance.
But I don't understand this.
When we execute an ALTER TABLE (I am referring to the ALTER TABLE to drop the primary key) the table will be locked until the operation finishes right?
So the queries will not be able to run anyway. So why create tmp in the first place?

A: I haven't seen this pattern.  But, I would expect it for a slightly different reason.  The purpose is less "facilitating" queries than ensuring that the pair of keys remains unique throughout the entire set of transactions.
In other words, between dropping the primary key and creating the new key, there is a short window of opportunity for someone to insert a duplicate pair of keys.  Then the second operation will fail.  By creating the unique index first, you prevent this from happening.
If you know there are no other users/queries using the system when you are modifying the table (say you are in single user mode), then there is no need to create the additional index.


text:
Q: I see an incorrect pid I have a problem in my script, when I want to save the pid, then the incorrect pid is saved to me.
I suspect that the pid script (start.sh) is written to me instead of the screen command.
echo "Trwa uruchamianie bota muzycznego..."
    if [ -e "$BINARYNAME" ]; then
        if [ ! -x "$BINARYNAME" ]; then
            echo "${BINARYNAME} is not executable, trying to set it"
            chmod u+x "${BINARYNAME}"
        fi
        if [ -x "$BINARYNAME" ]; then
            export LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}"
            screen -dmS "${BASENAME}" mono "${BINARYNAME}" > /dev/null &
            TEST=$0
            PID=$!
            echo "${PID}"
            ps -p ${PID} > /dev/null 2>&1
            if [ "$?" -ne "0" ]; then
                echo "Bot muzyczy nie został uruchomiony."
            else
                echo $PID > TS3AudioBot.pid
                echo "Bot muzyczny został uruchomiony."
            fi
        else
            echo "${BINARNAME} nie jest możliwy do wykrycia, nie można uruchomić bota muzycznego."
        fi
    else
        echo "Could not find binary, aborting"
        exit 5
    fi

A: I believe you were expecting to get the pid of a screen process in $PID.  What's happening is that screen exits immediately, and $! refers to the pid of the vanished screen process rather than the detached process that is running your mono command (if it's still running).
I substituted "sleep 2000 &" for "screen -dmS ${BASENAME}" mono ${BINARYNAME} >/dev/null &" in your script and the correct $PID, that of the sleep process, was saved in the variable and acted upon.  This doesn't happen with screen for the reason I described above.
You might want to consider processing the output of "screen -list" in order to get at the pid of the detached process:
root@tutorial:/var/tmp# screen -dmS 'sleeper' sleep 2000
root@tutorial:/var/tmp# screen -list
There is a screen on:
    7089.sleeper    (07/02/2018 04:05:57 AM)    (Detached)
1 Socket in /var/run/screen/S-root.

root@tutorial:/var/tmp# ps axlww | grep 7089
5     0  7089     1  20   0  25672  2396 poll_s Ss   ?          0:00 SCREEN -dmS sleeper sleep 2000
4     0  7090  7089  20   0   5808   648 hrtime Ss+  pts/0      0:00 sleep 2000
0     0  7093  2607  20   0  12728  2192 pipe_w S+   ttyS1      0:00 grep 7089

From here your script could grab the pid of the sleeper.


text:
Q: Azure ML: Upload File to Step Run's Output - Authentication Error During a PythonScriptStep in an Azure ML Pipeline, I'm saving a model as joblib pickle dump to a directory in a Blob Container in the Azure Blob Storage which I've created during the setup of the Azure ML Workspace. Afterwards I'm trying to upload this model file to the step run's output directory using
Run.upload_file (name, path_or_stream)

(for the function's documentation, see https://learn.microsoft.com/en-us/python/api/azureml-core/azureml.core.run(class)?view=azure-ml-py#upload-file-name--path-or-stream--datastore-name-none-)
Some time ago when I created the script using the azureml-sdk version 1.18.0, everything worked fine. Now, I've updated the script's functionalities and upgraded the azureml-sdk to version 1.33.0 during the process and the upload function now runs into the following error:
Traceback (most recent call last):
  File "/opt/miniconda/lib/python3.7/site-packages/azureml/_file_utils/upload.py", line 64, in upload_blob_from_stream
    validate_content=True)
  File "/opt/miniconda/lib/python3.7/site-packages/azureml/_restclient/clientbase.py", line 93, in execute_func_with_reset
    return ClientBase._execute_func_internal(backoff, retries, module_logger, func, reset_func, *args, **kwargs)
  File "/opt/miniconda/lib/python3.7/site-packages/azureml/_restclient/clientbase.py", line 367, in _execute_func_internal
    left_retry = cls._handle_retry(back_off, left_retry, total_retry, error, logger, func)
  File "/opt/miniconda/lib/python3.7/site-packages/azureml/_restclient/clientbase.py", line 399, in _handle_retry
    raise error
  File "/opt/miniconda/lib/python3.7/site-packages/azureml/_restclient/clientbase.py", line 358, in _execute_func_internal
    response = func(*args, **kwargs)
  File "/opt/miniconda/lib/python3.7/site-packages/azureml/_vendor/azure_storage/blob/blockblobservice.py", line 614, in create_blob_from_stream
    initialization_vector=iv
  File "/opt/miniconda/lib/python3.7/site-packages/azureml/_vendor/azure_storage/blob/_upload_chunking.py", line 98, in _upload_blob_chunks
    range_ids = [f.result() for f in futures]
  File "/opt/miniconda/lib/python3.7/site-packages/azureml/_vendor/azure_storage/blob/_upload_chunking.py", line 98, in <listcomp>
    range_ids = [f.result() for f in futures]
  File "/opt/miniconda/lib/python3.7/concurrent/futures/_base.py", line 435, in result
    return self.__get_result()
  File "/opt/miniconda/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/opt/miniconda/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/opt/miniconda/lib/python3.7/site-packages/azureml/_vendor/azure_storage/blob/_upload_chunking.py", line 210, in process_chunk
    return self._upload_chunk_with_progress(chunk_offset, chunk_bytes)
  File "/opt/miniconda/lib/python3.7/site-packages/azureml/_vendor/azure_storage/blob/_upload_chunking.py", line 224, in _upload_chunk_with_progress
    range_id = self._upload_chunk(chunk_offset, chunk_data)
  File "/opt/miniconda/lib/python3.7/site-packages/azureml/_vendor/azure_storage/blob/_upload_chunking.py", line 269, in _upload_chunk
    timeout=self.timeout,
  File "/opt/miniconda/lib/python3.7/site-packages/azureml/_vendor/azure_storage/blob/blockblobservice.py", line 1013, in _put_block
    self._perform_request(request)
  File "/opt/miniconda/lib/python3.7/site-packages/azureml/_vendor/azure_storage/common/storageclient.py", line 432, in _perform_request
    raise ex
  File "/opt/miniconda/lib/python3.7/site-packages/azureml/_vendor/azure_storage/common/storageclient.py", line 357, in _perform_request
    raise ex
  File "/opt/miniconda/lib/python3.7/site-packages/azureml/_vendor/azure_storage/common/storageclient.py", line 343, in _perform_request
    HTTPError(response.status, response.message, response.headers, response.body))
  File "/opt/miniconda/lib/python3.7/site-packages/azureml/_vendor/azure_storage/common/_error.py", line 115, in _http_error_handler
    raise ex
azure.common.AzureHttpError: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. ErrorCode: AuthenticationFailed
<?xml version="1.0" encoding="utf-8"?><Error>AuthenticationFailed<Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
RequestId:5d4e1b7e-c01e-0070-0d47-9bf8a0000000
Time:2021-08-27T13:30:02.2685991Z</Message><AuthenticationErrorDetail>Signature did not match. String to sign used was rcw
2021-08-27T13:19:56Z
2021-08-28T13:29:56Z
/blob/mystorage/azureml/ExperimentRun/dcid.98d11a7b-2aac-4bc0-bd64-bb4d72e0e0be/outputs/models/Model.pkl

2019-07-07
b

</AuthenticationErrorDetail></Error>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/mnt/batch/tasks/shared/LS_root/jobs/.../azureml-setup/context_manager_injector.py", line 243, in execute_with_context
    runpy.run_path(sys.argv[0], globals(), run_name="__main__")
  File "/opt/miniconda/lib/python3.7/runpy.py", line 263, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "/opt/miniconda/lib/python3.7/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/opt/miniconda/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "401_AML_Pipeline_Time_Series_Model_Training_Azure_ML_CPU.py", line 318, in <module>
    main()
  File "401_AML_Pipeline_Time_Series_Model_Training_Azure_ML_CPU.py", line 286, in main
    path_or_stream=model_path)
  File "/opt/miniconda/lib/python3.7/site-packages/azureml/core/run.py", line 53, in wrapped
    return func(self, *args, **kwargs)
  File "/opt/miniconda/lib/python3.7/site-packages/azureml/core/run.py", line 1989, in upload_file
    datastore_name=datastore_name)
  File "/opt/miniconda/lib/python3.7/site-packages/azureml/_restclient/artifacts_client.py", line 114, in upload_artifact
    return self.upload_artifact_from_path(artifact, *args, **kwargs)
  File "/opt/miniconda/lib/python3.7/site-packages/azureml/_restclient/artifacts_client.py", line 107, in upload_artifact_from_path
    return self.upload_artifact_from_stream(stream, *args, **kwargs)
  File "/opt/miniconda/lib/python3.7/site-packages/azureml/_restclient/artifacts_client.py", line 99, in upload_artifact_from_stream
    content_type=content_type, session=session)
  File "/opt/miniconda/lib/python3.7/site-packages/azureml/_restclient/artifacts_client.py", line 88, in upload_stream_to_existing_artifact
    timeout=TIMEOUT, backoff=BACKOFF_START, retries=RETRY_LIMIT)
  File "/opt/miniconda/lib/python3.7/site-packages/azureml/_file_utils/upload.py", line 71, in upload_blob_from_stream
    raise AzureMLException._with_error(azureml_error, inner_exception=e)
azureml._common.exceptions.AzureMLException: AzureMLException:
    Message: Encountered authorization error while uploading to blob storage. Please check the storage account attached to your workspace. Make sure that the current user is authorized to access the storage account and that the request is not blocked by a firewall, virtual network, or other security setting.
    StorageAccount: mystorage
    ContainerName: azureml
    StatusCode: 403
    InnerException Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. ErrorCode: AuthenticationFailed
<?xml version="1.0" encoding="utf-8"?><Error>AuthenticationFailed<Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
RequestId:5d4e1b7e-c01e-0070-0d47-9bf8a0000000
Time:2021-08-27T13:30:02.2685991Z</Message><AuthenticationErrorDetail>Signature did not match. String to sign used was rcw
2021-08-27T13:19:56Z
2021-08-28T13:29:56Z
/blob/mystorage/azureml/ExperimentRun/dcid.98d11a7b-2aac-4bc0-bd64-bb4d72e0e0be/outputs/models/Model.pkl

2019-07-07
b

</AuthenticationErrorDetail></Error>
    ErrorResponse
{
    "error": {
        "code": "UserError",
        "message": "Encountered authorization error while uploading to blob storage. Please check the storage account attached to your workspace. Make sure that the current user is authorized to access the storage account and that the request is not blocked by a firewall, virtual network, or other security setting.\n\tStorageAccount: mystorage\n\tContainerName: azureml\n\tStatusCode: 403",
        "inner_error": {
            "code": "Auth",
            "inner_error": {
                "code": "Authorization"
            }
        }
    }
}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "401_AML_Pipeline_Time_Series_Model_Training_Azure_ML_CPU.py", line 318, in <module>
    main()
  File "401_AML_Pipeline_Time_Series_Model_Training_Azure_ML_CPU.py", line 286, in main
    path_or_stream=model_path)
  File "/opt/miniconda/lib/python3.7/site-packages/azureml/core/run.py", line 53, in wrapped
    return func(self, *args, **kwargs)
  File "/opt/miniconda/lib/python3.7/site-packages/azureml/core/run.py", line 1989, in upload_file
    datastore_name=datastore_name)
  File "/opt/miniconda/lib/python3.7/site-packages/azureml/_restclient/artifacts_client.py", line 114, in upload_artifact
    return self.upload_artifact_from_path(artifact, *args, **kwargs)
  File "/opt/miniconda/lib/python3.7/site-packages/azureml/_restclient/artifacts_client.py", line 107, in upload_artifact_from_path
    return self.upload_artifact_from_stream(stream, *args, **kwargs)
  File "/opt/miniconda/lib/python3.7/site-packages/azureml/_restclient/artifacts_client.py", line 99, in upload_artifact_from_stream
    content_type=content_type, session=session)
  File "/opt/miniconda/lib/python3.7/site-packages/azureml/_restclient/artifacts_client.py", line 88, in upload_stream_to_existing_artifact
    timeout=TIMEOUT, backoff=BACKOFF_START, retries=RETRY_LIMIT)
  File "/opt/miniconda/lib/python3.7/site-packages/azureml/_file_utils/upload.py", line 71, in upload_blob_from_stream
    raise AzureMLException._with_error(azureml_error, inner_exception=e)
UserScriptException: UserScriptException:
    Message: Encountered authorization error while uploading to blob storage. Please check the storage account attached to your workspace. Make sure that the current user is authorized to access the storage account and that the request is not blocked by a firewall, virtual network, or other security setting.
    StorageAccount: mystorage
    ContainerName: azureml
    StatusCode: 403
    InnerException AzureMLException:
    Message: Encountered authorization error while uploading to blob storage. Please check the storage account attached to your workspace. Make sure that the current user is authorized to access the storage account and that the request is not blocked by a firewall, virtual network, or other security setting.
    StorageAccount: mystorage
    ContainerName: azureml
    StatusCode: 403
    InnerException Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. ErrorCode: AuthenticationFailed
<?xml version="1.0" encoding="utf-8"?><Error>AuthenticationFailed<Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
RequestId:5d4e1b7e-c01e-0070-0d47-9bf8a0000000
Time:2021-08-27T13:30:02.2685991Z</Message><AuthenticationErrorDetail>Signature did not match. String to sign used was rcw
2021-08-27T13:19:56Z
2021-08-28T13:29:56Z
/blob/mystorage/azureml/ExperimentRun/dcid.98d11a7b-2aac-4bc0-bd64-bb4d72e0e0be/outputs/models/Model.pkl

2019-07-07
b

</AuthenticationErrorDetail></Error>
    ErrorResponse
{
    "error": {
        "code": "UserError",
        "message": "Encountered authorization error while uploading to blob storage. Please check the storage account attached to your workspace. Make sure that the current user is authorized to access the storage account and that the request is not blocked by a firewall, virtual network, or other security setting.\n\tStorageAccount: verovisionstorage\n\tContainerName: azureml\n\tStatusCode: 403",
        "inner_error": {
            "code": "Auth",
            "inner_error": {
                "code": "Authorization"
            }
        }
    }
}
    ErrorResponse
{
    "error": {
        "code": "UserError",
        "message": "Encountered authorization error while uploading to blob storage. Please check the storage account attached to your workspace. Make sure that the current user is authorized to access the storage account and that the request is not blocked by a firewall, virtual network, or other security setting.\n\tStorageAccount: mystorage\n\tContainerName: azureml\n\tStatusCode: 403"
    }
}

As far as I can tell from the code of the azureml.core.Run class and the subsequent function calls, the Run object tries to upload the file to the step run's output directory using SAS-Token-Authentication (which fails). This documentation article is linked in the code (but I don't know if this relates to the issue): https://learn.microsoft.com/en-us/rest/api/storageservices/create-service-sas#service-sas-example
Did anybody encounter this error as well and knows what causes it or how it can be resolved?
Best,
Jonas

A: We've seen the before, it's annoying. I think the answer is to go to the data stores page of the AML Studio UI and manually enter the storage account key again.


text:
Q: Describe the ker and image of $\phi$ This is an exercise in Artin's Algebra (10.3.11)
$\phi :\mathbb{C}[x,y] \rightarrow \mathbb{C}[t]$
is defined by $\phi(x)=t^2$ and $\phi(y)=t^3$
Prove the $\operatorname{Ker} \phi =$ the principal ideal generated by $y^2-x^3$
and describe the $\operatorname{Im} \phi$ explicitly$
I am able to show the Ideal generated by $y^2-x^3$ is contained in the kernel but don't know how to go about the other containment or show it is a principal ideal.

A: Hint: Let $I$ be the ideal generated by $y^2-x^3$. Show that every coset $g+I$ contains a unique element of the form $f_1(x)+yf_2(x)$ with $f_1,f_2\in \mathbf{C}[x]$. Then show that such a polynomial is in $\ker \phi$ only, if $f_1=f_2=0$.


text:
Q: Как сравнить значение из input через Fuzzywuzzy? Хотел сделать так, чтобы бот отвечал также на вопрос с одним смыслом "Какой сегодня день?". Когда начал проверять бот отвечал на любую бессвязную чушь одними и теми же ответами в том порядке, в котором они стоят в коде
import os
from datetime import date, time
from fuzzywuzzy import fuzz

name = input("Введите ваше имя: ")
clear = lambda: os.system('cls')
clear()
print("Здравствуйте, " + name + "!" + " Вас приветствует бот Иларион, чем могу быть полезен?")
print("=======================================================================")
msg = input("Пишите тут: ")

def new_func():
    msg = input("Пишите тут: ")
    return msg

if (msg == "Пинг", fuzz.ratio(msg, 'Пинг') > 75) or (msg == "Ping", fuzz.ratio(msg, 'Ping') > 25):
 pong = "Понг"
 print(pong)

 msg = new_func()

if (msg == "Какой сегодня день", fuzz.ratio(msg, 'Какой сегодня день?') > 25):
    print(date.today())

    msg = input("Пишите тут: ")

A: if (msg == "Пинг", fuzz.ratio(msg, 'Пинг') > 75) or (msg == "Ping", fuzz.ratio(msg, 'Ping') > 25):

Как-то вы очень странно сравниваете. Фактически, вы пишете такие условия:
if кортеж(условие, условие) or кортеж(условие, условие):

При этом, булево значение любого вида коллекций считается истинным, если коллекция не пуста. Таким образом, ваши условия всегда выполняются, потому что у вас не пустые кортежи, в них по два элемента.
Даже если абсолютно все условия в скобках будут ложными, if всё-равно сработает. Проверим:
if (False,False) or (False,False):
    print('Сработало!')

Вывод:
Сработало!

Так что переписывайте ваши условия на нормальные логические операторы and, or и not вместо кортежей.


text:
Q: gradle, jetty and servlet - what am I doing wrong? I am trying to run this simple example
https://github.com/gradle/oreilly-gradle-book-examples/tree/master/web-hello-world
after cloning the repo,
cd oreilly-gradle-book-examples/web-hello-world
gradle JettyRun

Seems to be working fine
compileJava UP-TO-DATE
:processResources NO-SOURCE
:classes UP-TO-DATE
> Building 75% > :jettyRun > Running at http://localhost:8080/web-hello-world

When I access that URL though, I simply get
Directory: /web-hello-world/
web.xml     555 bytes   Jul 30, 2017 4:55:48 PM

so the servlet code isnt being called.
Using Gradle 3.4.1
Any idea?
Thanks!


text:
Q: UWP Flyout loopingselector I am currently building a new Windows 10 UWP app based on our previous Windows Phone 7 app. In this old app we have a specific control where the user needs to select a value between 1 and 101, for this we used the loopingselector.
Now for the UWP app it seems that this control is not available anymore. What I'm looking for is similar to the timepicker flyout but then with only one selector from 1-101.
I have searched quite a bit but maybe I'm missing something. Thanks in advance for your time.

A: Just use ComboBox control. With a little of Style tweaking you can create similar look to LoopingSelector.


text:
Q: How to add gdbus-codegen to PATH on Ubuntu? I am trying to install xfce4-panel (from a tarball) on Ubuntu 20.04, however, when I run

./configure

I get an error:

configure: error: could not find gdbus-codegen in $PATH. You can run
./configure GDBUS_CODEGEN=/path/to/gdbus-codegen to define
a custom location for it.

The error says gdbus-codegen is not PATH but I am not sure where gdbus-codegen is or how I can add it to the PATH. If it helps, I am installing xfce4 from here: https://gitlab.xfce.org/xfce/xfce4-panel (Also, I am very new to Ubuntu, I'm not sure if gdbus-codegen is even installed)


text:
Q: Creating DataTable in PrimeFaces dynamically I'm creating an application where user will upload excel file and application will show it in form of DataTable.
So far i have written following code by using code given here

Dynamic Data table example

            <f:facet name="header">
            #{column.header}
            </f:facet>

        #{data[column.property]}

</h:form>

Managed bean code
private void addPeople() {
    people = new ArrayList<People>();

    People w1 = new People("Homer Simpson","The father",48);
    People w2 = new People("Marge Simpson","The mother",46);
    People w3 = new People("Bart Simpson","Oldest child",11);
    People w4 = new People("Lisa Simpson","Sister of Bart",8);

    people.add(w1);
    people.add(w2);
    people.add(w3);
    people.add(w4);
}

private void createDynamicColumns() {

    columns = new ArrayList<ColumnModel>();
    columns.add(new ColumnModel("Name", "name"));
    columns.add(new ColumnModel("Role", "role"));
    columns.add(new ColumnModel("Age", "age"));
}

Getter methods are also includes.
This code is working fine but in this example I have set pattern for row namely ( Name, Role, Age) .But i don't know how many columns are there in the excel file and hence can't define the pattern of row data before hand.
Is there any way of approaching this problem?


text:
Q: MariaDB DATETIME Index not working with Between FROM_UNIXTIME() I have a table with DATETIME field, which is indexed by a BTree. Now i want to query it with following statement:
SELECT
  count(us.CITY) as metric,
  us.CITY as Name,
  us.LATITUDE as latitude,
  us.LONGITUDE as longitude
FROM
  FACT
LEFT JOIN
  USER us
ON
  us.ID_USER = FACT.USER
WHERE
  ASSESSMENT_DATE BETWEEN FROM_UNIXTIME(1601568552) AND FROM_UNIXTIME(1604028277)
GROUP BY us.CITY, us.LATITUDE, us.LONGITUDE;

EXPLAIN:
+------+-------------+-------+--------+----------------------------+---------+---------+------------------------------+--------+----------------------------------------------+
| id   | select_type | table | type   | possible_keys              | key     | key_len | ref                          | rows   | Extra                                        |
+------+-------------+-------+--------+----------------------------+---------+---------+------------------------------+--------+----------------------------------------------+
|    1 | SIMPLE      | FACT  | ALL    | INDEX_FACT_ASSESSMENT_DATE | NULL    | NULL    | NULL                         | 762621 | Using where; Using temporary; Using filesort |
|    1 | SIMPLE      | us    | eq_ref | PRIMARY                    | PRIMARY | 46      | dwh0.FACT.USER,dwh0.FACT.ENV |      1 |                                              |
+------+-------------+-------+--------+----------------------------+---------+---------+------------------------------+--------+----------------------------------------------+
2 rows in set (0.001 sec)

Interestingly, by only changing the dates manually into the DATETIME Format string it uses the index. But the FROM_UNIXTIME() function should in my opinion return the exactly same thing...
SELECT
  count(us.CITY) as metric,
  us.CITY as Name,
  us.LATITUDE as latitude,
  us.LONGITUDE as longitude
FROM
FACT
LEFT JOIN
   USER us
ON
  us.ENV = FACT.ENV AND us.ID_USER = FACT.USER
WHERE
-- ASSESSMENT_DATE BETWEEN FROM_UNIXTIME(1596649101) AND FROM_UNIXTIME(1599108827)
  ASSESSMENT_DATE BETWEEN '2020-08-05 11:30:11.987' AND '2020-09-03 11:30:11.987'
GROUP BY us.CITY, us.LATITUDE, us.LONGITUDE;

EXPLAIN:
+------+-------------+-------+--------+----------------------------+----------------------------+---------+------------------------------+--------+--------------------------------------------------------+
| id   | select_type | table | type   | possible_keys              | key                        | key_len | ref                          | rows   | Extra
     |
+------+-------------+-------+--------+----------------------------+----------------------------+---------+------------------------------+--------+--------------------------------------------------------+
|    1 | SIMPLE      | FACT  | range  | INDEX_FACT_ASSESSMENT_DATE | INDEX_FACT_ASSESSMENT_DATE | 5       | NULL                         | 132008 | Using index condition; Using temporary; Using filesort |
|    1 | SIMPLE      | us    | eq_ref | PRIMARY                    | PRIMARY                    | 46      | dwh0.FACT.USER,dwh0.FACT.ENV |      1 |
     |
+------+-------------+-------+--------+----------------------------+----------------------------+---------+------------------------------+--------+--------------------------------------------------------+
2 rows in set (0.001 sec)

Can anyone refer to such a problem? the where clause is generated by grafana, so i can not change that, but the rest i can change if it changes something.
Thanks for suggestions!

A: Sorry for bothering.. after around 10^5 more inserts, it works for both cases... Maybe it was just bad luck