text:
Q: How to use a for loop to caclulate reliabilities for several scales There are several scales included in my data set. I need to calculate reliabilities for all these scales. Can I use a for loop to simplify my code.
A example of my data can be as following:
js1 js2 js3 js4 js5 js6 js7 js8 IRI1 IRI2 IRI3 IRI4 IRI5 IRI6 IRI7 IRI8 IRI9 IRI10 IRI11 IRI12 IRI13 IRI14
 2   2   0   1   3   4   5   1   1    2    2    1    4    3    5    1     4    3     2     3     1     4
 3   0   4   5   0   3   2   1   5    5    4    2    3    1    5    2     3    3     2     1     2     5
 5   3   4   3   1   1   0   1   3    4    3    1    2    2    3    4     1    5     3     2     1     4

Part of my code is as following:
justSenNames <- c(paste("justsens",1:8,sep = ''))
justSenKeys <- c(1,2,3,4,5,6,7,8)

justSenAlpha <-  psych::alpha(df4321[,justSenNames], keys=justSenKeys)  # calculate the alpha coefficient of JS
print(justSenAlpha$total)  # print the alpha for JS

#from the Interpersonal Reactivity Index
df4321[, paste0("IRI_cn_",c(2,3,7,8,9))] <- 6- df4321[,paste0("IRI_cn_",c(2,3,7,8,9))]
IRINames <- c(paste('IRI',1:14,sep = ''))
#IRIKeys <- c(1,-2,-3,4,5,6,-7,-8,-9,10,11,12,13,14) # original reverse coding
IRIKeys <- c(1,2,3,4,5,6,7,8,9,10,11,12,13,14)       # reverse coded as negative

IRIAlpha <-  psych::alpha(df4321[,IRINames], keys=IRIKeys)  # calculate the alpha coefficient of IRI
print(IRIAlpha$total)  # print the alpha for IRI

I want to use for loop caculate reliabilities for JS and IRI, I tried it in such a way:
ScalesNames <- c('justSenNames','IRINames')
KeyNames <- c ('justSenKeys','IRIKeys')
for (i in ScalesNames){
    for (j in KeyNames) {
    alpha <- psych::alpha(df4321[,i],keys = j)
    print(Alpha$total)
}
}
Error in `[.data.frame`(df4321, , i) : undefined columns selected


text:
Q: What is going wrong when I'm trying to set up a rails project? I'm trying to follow some instructions to get a rails project up and running.
https://www.theodinproject.com/courses/web-development-101/lessons/your-first-rails-application
I've never used rails before and I'm not great with the command line.
Here is the console output during the install attempt and a bit of trying to do what it asks.
tanner@tannersVirtualBox:~$ gem install rails
Successfully installed rails-6.0.1
Parsing documentation for rails-6.0.1
Done installing documentation for rails after 0 seconds
1 gem installed
tanner@tannersVirtualBox:~$ mkdir rails_app
tanner@tannersVirtualBox:~$ cd rails_app
tanner@tannersVirtualBox:~/rails_app$ rails new rails_project
      create
      create  README.md
      create  Rakefile
      create  .ruby-version
      create  config.ru
      create  .gitignore
      create  Gemfile
         run  git init from "."
Initialized empty Git repository in /home/tanner/rails_app/rails_project/.git/
      create  package.json
      create  app
      create  app/assets/config/manifest.js
      create  app/assets/stylesheets/application.css
      create  app/channels/application_cable/channel.rb
      create  app/channels/application_cable/connection.rb
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/javascript/channels/consumer.js
      create  app/javascript/channels/index.js
      create  app/javascript/packs/application.js
      create  app/jobs/application_job.rb
      create  app/mailers/application_mailer.rb
      create  app/models/application_record.rb
      create  app/views/layouts/application.html.erb
      create  app/views/layouts/mailer.html.erb
      create  app/views/layouts/mailer.text.erb
      create  app/assets/images/.keep
      create  app/controllers/concerns/.keep
      create  app/models/concerns/.keep
      create  bin
      create  bin/rails
      create  bin/rake
      create  bin/setup
      create  bin/yarn
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/cable.yml
      create  config/puma.rb
      create  config/spring.rb
      create  config/storage.yml
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/application_controller_renderer.rb
      create  config/initializers/assets.rb
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/content_security_policy.rb
      create  config/initializers/cookies_serializer.rb
      create  config/initializers/cors.rb
      create  config/initializers/filter_parameter_logging.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/new_framework_defaults_6_0.rb
      create  config/initializers/wrap_parameters.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/master.key
      append  .gitignore
      create  config/boot.rb
      create  config/database.yml
      create  db
      create  db/seeds.rb
      create  lib
      create  lib/tasks
      create  lib/tasks/.keep
      create  lib/assets
      create  lib/assets/.keep
      create  log
      create  log/.keep
      create  public
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/apple-touch-icon-precomposed.png
      create  public/apple-touch-icon.png
      create  public/favicon.ico
      create  public/robots.txt
      create  tmp
      create  tmp/.keep
      create  tmp/pids
      create  tmp/pids/.keep
      create  tmp/cache
      create  tmp/cache/assets
      create  vendor
      create  vendor/.keep
      create  test/fixtures
      create  test/fixtures/.keep
      create  test/fixtures/files
      create  test/fixtures/files/.keep
      create  test/controllers
      create  test/controllers/.keep
      create  test/mailers
      create  test/mailers/.keep
      create  test/models
      create  test/models/.keep
      create  test/helpers
      create  test/helpers/.keep
      create  test/integration
      create  test/integration/.keep
      create  test/channels/application_cable/connection_test.rb
      create  test/test_helper.rb
      create  test/system
      create  test/system/.keep
      create  test/application_system_test_case.rb
      create  storage
      create  storage/.keep
      create  tmp/storage
      create  tmp/storage/.keep
      remove  config/initializers/cors.rb
      remove  config/initializers/new_framework_defaults_6_0.rb
         run  bundle install
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
Fetching gem metadata from https://rubygems.org/............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies.................
Using rake 13.0.1
Using concurrent-ruby 1.1.5
Using i18n 1.7.0
Using minitest 5.13.0
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using zeitwerk 2.2.2
Using activesupport 6.0.1
Using builder 3.2.3
Using erubi 1.9.0
Using mini_portile2 2.4.0
Using nokogiri 1.10.7
Using rails-dom-testing 2.0.3
Using crass 1.0.5
Using loofah 2.4.0
Using rails-html-sanitizer 1.3.0
Using actionview 6.0.1
Using rack 2.0.7
Using rack-test 1.1.0
Using actionpack 6.0.1
Using nio4r 2.5.2
Using websocket-extensions 0.1.4
Using websocket-driver 0.7.1
Using actioncable 6.0.1
Using globalid 0.4.2
Using activejob 6.0.1
Using activemodel 6.0.1
Using activerecord 6.0.1
Using mimemagic 0.3.3
Using marcel 0.3.3
Using activestorage 6.0.1
Using mini_mime 1.0.2
Using mail 2.7.1
Using actionmailbox 6.0.1
Using actionmailer 6.0.1
Using actiontext 6.0.1
Using public_suffix 4.0.1
Using addressable 2.7.0
Using bindex 0.8.1
Using msgpack 1.3.1
Using bootsnap 1.4.5
Using bundler 1.17.2
Using byebug 11.0.1
Using regexp_parser 1.6.0
Using xpath 3.2.0
Using capybara 3.29.0
Using childprocess 3.0.0
Using ffi 1.11.3
Using jbuilder 2.9.1
Using rb-fsevent 0.10.3
Using rb-inotify 0.10.0
Using ruby_dep 1.5.0
Using listen 3.1.5
Using method_source 0.9.2
Using puma 4.3.0
Using rack-proxy 0.6.5
Using thor 0.20.3
Using railties 6.0.1
Using sprockets 4.0.0
Using sprockets-rails 3.2.1
Using rails 6.0.1
Using rubyzip 2.0.0
Fetching sassc 2.2.1
Installing sassc 2.2.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /home/tanner/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sassc-2.2.1/ext
/home/tanner/.rbenv/versions/2.6.5/bin/ruby -I /home/tanner/.rbenv/versions/2.6.5/lib/ruby/2.6.0 -r ./siteconf20191204-4266-1nzypic.rb extconf.rb
creating Makefile

current directory: /home/tanner/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sassc-2.2.1/ext
make "DESTDIR=" clean

current directory: /home/tanner/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sassc-2.2.1/ext
make "DESTDIR="
compiling ./libsass/src/subset_map.cpp
make: g++: Command not found
Makefile:236: recipe for target 'subset_map.o' failed
make: *** [subset_map.o] Error 127

make failed, exit code 2

Gem files will remain installed in /home/tanner/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sassc-2.2.1 for inspection.
Results logged to /home/tanner/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/sassc-2.2.1/gem_make.out

An error occurred while installing sassc (2.2.1), and Bundler cannot continue.
Make sure that `gem install sassc -v '2.2.1' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  sass-rails was resolved to 6.0.0, which depends on
    sassc-rails was resolved to 2.1.2, which depends on
      sassc
         run  bundle binstubs bundler
Could not find gem 'sass-rails (>= 6)' in any of the gem sources listed in your Gemfile.
         run  bundle exec spring binstub --all
bundler: command not found: spring
Install missing gem executables with `bundle install`
       rails  webpacker:install
Could not find gem 'sass-rails (>= 6)' in any of the gem sources listed in your Gemfile.
Run `bundle install` to install missing gems.
tanner@tannersVirtualBox:~/rails_app$ cd rails_project
tanner@tannersVirtualBox:~/rails_app/rails_project$ rails generate scaffold car make:string model:string year:integer
Could not find gem 'sass-rails (>= 6)' in any of the gem sources listed in your Gemfile.
Run `bundle install` to install missing gems.
tanner@tannersVirtualBox:~/rails_app/rails_project$ cd ..
tanner@tannersVirtualBox:~/rails_app$ ls
rails_project
tanner@tannersVirtualBox:~/rails_app$ bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java
Could not locate Gemfile
tanner@tannersVirtualBox:~/rails_app$ cd ..
tanner@tannersVirtualBox:~$ ls
Desktop  Documents  Downloads  Music  Pictures  Public  rails_app  Templates  Videos
tanner@tannersVirtualBox:~$ cd rails_app
tanner@tannersVirtualBox:~/rails_app$ bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java
Could not locate Gemfile
tanner@tannersVirtualBox:~/rails_app$ cd rails_project
tanner@tannersVirtualBox:~/rails_app/rails_project$ bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java
Fetching gem metadata from https://rubygems.org/............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies..................................................
Writing lockfile to /home/tanner/rails_app/rails_project/Gemfile.lock
tanner@tannersVirtualBox:~/rails_app/rails_project$ bundle install
Fetching gem metadata from https://rubygems.org/............
Using rake 13.0.1
Using concurrent-ruby 1.1.5
Using i18n 1.7.0
Using minitest 5.13.0
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using zeitwerk 2.2.2
Using activesupport 6.0.1
Using builder 3.2.3
Using erubi 1.9.0
Using mini_portile2 2.4.0
Using nokogiri 1.10.7
Using rails-dom-testing 2.0.3
Using crass 1.0.5
Using loofah 2.4.0
Using rails-html-sanitizer 1.3.0
Using actionview 6.0.1
Using rack 2.0.7
Using rack-test 1.1.0
Using actionpack 6.0.1
Using nio4r 2.5.2
Using websocket-extensions 0.1.4
Using websocket-driver 0.7.1
Using actioncable 6.0.1
Using globalid 0.4.2
Using activejob 6.0.1
Using activemodel 6.0.1
Using activerecord 6.0.1
Using mimemagic 0.3.3
Using marcel 0.3.3
Using activestorage 6.0.1
Using mini_mime 1.0.2
Using mail 2.7.1
Using actionmailbox 6.0.1
Using actionmailer 6.0.1
Using actiontext 6.0.1
Using public_suffix 4.0.1
Using addressable 2.7.0
Using bindex 0.8.1
Using msgpack 1.3.1
Using bootsnap 1.4.5
Using bundler 1.17.2
Using byebug 11.0.1
Using regexp_parser 1.6.0
Using xpath 3.2.0
Using capybara 3.29.0
Using childprocess 3.0.0
Using ffi 1.11.3
Using jbuilder 2.9.1
Using rb-fsevent 0.10.3
Using rb-inotify 0.10.0
Using ruby_dep 1.5.0
Using listen 3.1.5
Using method_source 0.9.2
Using puma 4.3.0
Using rack-proxy 0.6.5
Using thor 0.20.3
Using railties 6.0.1
Using sprockets 4.0.0
Using sprockets-rails 3.2.1
Using rails 6.0.1
Using rubyzip 2.0.0
Fetching sassc 2.2.1
Installing sassc 2.2.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /home/tanner/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sassc-2.2.1/ext
/home/tanner/.rbenv/versions/2.6.5/bin/ruby -I /home/tanner/.rbenv/versions/2.6.5/lib/ruby/2.6.0 -r ./siteconf20191204-4459-yifqb0.rb extconf.rb
creating Makefile

current directory: /home/tanner/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sassc-2.2.1/ext
make "DESTDIR=" clean

current directory: /home/tanner/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sassc-2.2.1/ext
make "DESTDIR="
compiling ./libsass/src/subset_map.cpp
make: g++: Command not found
Makefile:236: recipe for target 'subset_map.o' failed
make: *** [subset_map.o] Error 127

make failed, exit code 2

Gem files will remain installed in /home/tanner/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sassc-2.2.1 for inspection.
Results logged to /home/tanner/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/sassc-2.2.1/gem_make.out

An error occurred while installing sassc (2.2.1), and Bundler cannot continue.
Make sure that `gem install sassc -v '2.2.1' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  sass-rails was resolved to 6.0.0, which depends on
    sassc-rails was resolved to 2.1.2, which depends on
      sassc
tanner@tannersVirtualBox:~/rails_app/rails_project$ ^C
tanner@tannersVirtualBox:~/rails_app/rails_project$ gem install sassc -v '2.2.1'
Building native extensions. This could take a while...
ERROR:  Error installing sassc:
    ERROR: Failed to build gem native extension.

    current directory: /home/tanner/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sassc-2.2.1/ext
/home/tanner/.rbenv/versions/2.6.5/bin/ruby -I /home/tanner/.rbenv/versions/2.6.5/lib/ruby/2.6.0 -r ./siteconf20191204-4527-l3i7xk.rb extconf.rb
creating Makefile

current directory: /home/tanner/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sassc-2.2.1/ext
make "DESTDIR=" clean

current directory: /home/tanner/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sassc-2.2.1/ext
make "DESTDIR="
compiling ./libsass/src/subset_map.cpp
make: g++: Command not found
Makefile:236: recipe for target 'subset_map.o' failed
make: *** [subset_map.o] Error 127

make failed, exit code 2

Gem files will remain installed in /home/tanner/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sassc-2.2.1 for inspection.
Results logged to /home/tanner/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/sassc-2.2.1/gem_make.out

I tried a few other things in the console that didn't help.
Can you read through the terminal and tell me what I should try?
Thanks a lot.

A: make: g++: Command not found
Try installing the g++ package on your system using your packages manager (or anything else that provides you that package like the build-essential package)

redpajama_set_name: RedPajamaStackExchange


text:
Q: Subgroups of a direct product Until recently, I believed that a subgroup of a direct product was the direct product of subgroups.  Obviously, there exists a trivial counterexample to this statement.
I have a question regarding this.  It is threefold:

*

*I hear that a theorem called Goursat's lemma states characterization of subgroups of a direct product.  I read it on Lang's Algebra, but its statement is a bit counterintuitive and I do not know how to use it to solve problems.  I would be grateful if you could give a hint regarding this lemma.

*I had the aforementioned false belief when I tried to solve this problem, and it seemed to work in this specific problem.  When is the generally false statement hold? (Or is my reasoning in concluding the answer to the problem is 8  flawed?)

*I have problems similar to the previous one, namely, counting the subgroups of $\Bbb Z/p\Bbb Z \times \Bbb Z/p \Bbb Z$ and $\Bbb Z/p^2\Bbb Z \times \Bbb Z/p^2 \Bbb Z$, where $p$ is a prime number.  How can I use the previous considerations to solve this problem?
I would appreciate your help.
EDIT: I fixed a typo in the last problem.
EDIT 2: The problem I mentioned in 2. is actually about the number of elements of some order, not that of subgroups. (I forgot about that when I wrote this question.)  I am still interested in the question stated in 2., though.

A: I will first state the characterization of the subgroup of a direct product. Then I will try to make this characterization seem at least a bit intuitive by explaining what sorts of subgroups it gives. Finally, I will demonstrate how to use it for finding the number of subgroups of $\mathbb{Z}/p^2\mathbb{Z}\times\mathbb{Z}/p^2\mathbb{Z}$.
The characterization says the following: Let $G$ and $H$ be groups. Then the subgroups of $G\times H$ are in bijection with the set of $5$-tuples $(G_1,G_2,H_1,H_2,\varphi)$ where $G_2\unlhd G_1\leq G$, $H_2\unlhd H_1\leq H$ and $\varphi: G_1/G_2\to H_1/H_2$ is an isomorphism.
The correspondence is given by assigning to such a tuple the subgroup $\{(g,h)\in G_1\times H_1\mid \varphi(gG_2) = hH_2\}$.
So let us take a look at what sort of subgroups we can construct "naively" in the direct product, and try to put them on the form above.
First, we have those of the form $G_1\times H_1$ (these are the easiest one to think of). These correspond to picking $G_2 = G_1$ and $H_2 = H_1$ and the unique homomorphism from $G_1/G_2$ to $H_1/H_2$ (since these groups are both trivial). (Check that this does indeed produce the subgroup $G_1\times H_1$).
Next, the common example of a subgroup not of this form is in the direct product $G\times G$ where we have the diagonal subgroup given by all elements of the form $(g,g)$. To make this fit in better with the above, assume that $G$ and $H$ are isomorphic and that $\varphi$ is an isomorphism between them (writing it as $G\times G$ then essentially corresponds to having picked an isomorphism). Now, the diagonal above corresponds to the subgroup consisting of all elements of the form $(g,\varphi(g))$, and we see that this subgroup corresponds to picking $G_1 = G$, $H_1 = H$, $G_2 = \{e\}$, $H_2 = \{e\}$ and $\varphi$ as the isomorphism (again, check this).
But we can of course easily generalize the above if the two groups have subgroups $G_1$ and $H_1$ which are isomorphic via some isomorphism $\varphi$, giving us the subgroup consisting of elements of the form $(g,\varphi(g))$, now with $g\in G_1$ and $h\in H_1$. This corresponds to picking $G_1$ and $H_1$ to be those subgroups (hence the choice of notation), and $G_2$ and $H_2$ both to be the trivial subgroup like above (and again the isomorphism should be $\varphi$).
Generalizing further on the above, let us assume that we have two subgroups $G_1$ and $H_1$ and a surjective homomorphism $\varphi':G_1\to H_1$. Now we can again form the subgroup consisting of all elements of the form $(g,\varphi'(g))$ for $g\in G_1$ (we never needed the homomorphism to be bijective above). This corresponds to picking $G_2 = \rm{ker}(\varphi')$, $H_2 = \{e\}$ and $\varphi$ to be the isomorphism $G_1/G_2\to H_1$ induced by $\varphi'$ (check this).
Note that the reason we pick $\varphi'$ to be surjective in the above is that otherwise, we might as well just look at the image of $\varphi'$.
The final step in generalizing these ideas is probably the least intuitive. Namely, we have two subgroups $G_1$ and $H_1$, but we do not necessarily have any homomorphism between them. Instead, we have a homomorphism $\varphi$ from $G_1$ to some quotient $H_1/H_2$ which is surjective (again, the surjectivity is just because otherwise, we would restrict to the image). Let us first assume this map is also injective, to make notations a bit simpler. In this case, we wish to form something like the subgroups from above, but we can no longer just take something like $(g,\varphi(g))$, since $\varphi(g)$ is no longer an element of $H_1$ but an element of $H_1/H_2$. On the other hand, $\varphi(g)$ is a coset of $H_2$ in $H_1$ and is therefore a subset of $H_1$, so for each $g\in G$ we can take all the elements of the form $(g,h)$ where $h$ is in the coset $\varphi(g)$ of $H_2$ in $H_1$. One should again check that this is indeed a subgroup, and that this corresponds to picking $G_1 = \{e\}$ and and the rest are already in the appropriate notation.
To get rid of the requirement of injectivity above, we set $G_2$ to be the kernel of the homomorphism and replace the homomorphism by the induced isomorphism $G_1/G_2\to H_1/H_2$. The pairs we now need are those of the form $(g,h)$ where again $h$ is in the coset $\varphi(g)$ but now we need to interpret $\varphi(g)$ as $\varphi(gG_2)$ (since $\varphi$ need not even be defined on $G_1$). So our elements are those of the form $(g,h)$ where $\varphi(gG_2) = hH_2$. This is fortunately precisely the form given by the characterization, so we now have all the possible subgroups.
Let's now, finally, take a look at finding the number of subgroups of $\mathbb{Z}/p^2\mathbb{Z}\times \mathbb{Z}/p^2\mathbb{Z}$.
So we need to find all possible $5$-tuples as above. Since each of the factors have precisely $3$ subgroups, all isomorphism classes of subgroups and quotients are determined by their order, and the tuples need the two quotients to be isomorphic, we get a total of $14$ types of tuples ($9$ where the order is $1$, $4$ where the order is $p$ and $1$ where the order is $p^2$), and for each we then need to know how many isomorphisms we can pick.
To make the notation a bit easier, denote the group by $G\times H$. Let $G'$ and $H'$ be the proper, non-trivial subgroups of $G$ and $H$ respectively. Denote by $1$ the trivial subgroup of either.
Our tuples then have the forms given below. The number after each tuple is the number of possible isomorphisms $\varphi$ we can pick (this number is the order of the automorphism group of $G_1/G_2$ which is of course also the order of the automorphism group of $H_1/H_2$. In our cases, these automorphism groups are easy to calculate as the possible quotients are all cyclic).
$(G,G,H,H,\varphi)$ $1$
$(G,G,H',H',\varphi)$ $1$
$(G,G,1,1,\varphi)$ $1$
$(G,G',H,H',\varphi)$ $p-1$
$(G,G',H',1,\varphi)$ $p-1$
$(G,1,H,1,\varphi)$ $p^2 - p$
$(G',G',H,H,\varphi)$ $1$
$(G',G',H',H',\varphi)$ $1$
$(G',G',1,1,\varphi)$ $1$
$(G',1,H,H',\varphi)$ $p-1$
$(G',1,H',1,\varphi)$ $p-1$
$(1,1,H,H,\varphi)$ $1$
$(1,1,H',H',\varphi)$ $1$
$(1,1,1,1,\varphi)$ $1$
Now it is just a matter of adding these number together to see that the total number of subgroups is $(p^2 - p) + 4(p-1) + 9 = p^2 + 3p + 5$.

A: I want to answer question three, as per your above comment. I do not use Goursat's lemma explicitly. Sorry.
Before starting, I should say that I use the phrase "by symmetry" a few times. This basically means "If $G=H\times K$ then I have proven it for $H$ so it must hold for $K$".
The first thing to notice is the following lemma:
Lemma: Suppose $G=H\times K$. A subgroup $S\leq G$ has the form $\{(h_i, k_i): i\in I\}$ where the elements $\{h_i\}_I$ form a subgroup of $H$ and the elements $\{k_i\}$ form a subgroup of $K$.
Proof: To see this, recall that $H$ is normal in $G$ and the quotient group is simply $K$, so the image of $S$ contains precisely the elements $\{k_i\}$, as required. By symmetry, we have proven the lemma.
Question 3)i) I will write $\mathbb{Z}_p$ for $\mathbb{Z}/p\mathbb{Z}$. So, the first part of question three asks "What are the subgroups of $G=\mathbb{Z}_p\times\mathbb{Z}_p$?" I'll write $G=H\times K$. There are precisely $(p-1)+2=p+1$ proper, non-trivial subgroups of $G$. To see this, note that $\mathbb{Z}_p$ has no proper, non-trivial subgroups, and so writing $S=\{(h_i, k_i): i\in I\}$ we have one of three situations occurring: either $h_i$ is trivial and $k_i$ is non-trivial for all $i\in I$, or $h_i$ is non-trivial and $k_i$ is trivial for all $i\in I$, or both $h_i$ and $k_i$ are non-trivial for all $I$. In the first two situations the subgroups are isomorphic to $\mathbb{Z}_p$ and are non-equal (why?). The last situation is most interesting. Here, note that an arbitrary, non-trivial element $h_i$ generates $H$, and so the element $(h_i, k_i)$ generates a subgroup for all $k_i\in K$. There are $p-1$ such non-trivial $k_i\in K$, so there are $p-1$ such subgroups. Note that these subgroups are all non-equal. Therefore, there are $2+(p-1)=p+1$ proper, non-trivial subgroups of $G$. Note that if $p=2$ then $p+1=3$, which tallys with the fact that the Klein 4-group has three proper, non-trivial subgroups.
Question 3)ii) For $G=\mathbb{Z}_{p^2}\times\mathbb{Z}_p^2=H\times K$, use the same trick as above. However, $\mathbb{Z}_{p^2}$ has a proper, non-trivial subgroup, namely $\mathbb{Z}_{p^2}$, and so when we pick the elements $\{h_i\}$ there are three choices, as they are either generators for $H$ ($p$ choices), generators for the proper subgroup ($p-1$ choices), or are trivial ($1$ choice). Moreover, here there is a proper, non-trivial subgroup which is a direct product!
We shall classify the cyclic subgroups (up to symmetry). Note that there is only one proper, non-trivial subgroup which is not cyclic. The "up to symmetry" means that we have classified them but that you cannot simply add up the numbers and multiply by two. You will have counted stuff twice if you do this.
Case 1: Suppose $h_i$ is trivial. Then there are two non-trivial subgroups associated to this case, corresponding to the non-trivial subgroups of $K$.
Case 2: Suppose $h_i$ has order $p$. Then $h_i$ can be paired with every element $k_i$ of order $p^2$ in $K$ to form a subgroup of order $p^2$. Note that these are maximal but that they are not all non-equal. There are $p-1=p(p-1)/p$ such subgroups (why?). On the other hand, $h_i$ can be paired with every element $k_i$ of order $p$ in $K$ to form a subgroup of order $p$. There are $p-1$ such subgroups. Finally, $h_i$ can be paired with the identity to form a subgroup of order $p$ in $K$. There is one such subgroup.
Case 3: Suppose $h_i$ has order $p^2$. Then $h_i$ can be paired with every element $k_i$ of $K$ to form a subgroup of order $p^2$. Note that these are maximal but are again not all non-equal. There are $p^2+(p-1)+p=p^2+2p-1$ such subgroups (why?).

A: A count of the subgroups of $\mathbf Z/p^a\mathbf Z \times \mathbf Z/p^b\mathbf Z$ with $1 \leq a \leq b$ is here. See Theorem 3.


text:
Q: When using JSON Schema for validation, it is not recursively validate child entities? When using the following schema
{
    "$schema": "http://json-schema.org/schema#",
    "definitions":{
        "entity": {
            "type": "object",
            "properties": {
                "parent": {"type": ["null","string"]},
                "exclude": {"type": "boolean"},
                "count": {"type": ["null","integer"]},
                "EntityType": {"type": "string"},
                "Children": {
                    "type": "array",
                    "items": {"$ref":"#/definitions/entity"}
                }
            }
        }
    },
    "required": ["parent","EntityType","count"]
}

On this provided body of JSON
{
    "parent": "null",
    "EntityType": "test",
    "count": "null",
    "Children": [
        {
            "EntityType": "test",
            "count": 3
        },
        {
            "EntityType": "test"
        }
    ],
    "Extra": "somevalue"
}

It should be returning that I have provided an invalid Json object, however it does not seem to be doing so.
That said, if I were to have the root node not succeed (by removing one of the required fields) the validation works and says that I haven't provided a required field. Is there a reason that I am not able to validate the json recursively?

A: It looks like you want parent, EntityType, and count to be required properties of the entity definition.  However they're only required at the root, not the entity level.  I would suggest that you move the required keyword into the entity definition, then reference the definition as part of an allOf to ensure the root is compliant.
{
    "$schema": "http://json-schema.org/schema#",
    "definitions":{
        "entity": {
            "type": "object",
            "properties": {
                "parent": {"type": ["null","string"]},
                "exclude": {"type": "boolean"},
                "count": {"type": ["null","integer"]},
                "EntityType": {"type": "string"},
                "Children": {
                    "type": "array",
                    "items": {"$ref":"#/definitions/entity"}
                }
            },
            "required": ["parent","EntityType","count"]
        }
    },
    "allOf": [{"$ref": "#/definitions/entity"}]
}


text:
Q: How to start cron in Linux Mint 17.3 How can I start cron at startup of computer, so I can use a cronjob to automatically make a backup using rsync. I am not well known with how to start programs in Linux. I am using Linux Mint 17.3.

A: You do not need to use cron because rsync can do backup when computer starts by running daemon. You should look at this forum post: Click here

A: If you have cron installed (which it normally is), you can make an entry in your crontab file that starts with @reboot (instead of the more usual minute/hour/day/month/day-of-week specification). That job will be run on bootup. You can find more information on this with man 5 crontab from the commandline.


text:
Q: How to align Snap's HOME with Linux? Background
When I use n3dr, it looks by default in the home folder for a .n3dr.yaml file. When a snap package is created, the tool complains that it cannot find the file. It turned out that snap has an other definition regarding $HOME.
$HOME on linux:
~/user, i.e. /home/user

snap:
INFO[0000] Home folder: '/home/user/snap/n3dr/x1'

Aim
To prevent that users have to create a n3dr.yaml file in another home directory, the question is whether it is possible to overwrite the Snap's $HOME variable to ensure that it is identical to the Linux' $HOME default.
How to align this? I.e.:
INFO[0000] Home folder: '/home/user'

instead of:
INFO[0000] Home folder: '/home/user/snap/n3dr/x1'

A: From the snapcraft.io web site:

HOME This environment variable is re-written by snapd so that each
snap appears to have a dedicated home directory that is a subdirectory
of the real home directory.

Perhaps you can get where you want by making n3dr more snap-aware, or by creating a sym-link from the ~user/.n3dr.yaml to the snapd home for n3dr.
ln -sf /home/user/snap/n3dr/x1/.n3dr.yaml /home/user


text:
Q: How to configure two way SSL connection in Spring WS without using Spring boot and using separate Apache tomcat server? I need to send a soap request messages in a two way SSL connection security mechanism to a server and also process the Soap response from the server..I am using Spring MVC along with Spring ws  which is configured entirely using annotations and requires to be configured in two way SSL connection for sending soap requests to the Server.How can I have two way  SSL connection in my Spring MVC web service application in order to send my soap messages to the sever over SSL?.

A: I can guide you about all the required steps, but there are gaps. Please review my answer so I could provide you the right configuration links
Two-Way SSL is a TLS connection with client certificate authentication. It it not the same that signing soap request (certificate is used once to authenticate client in TLS (see Two-way SSL clarification), and sign a soap is make a digital signature over the soap body and include it in the soap header)
You need a lot of things (please check)

*

*A server to manage TLS connection. You have selected tomcat. No problem, but in my opinion is simpler to put an apache with reverse proxy

*An SSL certificate, preferably issued by a trusted entity. If not, you can generate your own certificate, but needs extra configuration in next steps

*The public key of the SSL certificate (the x509 certificate) to configure the client truststore

*A client certificate to be authenticated in TLS connection

*openssl software in order to generate certificates

*I also recommend using this application (http://portecle.sourceforge.net/)to modify JKS keystores and not a hell
Configure the server
1) Generate SSL certificate (server.crt and server.key)
If you have one, go to 2). If not, follow http://www.akadia.com/services/ssh_test_certificate.html
openssl genrsa -des3 -out server.key 1024
openssl req -new -key server.key -out server.csr
cp server.key server.key.org
openssl rsa -in server.key.org -out server.key
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

You'll get server.crt and server.key
2) Convert to PKCS12  (server.pfx)
Configuration will be simpler
If has provided you a certificate, also will give you a CACert.
openssl pkcs12 -export -out server.pfx -inkey server.key -in server.crt -certfile CACert.crt

3) Generate a client certificate (client.p12)
(extracted from https://gist.github.com/mtigas/952344)
    Create a Certificate Authority root
     openssl genrsa -des3 -out ca.key 4096
     openssl req -new -x509 -days 365 -key ca.key -out ca.crt
 Create the Client Key and CSR
 openssl genrsa -des3 -out client.key 4096
 openssl req -new -key client.key -out client.csr
 # self-signed
 openssl x509 -req -days 365 -in client.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out client.crt

 Convert Client Key to PKCS
 openssl pkcs12 -export -clcerts -in client.crt -inkey client.key -out client.p12

4) Configure server truststore (truststore.jks)
Open portecle
New KeyStore -> JKS
Import trusted certificate. Import client.crt and ca.crt
Save as truststore.jks

5) Configure tomcat SSL with client auth
https://tomcat.apache.org/tomcat-7.0-doc/config/http.html#SSL_Support
Similar  to Prashant Thorat answer
<Connector
    port="443"
    protocol="org.apache.coyote.http11.Http11NioProtocol"
    connectionTimeout="20000"
    redirectPort="8443"
    scheme="https"
    secure="true"
    SSLEnabled="true"
    sslProtocol="TLS"
    keystoreFile="server.pfx"
    keystorePass="thepassword"
    keystoreType="PKCS12"
    truststoreFile="truststore.jks"
    truststorePass="thepassword"
    truststoreType="JKS"
    clientAuth="true">

Configure the client
1) Create client trustore (client-truststore.jks)
Open portecle, create a new JKS and include server certificate (server.crt) as trusted (
2) Create client keystore (client-keystore.jks)
Open portecle, create a new JKS and import a key/pair. Use client.p12 or client.crt and client.key. Import also ca.crt
3) Configure spring
I've never done WS spring, but with CXF. It's the same concept
You do not need to sign SOAP, you only need a TLS connection with client auth, so no soap configuration needed
Follow this tutorial
https://secinto.wordpress.com/2013/01/21/spring-and-webservices-how-to-use-ssltls-client-authentication/
the key is
private void setupTLSSpring() throws Exception {

 ProtocolSocketFactory authSSLProtocolSocketFactory = new AuthSSLProtocolSocketFactory(new URL(
     "file:%PATH_TO_KEYSTORE%/client-keystore.jks"), PASSWORD, new URL(
     "file:%PATH_TO_TRUSTSTORE%/client-truststore.jks"), PASSWORD);

 Protocol.registerProtocol("https", new Protocol("https", authSSLProtocolSocketFactory, 8410));
 }

EDITED
If you use a Bank API, probably the bank provides the server with a trusted SSL certificate and a client certificate for authentication ¿It is not like this?
in this case forget 'configure server' section
In 'configure client' step 1, extract the public key from server SSL certificate and import into client-truststore.jks.
If some step is not suitable for your desired configuration, please detail it

A: I wanted to share a full tutorial and github project link which is telling about two way ssl connection in spring.
Full 2-way SSL Tutorial Link:
Everything You Ever Wanted to Know About SSL (but Were Afraid to Ask)
Github Project Link:
boot two way ssl example
UPDATE:
Actually, I have no same same code as requirement. But I got some links which are related to SSL. I am just sharing with you as helping hand.

*

*Making Authenticated Web Service Callouts Using Two-Way SSL

*Accessing RESTful services configured with SSL using RestTemplate

*HttpClient with SSL

A: First you have to check the spring documentation to understand the basics about spring security for web services: http://docs.spring.io/spring-ws/site/reference/html/security.html. I found another tutorial (XML too), that explains how to test your web service security: https://jeromebulanadi.wordpress.com/2010/02/25/basic-spring-web-service-tutorial-from-contract-to-security/#server_security
Then if you have any specific problem when doing the implementation edit your question.

A: I think the best thing you can do is configure a http server with SSL in front of your service. So you don't need to expose your service direct to the internet neither configure SSL in your services. And you can reuse it when you create more service.
Below I'm listing a tutorial to configure Nginx and Apache with SSL certificate and as a reverse proxy to your service.
SSL certificates:
Nginx
Nginx Two way SSL tutorial
Apache
Reverse Proxy:
Nginx
Apache


text:
Q: Making visualforce aware if it is being viewed on Salesforce1 I want my page to be aware if it is being viewed through the salesforce1 app or through a browser...
What is the best way to do this through visualforce markup?

A: You should be able to extract required information from page header, accessed by PageReference.
For more details refer https://www.salesforce.com/docs/developer/pages/Content/apex_system_pagereference.htm#RequestHeadersSection


text:
Q: (Data Structures: Linked List) Move odd items to the back of list I am supposed to implement a function void moveOddItemsToBack(LinkedList *ll) that moves all odd integers to back of the linked list ll.
It is able to compile and run, however the numbers are not in the right order and I am unsure why :( The code I have written is as shown:
void moveOddItemsToBack(LinkedList *ll)
{
    ListNode *cur = ll-> head;
    int orgsize = ll->size;
    index =0;

    //check for empty list
    if (cur == NULL) return;

    //if list not empty, traverse entire list
    while (orgsize > 0){

        //if odd no
        if (cur->item %2 !=0){
        insertNode(ll, ll->size, cur->item);  //insert the odd number into last item on list
        cur = cur -> next;
        removeNode(ll, index); //remove the odd number in the original index
        }

        //if not odd no, just continue traversing list
        else cur = cur -> next;

        orgsize--;   //original size decreases every while loop so as to inspect the original nodes' integers and not the integers i added to the back of list
        index++;  //index increases by 1 everytime i move my cur ptr to the next node
    }
}

Main code given:
#include <stdlib.h>

//////////////////////////////////////////////////////////////////////////////////

typedef struct _listnode
{
    int item;
    struct _listnode *next;
} ListNode;         // You should not change the definition of ListNode

typedef struct _linkedlist
{
    int size;
    ListNode *head;
} LinkedList;           // You should not change the definition of LinkedList

//////////////////////// function prototypes /////////////////////////////////////

// You should not change the prototype of this function
void moveOddItemsToBack(LinkedList *ll);

void printList(LinkedList *ll);
void removeAllItems(LinkedList *ll);
ListNode * findNode(LinkedList *ll, int index);
int insertNode(LinkedList *ll, int index, int value);
int removeNode(LinkedList *ll, int index);

//////////////////////////// main() //////////////////////////////////////////////

int main()
{
    LinkedList ll;
    int c, i, j;
    c = 1;
    //Initialize the linked list 1 as an empty linked list
    ll.head = NULL;
    ll.size = 0;

    printf("1: Insert an integer to the linked list:\n");
    printf("2: Move all odd integers to the back of the linked list:\n");
    printf("0: Quit:\n");

    while (c != 0)
    {
        printf("Please input your choice(1/2/0): ");
        scanf("%d", &c);

        switch (c)
        {
        case 1:
            printf("Input an integer that you want to add to the linked list: ");
            scanf("%d", &i);
            j = insertNode(&ll, ll.size, i);
            printf("The resulting linked list is: ");
            printList(&ll);
            break;
        case 2:
            moveOddItemsToBack(&ll); // You need to code this function
            printf("The resulting linked list after moving odd integers to the back of the linked list is: ");
            printList(&ll);
            removeAllItems(&ll);
            break;
        case 0:
            removeAllItems(&ll);
            break;
        default:
            printf("Choice unknown;\n");
            break;
        }
    }
    return 0;
}

Function removeNode given:

    ListNode *pre, *cur;

    // Highest index we can remove is size-1
    if (ll == NULL || index < 0 || index >= ll->size)
        return -1;

    // If removing first node, need to update head pointer
    if (index == 0){
        cur = ll->head->next;
        free(ll->head);
        ll->head = cur;
        ll->size--;

        return 0;
    }

    // Find the nodes before and after the target position
    // Free the target node and reconnect the links
    if ((pre = findNode(ll, index - 1)) != NULL){

        if (pre->next == NULL)
            return -1;

        cur = pre->next;
        pre->next = cur->next;
        free(cur);
        ll->size--;
        return 0;
    }

    return -1;
}

Function insertNode given:
int insertNode(LinkedList *ll, int index, int value){

    ListNode *pre, *cur;

    if (ll == NULL || index < 0 || index > ll->size)
        return -1;

    // If empty list or inserting first node, need to update head pointer
    if (ll->head == NULL || index == 0){
        cur = ll->head;
        ll->head = malloc(sizeof(ListNode));
        ll->head->item = value;
        ll->head->next = cur;
        ll->size++;
        return 0;
    }

    // Find the nodes before and at the target position
    // Create a new node and reconnect the links
    if ((pre = findNode(ll, index - 1)) != NULL){
        cur = pre->next;
        pre->next = malloc(sizeof(ListNode));
        pre->next->item = value;
        pre->next->next = cur;
        ll->size++;
        return 0;
    }

    return -1;
}

A: No need to count; just perform one pass over the linked list:

#include <stdio.h>

typedef struct zzz {
        struct zzz *next;
        int item;
        } LinkedList;

LinkedList items[] =
{ { items+1, 0 }
, { items+2, 1 }
, { items+3, 2 }
, { items+4, 3 }
, { items+5, 4 }
, { NULL, 5 }
        };

void moveOddItemsToBack(LinkedList **ll);
void moveOddItemsToBack(LinkedList **ll)
{

LinkedList *odds=NULL, **pp = &odds;

for ( ; *ll;    ) {
        LinkedList *this;
        this = *ll;
                /* leave this one; it is even */
        if ( !( this->item %2) ) {
                ll = &this->next;
                continue;
                }
                /* Skip over it (cut it out of the original list)
                ** , and append to the list of odds
                */
        *ll = this->next;
        *pp = this;
        pp = &this->next;
        }

        /* terminate odds-chain, and append to the tail of evens */
*pp = NULL;
*ll = odds;
}

int main(void)
{
LinkedList *root;
root = items;

moveOddItemsToBack(&root);

for (   ; root; root = root->next) {
        printf("%d\n", root->item);
        }
return 0;
}


text:
Q: App. name and bundle identifier change while uploading a new version - iTunes Connect I have uploaded an app, using iTunes Connect.
The current version details are as follows:
App Name:- App1
Bundle Identifier :- com.aaa.app1
version: 1.0

The new version I will be uploading will have the following details:
App Name:- App2
Bundle Identifier :- com.aaa.app2
version: 2.0

I don't want to add a new app in iTunes Connect, but replace the current app with a new app name and a new bundle identifier.
I know, the older app users will have 1.0 and 2.0 on their devices, but that's ok.
The new users should have version 2.0 only, is this (app name and bundle identifier name) allowed while uploading a new version (2.0)?

A: You cannot change the Bundle Identifier, that is unique for every app. The app name can be changed in the .plist file.


text:
Q: Use Azure availability set or deploy to single instances to paired region for HA Considering that Azure will not roll out an update on paired regions simultaneously during a planned maintenance of virtual machines with single-instance configurations, is it a good strategy to have single instance VMs in two different paired regions (let's say, North Europe & West Europe to cater to Europe customers for a simple workload) to achieve both HA & DR instead of having two VM instances in a availability set in a single region & achieve just HA?
Assuming I'm dealing with a small workload to be used by few users in Europe, is having single instances of sync-ed VMs in a paired region a cost effective &  workable approach to implement HA than having two VM instances in a availability set in a single region?

A: Could work for planned updates, but what happens during critical maintenance or unplanned situations? Also, even tho update roll outs are not started at the same time, your VMs could still have it's updates applied simultaneously as there are no shared "agenda" between data centers.
Said that, to load balance VMs you need then at the same region unless you plan to use traffic manager (round robin/failover) or any other custom solution.
Best scenario would be Traffic Manager on top of two different sites, but at least one of them with two or more VMs in a load-balanced set to avoid unavailability in a case of region/platform outage.


text:
Q: How does my Wi-Fi router seemingly cause lag in another hop? $ traceroute -I 203.195.123.148
traceroute to 203.195.123.148 (203.195.123.148), 64 hops max, 72 byte packets
 1  192.168.0.1 (192.168.0.1)  2.249 ms  1.187 ms  1.257 ms
    ...
 8  180.87.67.46 (180.87.67.46)  42.661 ms  53.478 ms  42.304 ms
 9  82.128-240-180.static.telin.sg (180.240.128.82)  47.088 ms  45.556 ms  45.246 ms
10  188.42.201.243 (188.42.201.243)  46.873 ms  53.112 ms  47.859 ms
11  188.42.201.3 (188.42.201.3)  46.001 ms  46.489 ms  47.864 ms
12  203.195.123.148 (203.195.123.148)  229.291 ms  297.407 ms  307.287 ms

$ traceroute -I 203.195.123.148
traceroute to 203.195.123.148 (203.195.123.148), 64 hops max, 72 byte packets
    ...
 7  180.87.67.46 (180.87.67.46)  41.017 ms  40.599 ms  40.889 ms
 8  82.128-240-180.static.telin.sg (180.240.128.82)  41.230 ms  41.232 ms  41.056 ms
 9  188.42.201.245 (188.42.201.245)  41.757 ms  41.439 ms  41.713 ms
10  188.42.201.3 (188.42.201.3)  42.223 ms  41.703 ms  42.934 ms
11  203.195.123.148 (203.195.123.148)  80.122 ms  80.107 ms  80.534 ms

First traceroute is with a connection via my Wi-Fi router and second without router. Although the 2nd hop with my router and 1st hop without my router are different, from there everything is the exact same (I've removed some of the initial IP addresses but you can see the IP addresses 8-12 in #1 and 7-11 in #2 are exact same) -- what I don't understand is the mysterious lag at the last hop.
How is it that when I'm connected via a Wi-Fi router, the last hop consistently take so much time vs when I'm connected directly, the last hop still takes time but is now not so bad (again, consistently)?

A: Looks like you are connected to some kind of "not so common" solution - at least not to me. A captive portal is usually used for open WLAN connections (hot spots). But there seem to be "PPPoE hotspots" out there, I just never encountered one myself. So thre will be the appropriate HW/SW (switch, PPPoE server, hotspot-server, etc. including a router ;) in the rented space you are connecting to.
But to answer your question, since you got the late link connecting directly as well, it's very unlikely that it is your WLAN-router's fault.
Update: the solution in the end was to let the ISP delete the IP lease so a new IP gets assigned.


text:
Q: SwiftUI: HitTest on Scenekit Goal: SceneKit hit test with SwiftUI (instead of UIKit)
Problem: When I embed the default ship scene on a SwiftUI "UIViewRepresentable", the example handleTap function doesn't work. and I get his error:
"Argument of '#selector' refers to instance method 'handleTap' that is not exposed to Objective-C"
How an I create a hit test, and pass data to another SwiftUI view?
import SwiftUI
import SceneKit

 var handleTap: (() -> Void)

struct ScenekitView : UIViewRepresentable {
    let scene = SCNScene(named: "ship.scn")!

    func makeUIView(context: Context) -> SCNView {
        // create and add a camera to the scene
        let cameraNode = SCNNode()
        cameraNode.camera = SCNCamera()
        scene.rootNode.addChildNode(cameraNode)

        // place the camera
        cameraNode.position = SCNVector3(x: 0, y: 0, z: 15)

        // retrieve the ship node
        let ship = scene.rootNode.childNode(withName: "ship", recursively: true)!

        // retrieve the SCNView
        let scnView = SCNView()
        return scnView
    }

    func updateUIView(_ scnView: SCNView, context: Context) {
        scnView.scene = scene

        // allows the user to manipulate the camera
        scnView.allowsCameraControl = true

        // show statistics such as fps and timing information
        scnView.showsStatistics = true

        // configure the view
        scnView.backgroundColor = UIColor.black

        // add a tap gesture recognizer
      let tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleTap(_:)))
      scnView.addGestureRecognizer(tapGesture)
    }

    func handleTap(_ gestureRecognize: UIGestureRecognizer) {
        // retrieve the SCNView
        let scnView = SCNView()

        // check what nodes are tapped
        let p = gestureRecognize.location(in: scnView)
        let hitResults = scnView.hitTest(p, options: [:])
        // check that we clicked on at least one object
        if hitResults.count > 0 {
            // retrieved the first clicked object
            let result = hitResults[0]

            // get material for selected geometry element
            let material = result.node.geometry!.firstMaterial

            // highlight it
            SCNTransaction.begin()
           SCNTransaction.animationDuration = 0.5

            // on completion - unhighlight
            SCNTransaction.completionBlock = {
                SCNTransaction.begin()
                SCNTransaction.animationDuration = 0.5

                material?.emission.contents = UIColor.black

                SCNTransaction.commit()
            }

            material?.emission.contents = UIColor.green

            SCNTransaction.commit()
        }
    }
}

#if DEBUG
struct ScenekitView_Previews : PreviewProvider {
    static var previews: some View {
        ScenekitView()
    }
}
#endif

A: Just hit this issue myself and finally found a solution: make a dummy struct that pulls from a class that actually holds your SCNView.
This works for me:
struct ScenekitView : UIViewRepresentable {
    let scenekitClass = ScenekitClass()

    func makeUIView(context: Context) -> SCNView {
        return scenekitClass.view
    }

    func updateUIView(_ scnView: SCNView, context: Context) {
        // your update UI view contents look like they can all be done in the initial creation
    }
}

class ScenekitClass {
    let view = SCNView()
    let scene = SCNScene(named: "ship.scn")!

    init() {
        // create and add a camera to the scene
        let cameraNode = SCNNode()
        cameraNode.camera = SCNCamera()
        scene.rootNode.addChildNode(cameraNode)

        // place the camera
        cameraNode.position = SCNVector3(x: 0, y: 0, z: 15)

        // attach the scene
        view.scene = scene

        // allows the user to manipulate the camera
        view.allowsCameraControl = true

        // show statistics such as fps and timing information
        view.showsStatistics = true

        // configure the view
        view.backgroundColor = UIColor.black

        // add a tap gesture recognizer
        let tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleTap(_:)))
        view.addGestureRecognizer(tapGesture)
    }

    @objc func handleTap(_ gestureRecognize: UIGestureRecognizer) {
        // check what nodes are tapped
        let p = gestureRecognize.location(in: view)
        let hitResults = view.hitTest(p, options: [:])
        // check that we clicked on at least one object
        if hitResults.count > 0 {
            // retrieved the first clicked object
            let result = hitResults[0]

            // get material for selected geometry element
            let material = result.node.geometry!.firstMaterial

            // highlight it
            SCNTransaction.begin()
            SCNTransaction.animationDuration = 0.5

            // on completion - unhighlight
            SCNTransaction.completionBlock = {
                SCNTransaction.begin()
                SCNTransaction.animationDuration = 0.5

                material?.emission.contents = UIColor.black

                SCNTransaction.commit()
            }

            material?.emission.contents = UIColor.green

            SCNTransaction.commit()
        }
    }
}

Based on this question.

A: For whatever reason, the SwiftUI SceneView does not conform to the SCNSceneRenderer protocol.  If it did, then it would not be necessary to make use of a UIViewRepresentable (or NSViewRepresentable for macOS) view.
I have a complete example app, for macOS, here:
https://github.com/Thunor/HitTestApp

A: SceneView has a delegate argument. You can use a SCNSceneRenderDelegate to capture the SCNSceneRenderer and use it for hit testing. Here's an example:
import SwiftUI
import SceneKit
import Foundation

class RenderDelegate: NSObject, SCNSceneRendererDelegate {
    // dummy render delegate to capture renderer

    var lastRenderer: SCNSceneRenderer!

    func renderer(_ renderer: SCNSceneRenderer, updateAtTime time: TimeInterval) {
        // store the renderer for hit testing
        lastRenderer = renderer
    }
}

class Model: ObservableObject {

    let scene = SCNScene(named: "scene.usdz")!
    let renderDelegate = RenderDelegate()

}

struct ContentView: View {

    @ObservedObject var model = Model()

    var body: some View {
        SceneView(scene: model.scene, options: [.allowsCameraControl, .autoenablesDefaultLighting], delegate: model.renderDelegate)
            .gesture(
                SpatialTapGesture(count: 1)
                    .onEnded(){ event in
                        // hit test
                        guard let renderer = model.renderDelegate.lastRenderer else { return }
                        let hits = renderer.hitTest(event.location, options: nil)
                        if let tappedNode = hits.first?.node {
                            // do something
                        }
                    }
            )
    }
}


text:
Q: Error importing tensorflow python 3.5.2 Microsoft Windows [Version 10.0.14393]

(c) 2016 Microsoft Corporation. All rights reserved.

C:\Users\Pedro>python

Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

.>>>import tensorflow as tf

Traceback (most recent call last):
  File "C:\Users\Pedro\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
    return importlib.import_module(mname)
  File "C:\Users\Pedro\AppData\Local\Programs\Python\Python35\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 577, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 906, in create_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Pedro\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\Pedro\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\Pedro\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
    return importlib.import_module('_pywrap_tensorflow_internal')
  File "C:\Users\Pedro\AppData\Local\Programs\Python\Python35\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Pedro\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "C:\Users\Pedro\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\__init__.py", line 51, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Users\Pedro\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 52, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:\Users\Pedro\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
    return importlib.import_module(mname)
  File "C:\Users\Pedro\AppData\Local\Programs\Python\Python35\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 577, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 906, in create_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Pedro\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\Pedro\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\Pedro\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
    return importlib.import_module('_pywrap_tensorflow_internal')
  File "C:\Users\Pedro\AppData\Local\Programs\Python\Python35\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'

Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_problems


text:
Q: Converting Integer to Double in Haskell I want to compound growth over a year but I don't care about decimal points, so I tried
take 52 $ iterate (floor . (*1.1)) 100

The problem is that the type of (floor . (*1.1)) is Double -> Integer, whereas the type expected by the first arg of iterate is a -> a.
I tried a couple of approaches, but ended up tying myself in knots.
What is the preferred solution to keeping numeric types consistent across function application?

A: The usual way to convert an Int to a Double is to use fromIntegral, which has the type (Integral a, Num b) => a -> b.  This means that it converts an Integral type (Int and Integer) to any numeric type b, of which Double is an instance.
Your case sounds like you want to convert a Double to an Int, which I would recommend floor for, but you'll have to make sure that your input is a Double.  For this, you can use the fromIntegral function with
take 52 $ iterate (floor . (* 1.1) . fromIntegral) 100

However, this will give you inaccurate results, since you are truncating at each step.  I would suggest doing
take 52 $ map floor $ iterate (* 1.1) $ fromIntegral 100


text:
Q: Electrons close to Fermi-Conductivity As a student of electrical and computer engineering solid state physics is not my thing so I might have fundamental blanks here and there. I really like this course and I try to gain as much as possible from it.
We've started doing a bit on the Fermi level and band theory. Our teacher stated that for a temperature above 0 Kelvin the Fermi-Dirac distribution is no longer a step function(giving 1 for energies lower than Fermi level and 0 for energies above). Now for a given Temperature T1 we have two energy levels E1 ( below Fermi) and E2 (above Fermi) for which f(E1)=0.1 and f(E2)=0.9.
"Only the electrons occupying energy states between E1 and E2 participate in conductivity"
I can't find this anywhere online and I can't understand why the higher value electrons (>E2) can't participate since they have greater energy. I could be using the wrong words on Google of course but I haven't had any luck after quite some time. Does this ring any bells?

A: The statement is true in some sense, but it is not very useful. It might lead people to expect that conductivity would decrease at lower temperature, which is wrong.
I believe that it is much better to say that all valence electrons participate in conduction. This gives the right drift velocity of electrons (as can be measured by the Hall effect). It also leads to the number of conduction electrons being independent of temperature. The model to explain this picture is that the whole Fermi sphere is displaced by an applied electric field.

The figure shows how the electron velocities are randomly distributed in all directions creating a sphere in velocity space up to the Fermi velocity. When an electric field is applied, the only states that change in occupancy are near the surface of the sphere, but the effect is that the whole sphere gets displaced by the average velocity $v_{\rm drift}$.
For more detail see for example here: http://what-when-how.com/electronic-properties-of-materials/electrical-conduction-in-metals-and-alloys-electrical-properties-of-materials-part-1/


text:
Q: How to pass selected resource absolute path as a program argument in Intellij Does anybody here know how to pass the selected resource path as an argument to "Run Configuration" in Intellij?
I have used Eclipse before and eclipse has this nice little option where you can pass ${selected_resource_loc} as the program argument and it takes the resource location, but I could not find an equivalent option to use in Intellij.

A: You may probably want to start your build process as an external tool (configured in "Settings">"External Tools"). Have the tool show in Project views and use $FileDir$ as an argument or working directory. Now you should be able to right-click a module/project/directory and start your process.

As far as I'm aware of, there is no direct equivalent in IntelliJ. You may set up different Environmental Variables in the Run Configurations within Intellij, but you'll have to define separate run configurations for each individual module.
You can open a feature request in their issue tracker, and maybe they'll implement it in a future release.


text:
Q: findall() in yii return array and i want it to return object how i have w function called update that i want to update a specific record in database according to module id (m_id) and key (key)
here is the function
public function updateRecord($module,$key,$newData){

    $id = $this->module($module);
    $model = new Form;
    $criteria = new CDbCriteria();
    $criteria->condition = "`m_id` = 1 AND `key` = 'txt'";
    // $model = Yii::app()->db->createCommand("SELECT * FROM `tbl_setting` WHERE `m_id` = 1 AND `key` = 'txt'")->query();

    die(var_dump($model->findAll($criteria)));
    // $model = Yii::app()->db->createCommand("SELECT * FROM `tbl_setting` WHERE `m_id` = 1 AND `key` = 'txt'")->execute();

    $model->m_id = $id ;
    $model->attributes = $newData;
    $model->save();
    //die(print_r($model['m_id']));
    //if(isset($_POST['save'])){
        //$model['m_id'] = $id;

    //}
}

every time i try to use this function it give me error that $model is not an object so it can't execute
$model->m_id = $id ;

i check out the type of findAll() and it gives an array
i checkout all find() methods and only findByPk() that give an object
and i want to choose  according to the $criteria and i don't know what to do any help ?! :)

A: findAll will always return an array. With objects if there are record found, or an empty array on no result. find only returns 1 record, or NULL if nothing is found:
http://www.yiiframework.com/doc/api/1.1/CActiveRecord#find-detail
Your code will be save when you do it like this:
if(!is_null($model)) {
    $model->m_id = $id ;
    $model->attributes = $newData;
    $model->save();
} else {
    echo 'No record found';
}


text:
Q: GCM encryption mode for Debian 7.6 Does an option exist for AES-GCM 256bit encryption for client connections with OpenVPN?
I've tried to google around this question, but found no algorithm how to patch my openvpn/openssl.
So my question is GCM mode support possible for OpenSSL 1.0.1e, OpenVPN 2.2.1, Debian GNU/Linux 7 (wheezy)?
If yes, what should I do exactly to get it?

A: There's two parts to this answer, since an OpenVPN connection consists of two parts. Part 1 is the control channel, this is a TLS connection over which OpenVPN sends control messages and keys for the second part; the data channel. The data channel is where the actual network packets are transferred over.
For the TLS control channel, support for GCM is available from OpenVPN 2.3.4+. By default, OpenVPN 2.3 will negotiate TLS 1.0, which has no support for GCM, but setting tls-version-min 1.0 in your config file (or supplying --tls-version-min 1.0 on the command line) will enable TLS version negotiation. That will give you TLS 1.2, which supports GCM mode.
For the data channel no support for GCM is available yet. Implementation is ongoing, and GCM will be available in OpenVPN 2.4+.
Edit:
And if you want to use a newer OpenVPN under Wheezy, take a look at the repos from openvpn.net:
https://community.openvpn.net/openvpn/wiki/OpenvpnSoftwareRepos


text:
Q: "The file was not precompiled and could not be requested" all of a sudden We are running several WebForms-Application on a Web Hoster (classic IIS, no Azure, no Docker, etc). For some months now, ca. once a month, one or more of these (virtual) applications stop working all of a sudden. In the Application Log Files there is an HttpException: "The file ....aspx was not precompiled and could not be requested." After redeploying (republishing) the application everything is working fine until next month. The Hoster did not find anything inside his log files.
What could be the problem? Where to start search?

A: Make sure that you used Release Mode, it is always recommended that you publish website in Release Mode


text:
Q: Is it normal for there to be a 5min+ period of high CPU usage when going to sleep under El Capitan? I have recently upgraded my 8GB MacBook Pro (mid 2010, model ID: MacBookPro6,2) from OS X 10.6.8 to 10.11.4.
Under Snow Leopard, after I closed the lid it would take something like 30 seconds to write memory contents to disk before the HDD would spin down and the sleep light begin to pulsate.
Under El Capitan, it takes five to six minutes between when I initiate sleep and when the machine actually powers down and the sleep light begins to pulsate.

*

*During this time there is very high CPU usage, as evidence by:

*

*The fans often spin up (to very high speed, if I have closed the lid and zipped the machine into the neoprene case I normally carry it in).

*The period of high CPU usage is clearly visible in Activity Monitor upon waking:

Screenshot after waking from full sleep; note CPU usage was very high, then moderately high while going to sleep; there is a momentary spike (presumably upon wake) and then drops to near idle again:

Sreenshot after putting machine back to sleep, then waking again after one minute (while machine was still busy); note CPU was near idle until sleep initiated, whereupon it was very, very high, then very high, then back to near idle upon wake:

*

*I note that /private/var/vm/sleepimage is exactly 4GiB, even though I have 8GiB of RAM.  It was previously 8GiB under Snow Leopard.

Question: Is this behaviour normal?  If not, what can I do to fix it?  If it is, is there anything that can be done to mitigate it?

A: Is it normal? No. Not with an optimal install, optimal hardware & configuration.
Is your computer stock or have you installed non-oem parts? Age can also be a factor as the thermal grease can deteriorate over time especially when a cpu gets overheated. Also Apple had indicated that you need a minimum of 1GB free to even be able to run effectively. My experience is that having much more than 1GB allows the system to run best.
What can you do to fix it? Take a free disk and install the OS on it. Boot from that disk and see if the problem disappears. If it is gone then it's a software issue. If it still exists, you have a hardware or resource issue. If it's software you can create a new user and log in under that account. If the problem is gone then it's the old user account. If it's not, do a clean install of the system. If the problem is gone then it was a problem with the system.
What can you do to mitigate it? See the second response to fix it or replace the machine.

A: Would just add - I had a similar problem with sleep on a MacPro 1.1 Tower. Turned out it was heat... which might explain why your fans are going up also. The Mac wont go to sleep above a certain temperature so will continue to run until this comes down which could be 60 seconds or 10 minutes.
I installed SMC Fan Control, a free app which allows you to take control of your internal fans and (typically) set them 25% higher. There is a free Temperature Monitor app that reads presents all the sensor values across your Mac. Sure enough, Ram and CPU were running 90+ degree under load (I'd installed additional server grade Ram previously. Whilst this wont kill them, its too high for sleep.
SMC sorted the temperature and the Mac sleeps in seconds now.


text:
Q: What do you call a person who tends to be assigned to a project when the project is struggling? In my company, there are a few people that are assigned to a project when the project needs to be "saved". It can be miscommunication with a customer, which needs quick resolution. It can be that we were executing on the wrong path. It can be that we need to go "back to the basics", re-think the goal and re-prioritize action items.
What do you call such a person?
I thought about "firefighter", but it's not quite the nuance I am looking for. "Firefighter" kind of implies that some damage is already done (downtime, data loss, money loss). I'm thinking rather that the project is like "we have enough time to steer away from the iceberg, if we knew how to turn this ship".
The project is pan-pan, not mayday. Another analogy from the Ground Proximity Warning Systems, the project is "GLIDESLOPE" or "SINK RATE", but not "TERRAIN".

A: Troubleshooter  Someone who goes in to find the problems & fix them so the project can be saved.
Merriam-Webster

3: a person skilled at solving or anticipating problems or difficulties

10 Kinds of Employee

The troubleshooter.
These are individuals whose job it is to solve problems for an organisation. They are great at strategising, have great interpersonal skills and encourage behaviours that boost workplace expertise. A must have for any company.

A: "Smokejumper" is the usual term, though it's a bit jargon-ey, and will make the most sense in the software domain.
Wilderness firefighting includes teams of "smokejumpers" who parachute in with equipment to get a fire under control. They are usually self-sufficient for a short time. The analogy is obvious.
I originally heard the term "flamejumper" in the early '90s, referring to bringing in high-powered experts to fix any sort of project, but since then the software field seems to have stabilized on "smokejumper", and re-pollinated everywhere else.
Unfortunately, google is so saturated with results for actual smokejumpers that the more metaphorical results are crowded out. If you use the term, it should be readily understandable though.

A: A few additional options:
secret weapon

something or someone that no one knows about and that will give you an advantage over your competitors or enemies:
Johann was the bank robbers' secret weapon - he knew how the security system worked.

ace - miky mentioned "ace in the hole", but just "ace" alone should be sufficient and well understood

a person who is very skilled at something:

clutch

2 : successful in a crucial situation

A: I immediately thought of fixer - they come in to fix unusual problems, often with unconventional methods.

: one that fixes: such as
a: a person who intervenes to enable someone
to circumvent the law or obtain a political favor
b: a person who
adjusts matters or disputes by negotiation

(From Merriam Webster)
In popular usage, there is a bit of a connotation that a fixer is used for illicit problems or uses illicit methods. But the way I think of it, that's only a very minor point. The main thing is they are brought in to help strange/unusual problems that may require strange/unconventional solutions. And that does seem exactly like what this person is all about in your organization.

A: They could be a reinforcement:

an addition of troops, supplies, etc., that augments the strength of an army or other military force

A: ace in the hole

A major advantage that one keeps hidden until an ideal time. The phrase originated in poker, in which an ace is the most valuable card.

(From the Free Dictionary)

A: In the west we often use the term "pinch hitter";

pinch hitter noun
1: a baseball player who is sent in to bat for another
2: a person who does another's work in an emergency

(From Merriam Webster)
The first definition alludes to the historical origin of the term, it's a person who is substituted into the batting order in a pinch (in this context a "pinch" means a critical point).
The term since spread outside of baseball, and is now commonly used for someone who is called upon to do emergency work when something is not going well.

A: A go-to guy is a trusted individual who can be relied upon to complete a particular task. It connotes competence and reliability, but doesn't necessarily capture the aspect of saving what would otherwise become a failure. A go-to guy is someone who will get the job done. Although it isn't required that someone else is already failing at the job, the go-to guy will perform better than others who might attempt it. Depending on the context, it could fit for your intended usage.

A: What's wrong with "Firefighter"?
The project is a burning dumpster in a river of excrement and the milestone is in 2 weeks. You need a firefighter, probably an integrated team of them.
I know this terminology; after all, it is sometimes me...
For all the people who objected to my answer, my brother-in-law is a pro firefighter (I mean he drives round in a big red vehicle with a helmet on) and they do a great deal of preventive work, visiting places like airports and making a fuss about hazards and risks.

A: Mister Fixit
Should be obvious, but, if necessary see: https://www.dictionary.com/browse/mr--fixit

A: point person

The person in the most prominent position on something, such as a spokesperson or manager .
One who goes ahead of a group in order to indicate the direction in which it should move. Hyponyms: point man, point woman.

(From Wiktionary)

A: If you prefer a general figurative/idiomatic phrase that can be used for someone who rescues/saves a project and in other situations also; I suggest knight in shining armour (armor in AmE):

If you refer to someone as a knight in shining armour, you mean that they are kind and brave, and likely to rescue you from a difficult situation.
Collins

Today, the phrase  can be used as gender-neutral in figurative usage. I've also found written evidence in a project management book within project rescue context. In the history, women could become a "dame" which was the female equivalent of knighthood. I've also come across the phrase "dame in shining armour" but it is not and shouldn't be needed in figurative usage. Chivalry today is having the knightly virtues and can be applied to anyone.
Cambridge definition and an example provided with a "she":

someone who saves you from a difficult or dangerous situation
She has arrived like a knight in shining armour at the eleventh hour, and she should be congratulated for that.

If you want a phrase specifically used in project management, project rescuer is used.

A: The term 'silver bullet' could also be applicable. Perhaps not as commonly used to refer to a person but certainly fits the theme.

A:
"Backup"
additional personnel who provide assistance

Merriam Webster

A: white knight:

1. a. A person (usually a man) who comes to the assistance or defence of another person, esp. one who appears unexpectedly; a defender or champion. Also in extended use.
1628   M. Mainwaring Vienna 24   He..seemed to threaten the world in her behalfe, which added this Article to Vienna's beleife, that he
undoubtedly was her white Knight.
2012   Times (Nexis) 22 Feb. 29   Republicans are flirting with an
equally unthinkable prospect: fielding a white knight to save them
from electoral oblivion.

The phrase probably originates from folk tales in which the hero is invariably tall, handsome, and dressed in white (the colour of purity and goodness) and always wins/slays the dragon, etc.


text:
Q: keytools -exportcert -list -v -alias androiddebugkey -keystore ~/.android/debug.keystore (for windows) Debug Signing Certificate SHA-1
I run a android project and I want to connect my project to firebase.
To do that I need the sha 1 key. for that reason I have to run this code in my terminal.
keytool -exportcert -list -v -alias androiddebugkey -keystore %USERPROFILE%\.android\debug.keystore

Lot of people use this article to to that.
in my case its not working in my computer.
How I just run this commend in my computer.
I use windows 10 and android 3.5
This is the screen shot of the problem
It will be more helpful if someone see my GitHub Repository.
:
I also see a approach in this article but I just want to run this commend in my computer.

A: First set Path in the Environment Variable
E.g C:\Program Files\Java\jdk1.8.0_211\bin <Map Your JDK path>

Then run your command.
Or you can do it with the following way.
You can generate in Android Studio
Find Gradle in the top right corner.
Doble clicks on SigningReport.

You will find it in the console.


text:
Q: WP Super Cache How to use the plugin with an SSL connection My site is in SSL mode, but the plugin didn't seem to work when I first installed it several days ago. And then I tried the cache test, I received the following error message:
arning: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in /var/www/html/abc.com/public_html/wp-includes/class-http.php on line 1008

Warning: stream_socket_client(): Failed to enable crypto in /var/www/html/abc.com/public_html/wp-includes/class-http.php on line 1008

Warning: stream_socket_client(): unable to connect to ssl://www.abc.com:443 (Unknown error) in /var/www/html/abc.com/public_html/wp-includes/class-http.php on line 1008

find /class-http.php on line 1008
$handle = stream_socket_client( $connect_host . ':' . $arrURL['port'], $connection_error, $connection_error_str, $connect_timeout, STREAM_CLIENT_CONNECT, $context );

So how can I use the plugin without disabling SSL?
THX


text:
Q: How to add UIView on a UICollectionView cell programmatically in swift override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
    let cell = collectionView.dequeueReusableCellWithReuseIdentifier("cell", forIndexPath: indexPath) as UICollectionViewCell
    var template: UIView
    template = UIView.init(frame: CGRectMake(10, 10, 50, 50))
    template.backgroundColor = UIColor.redColor()
    self.cell.addSubview(template)

    return cell
}

I tried dragging uiview into the collectionview cell on the storyboard and addSubview to the outlet but it also wont work.

A: The "self" in self.cell implies that it references a class/global variable, not the cell you create at the top of the method. Try changing self.cell.addSubview(template) to cell.addSubview(template).
Also
var template: UIView
template = UIView.init(frame: CGRectMake(10, 10, 50, 50))

can be simplified to:
let template = UIView(frame: CGRectMake(10, 10, 50, 50))


text:
Q: display:inline-flex resizing to child contents but can't use in react-native I have put a demo of what I want to achieve with a flex layout here:
https://jsfiddle.net/airwalker/zjd730x7/
Essentially my layout works when using
{
  display: inline-flex;
}

but not
{
  display: flex;
}

In short I want the behaviour of the display: inline-flex where the container will resize to the child content but still be constrained with a max-width.
However I am using react-native which does not support the full flexbox specification, and does not support inline-flex.
What other way could I achieve my desired output using CSS?
Many thanks


text:
Q: Couldn't able to connect to APNS Sandbox server I am trying to  connect to Apple APNS server with the following observations:
1)port 2195 is open 2)With Valid key passphrase for APNS_SSLCertificate_Key.pem 3)Entrust certificate (2048) downloaded from https://www.entrust.net/downloads/binary/entrust_ssl_ca.cer
4)With the successful telnet response as below :

$ telnet gateway.sandbox.push.apple.com 2195 Trying 17.172.232.226...
  Connected to gateway.sandbox.push-apple.com.akadns.net. Escape
  character is '^]'.

But when i run the following openssl command in my server to test the APNS connectivity :
openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert  APNS_SSLCertificate_Key.pem -debug -showcerts -CAfile server-ca-cert.pem

I am getting error as follows:

unable to load certificate 57013:error:0906D06C:PEM
  routines:PEM_read_bio:no start
  line:/SourceCache/OpenSSL098/OpenSSL098-35/src/crypto/pem/pem_lib.c:650:Expecting:
  TRUSTED CERTIFICATE

So please suggest how to resolve this problem
Thanks in advance ......

A: I ran into this same issue; what eventually resolved the error was to re-export the Entrust certificate from System Roots of OS/X Keychain Access application.
To be complete, I'll give a complete explanation of how I created the key/cert files (something which should have been in Apple's TechNote 2265: https://developer.apple.com/library/content/technotes/tn2265/_index.html)
Creating your APN-cert-and-key:

*

*Run Keychain Access; select "login" Keychain and "My Certificates" category

*Select the certificate with the name format of "Apple Development IOS Push Services: ..."

*Export the certificate (in the menu, under "File" .. "Export Items")

*Export to .p12 format.

This now contains your certificate and private key in an encrypted interchange format.  The next step is to convert it to a passphrase protected .pem file

*Using terminal, execute the following command (using your own filenames, of course):
openssl pkcs12 -in PushCertKey.p12 -out PushCertKey.pem

(You will need to enter the password for the .p12 file and provide another passphrase for the .pem file.)
If you really really really don't want a passphrase on the .pem file, try:
openssl pkcs12 -in PushCertKey.p12 -out PushCertKeyNoCrypt.pem -nodes

Creating CA Certificate file:

*

*List item

*Run Keychain Access application

*Go to System Roots

*Export the certificate named "Entrust.net Certification Authority (2048)" to a .pem file.
Note: My Roots container has four Entrust certificates; two of them with the name "Entrust.net Certification Authority (2048)" (but with different certificate extensions, via Get Info).  Both of the "Entrust.net Certification Authority (2048)" certificates where effective in validating the trust chain; the other two Entrust certificates did not work.  More significantly, the Entrust certificate pointed at by the Apple TechNote 2265 also does not work.

Make sure you export to .pem format; the default is .cer and this step is easy to miss.

Run the verification command:
openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert PushCertKey.pem -debug -showcerts -CAfile "Entrust.net Certification Authority (2048).pem"

This server and process assume that your are connecting to Apple's Dev sandbox APN server; if you are trying to use the production APN server, you will need to use the correct server and port.
For more information on openssl, I suggest the following pages:

*

*https://www.madboa.com/geek/openssl/

*https://www.sslshopper.com/article-most-common-openssl-commands.html

*http://gagravarr.org/writing/openssl-certs/general.shtml

A: SSL problems: Step wise fix.
Most of the problems are due to the private key issues, which can be resolved as follows.
Follow the following commands and create the .p12 using openssl.

*

*You will need
developer_identity.cer <= download from Apple
mykey.p12 <= Your private key

*Run these commands in your terminal where openssl is configured,installed or working:

*

*openssl x509 -in developer_identity.cer -inform DER -out developer_identity.pem -outform PEM

*openssl pkcs12 -nocerts -in mykey.p12 -out mykey.pem

*openssl pkcs12 -export -inkey mykey.pem -in developer_identity.pem -out iphone_dev.p12

Final p12 that you will require is iphone_dev.p12 file and the passphrase that you had set.
Try again, hope your problem is fixed, as it always does for me. :)


text:
Q: does setting enablessl=true in c# mean secured ftp If we  just set EnableSsl=true in c# ftpWebrequest code, does this mean that a secured ftp is being done. Or else what is the right way to do a secured ftp in iis6.0. Please suggest

A: It means the request is sending AUTH TLS  command to the server and in case the FTP server does not support SSL it will throw exception.
So yes, if you don't get error it means that the data you send will be sent encrypted and it won't be possible to steal the data.
Information is taken from official documentation.

A: EnableSsl=true this mean that you want to connect to FTP server that work on SSL protocol
 your FTP server should already be configured to work on SSL


text:
Q: Getting Started with SWIG and Visual Studio I'm trying to create my first SWIG python DLL with Visual Studio 2010, using an example I downloaded from swig,org.  I'm running Windows professional 64-bit.  I downloaded swigwin-2.0.7 and unzipped it. I've followed the instructions here and here and in both cases, the wrap file gets built, but the project build fails.  The linker complains about 56 unresolved external symbols, all with names something like __imp__PyBytes_AsStringAndSize or __imp__PyExc_RuntimeError.
I've tried this using my python 2.7 installation as well as my python 3.2 installation, with similar results.  Do I have to build swig from the source for my platform?  I've spent the last 6 hours or so on this, and I'm nonplussed.

A: Following the instructions here, using the simple Python example from SWIG, Windows 7 64-bit and Python 2.7 32-bit, I did not see the OP's specific errors.  I saw:
1>example_wrap.obj : error LNK2019: unresolved external symbol "int __cdecl gcd(int,int)" (?gcd@@YAHHH@Z) referenced in function __wrap_gcd
1>example_wrap.obj : error LNK2001: unresolved external symbol "double Foo" (?Foo@@3NA)

Two changes had to be made due to the simple example being C source instead of C++:

*

*Do not use the -c++ switch on the swig command line (step 13 of the instructions).

*The generated file is now example_wrap.c not example_wrap.cxx (referred to in steps 14 and 19 of the instructions).

Alternatively, just rename example.c to example.cpp in this case before following the instructions and they should work as is.


text:
Q: Read text-file into program as dictionary Using Python 3.
I have to write a function that take one argument (a string), and must return a dictionary from a txt-file that contains names of the sequences (keys) and the sequences (values). Both keys and values must be strings.
The text-file:
Read1 GGCTCCCCACGGGGTACCCATAACTTGACAGTAGATCTCGTCCAGACCCCTAGC
Read2 CTTTACCCGGAAGAGCGGGACGCTGCCCTGCGCGATTCCAGGCTCCCCACGGG
Read4 TGCGAGGGAAGTGAAGTATTTGACCCTTTACCCGGAAGAGCG
Read3 GTCTTCAGTAGAAAATTGTTTTTTTCTTCCAAGAGGTCGGAGTCGTGAACACATCAGT
Read5 CGATTCCAGGCTCCCCACGGGGTACCCATAACTTGACAGTAGATCTC
Read6 TGACAGTAGATCTCGTCCAGACCCCTAGCTGGTACGTCTTCAGTAGAAAATTGTTTTTTTCTTCCAAGAGGTCGGAGT

I've come this far, but I think I am missing something and I don't know if what my work here is correct. I've marked the lines (with #) where I'm in doubt whether it is correct or not.
def read_data(file_name):
    input_file=open(sequencing_reads.txt)
    #sequence_dict={}
    for line in input_file:
        #x=line.split(",")
    #return sequence_dict
    input_file.close()

I know it must return the dictionary with the following content:
{'Read1': 'GGCTCCCCACGGGGTACCCATAACTTGACAGTAGATCTCGTCCAGACCCCTAGC',
 'Read2': 'CTTTACCCGGAAGAGCGGGACGCTGCCCTGCGCGATTCCAGGCTCCCCACGGG',
 'Read4': 'TGCGAGGGAAGTGAAGTATTTGACCCTTTACCCGGAAGAGCG',
 'Read3': 'GTCTTCAGTAGAAAATTGTTTTTTTCTTCCAAGAGGTCGGAGTCGTGAACACATCAGT',
 'Read5': 'CGATTCCAGGCTCCCCACGGGGTACCCATAACTTGACAGTAGATCTC',
 'Read6': 'TGACAGTAGATCTCGTCCAGACCCCTAGCTGGTACGTCTTCAGTAGAAAATTGTTTTTTTCTTCCAAGAGGTCGGAGT'}

Can you help me fill out the gaps?
EDIT: I need to keep it simple so please no imports of packages and smart tricks :-)
EDIT 2:
I've tried this too:
with open('sequencing_reads.txt', 'r') as document:
    answer = {}
    for line in document:
        line = line.split()
        if not line:
            continue
        answer[line[0]] = line[1:]
print(answer)

The output is:
{'Read1': ['GGCTCCCCACGGGGTACCCATAACTTGACAGTAGATCTCGTCCAGACCCCTAGC'], 'Read2': ['CTTTACCCGGAAGAGCGGGACGCTGCCCTGCGCGATTCCAGGCTCCCCACGGG'], 'Read4': ['TGCGAGGGAAGTGAAGTATTTGACCCTTTACCCGGAAGAGCG'], 'Read3': ['GTCTTCAGTAGAAAATTGTTTTTTTCTTCCAAGAGGTCGGAGTCGTGAACACATCAGT'], 'Read5': ['CGATTCCAGGCTCCCCACGGGGTACCCATAACTTGACAGTAGATCTC'], 'Read6': ['TGACAGTAGATCTCGTCCAGACCCCTAGCTGGTACGTCTTCAGTAGAAAATTGTTTTTTTCTTCCAAGAGGTCGGAGT']}

How do I get rid of the "[ ]" around my sequences?
EDIT4:
def read_data(file_name):
    with open("sequencing_reads.txt", "r") as document:
        answer = {}
        for line in document:
            line = line.split()
            if not line:
                continue
                answer[line[0]] = line[1:]
                final_answer = {a:b[0] for a, b in answer.items()}
final_answer = read_data("sequencing_reads.txt")
print(final_answer)

prints:
None

A: You can try this:
import re
def read_data(file_name):
   data = open(file_name).read()
   keys = [filter(lambda x:bool(x), i)[0][1:-1] for i in re.findall("{(.*?)\:|(?<=,\n\s)(.*?)\:", data)]
   values = [filter(lambda x:bool(x), i)[0][1:-1] for i in re.findall('(?<=:\s)(.*?)(?=,\n)|(?<=\s)(.*?)(?=})', data)]
   final_data = {a:b for a, b in zip(keys, values)}
   return final_data

Output:
{'Read1': 'GGCTCCCCACGGGGTACCCATAACTTGACAGTAGATCTCGTCCAGACCCCTAGC', 'Read3': 'GTCTTCAGTAGAAAATTGTTTTTTTCTTCCAAGAGGTCGGAGTCGTGAACACATCAGT', 'Read2': 'CTTTACCCGGAAGAGCGGGACGCTGCCCTGCGCGATTCCAGGCTCCCCACGGG', 'Read5': 'CGATTCCAGGCTCCCCACGGGGTACCCATAACTTGACAGTAGATCTC', 'Read4': 'TGCGAGGGAAGTGAAGTATTTGACCCTTTACCCGGAAGAGCG', 'Read6': "'Read6': 'TGACAGTAGATCTCGTCCAGACCCCTAGCTGGTACGTCTTCAGTAGAAAATTGTTTTTTTCTTCCAAGAGGTCGGAGT"}

Edit:
import ast
def read_data(file_name):
   final_data = ast.literal_eval(open(file_name).read())
   return final_data

Edit 1: Regarding the removal of the brackets, just access the value by indexing:
final_answer = {a:b[0] for a, b in answer.items()}
print(final_answer)

If you are having issues printing the value returned from read_data, you can try this:
answer = read_data("the_file.txt")
print(answer)

Edit 3:
def read_data(file_name):
   with open(file_name, "r") as document:
      answer = {}
      for line in document:
         line = line.split()
         if line:
            answer[line[0]] = line[1:]
      return {a:b[0] for a, b in answer.items()}

print(read_data("sequencing_reads.txt"))

A: Your file "sequencing_reads.txt" is in json format. You can use the json module in the python standard library to load your content into a dictionary quite easily.
import json

with open("sequencing_reads.txt") as f:
    sequence_dict = json.load(f)

A: Firstly, if your file is in json format and in separate lines, you should read it into a single line, maybe like this:
def read_data(file_name):
    lines = open(file_name).readlines()
    merged_line = " ".join([line.strip() for line in lines])

Secondly, The json.loads requires double quotes for the string(eg: {"a":"a"}). If you are using single quote(as in your example), there may be errors. So you can do like this:
# 1,use json.loads, but replace first
import json
merged_line = merged_line.replace("'", '"')
data = json.loads(merged_line)

# 2,use ast
import ast
data = ast.literal_eval(merged_line)