text:
Q: Is the condition "quasi-coherent" necessary? In Qing Liu's "Algebraic Geometry and Arithmetic Curves", page 161,
Definition 1.10. Let $(X,\mathcal O_X)$ be a ringed topological space, and let $\mathcal F$ be an $\mathcal O_X$-module. We say that $\mathcal F$ is finitely generated If for every $x\in X$, there exist an open neighborhood $U$ of $x$, an integer $n\ge 1$, and a surjective homomorphism $\mathcal O^n_X|_U\to \mathcal F|_U$.
In page 162,
Proposition 1.12. Let $X$ be a scheme. We have the following properties for $\mathcal O_X$-modules.
(a) A direct sum of quasi-coherent sheaves is quasi-coherent; a finite direct sum of finitely generated quasi-coherent sheaves is finitely generated.
In the last half of Proposition 1.12 (a)--"a finite direct sum of finitely generated quasi-coherent sheaves is finitely generated", is the condition "quasi-coherent" necessary?
Now I'll show that a finite direct sum of finitely generated sheaves is finitely generated.
Let $\mathcal F_i(i=1,2,\cdots,k)$ be finitely generated $\mathcal O_X$-modules.
For every $x\in X$, there exist an open neighborhood $U_i$ of $x$, an integer $n_i\ge 1$, and a surjective homomorphism $\alpha_i:\mathcal O^{n_i}_X|_{U_i}\to \mathcal F_i|_{U_i}$.
Let $U=\bigcap_{i=1,2,\cdots,k}U_i$.
We define $\oplus_{i=1,2,\cdots,k}\alpha_i:\mathcal O^{n_1+n_2+\cdots+n_k}_X|_U\to (\bigoplus_{i=1,2,\cdots,k}\mathcal F_i)|_U$ by
$(\oplus_{i=1,2,\cdots,k}\alpha_i)(V):(a_1,a_2,\cdots,a_k)\mapsto (\alpha_1(V)(a_1),\alpha_2(V)(a_2),\cdots,\alpha_k(V)(a_k)),a_i\in \mathcal O^{n_i}_X(V),\textrm{open set $V\subset U$}.$
$\forall x\in U, ((\bigoplus_{i=1,2,\cdots,k}\mathcal{F}_i)|_U)_x\simeq \bigoplus_{i=1,2,\cdots,k}(\mathcal{F}_i|_U)_x.$
Then $\oplus_{i=1,2,\cdots,k}\alpha_i$ is surjective, so a finite direct sum of finitely generated $\mathcal O_X$-modules is finitely generated.
Is my argument correct?

A: Yes, your argument is correct. Quasi-coherence is not necessary. And indeed this is true (and your proof valid) with $X$ an arbitrary ringed space.


text:
Q: Rails 3.2.5 Sorcery and delayed job integration to send emails I am developing a Rails 3.2.5 application with Sorcery for authentication and delayed_job for background processing [ sorcery (0.7.12), delayed_job (3.0.3), delayed_job_active_record (0.3.2) ].
My Sorcery configuration looks like this:
Rails.application.config.sorcery.submodules = [:remember_me, :reset_password, :user_activation, :brute_force_protection, :activity_logging, :external]

Rails.application.config.sorcery.configure do |config|
  --[clip]

  config.user_config do |user|
    user.user_activation_mailer = UserMailer
    user.activation_success_email_method_name = nil
  end

  config.user_class = "Account"
  module Sorcery
    module Model
      module InstanceMethods
        def generic_send_email(method, mailer)
          config = sorcery_config
          mail = config.send(mailer).delay.send(config.send(method), self)
        end
      end
    end
  end
end

Gemfile
source 'https://rubygems.org'

gem 'rails', '3.2.5'

# gem 'thin' # delayed_job has problems with this

gem 'pg'
gem 'mongrel', '1.2.0.pre2'
gem 'bcrypt-ruby', '~> 3.0.0'
gem 'sorcery'
gem 'simple_form'
gem 'high_voltage' # static pages
gem 'squeel'
gem 'kaminari'
gem 'bourbon'
gem 'rabl'
gem 'yajl-ruby'
gem 'geocoder'
gem "carrierwave"
gem "cloudinary"
gem 'haml'
gem 'rails-settings-cached'
gem 'configatron'
gem 'store_configurable'
gem 'has_serialized'
gem 'rolify'
gem 'cancan'
gem 'delayed_job_active_record'
gem 'simple_postmark'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
    gem 'bootstrap-sass'
  gem 'sass-rails', '~> 3.2.3'
  gem 'uglifier', '>= 1.0.3'
  gem 'therubyracer'
  gem 'execjs'
end

gem 'jquery-rails'

group :development, :test do
   gem 'rspec'
   gem 'rspec-rails' , ">= 2.5.0"
   gem 'rails3-generators'
   gem 'hpricot'  # needed by devise views generator
   gem 'awesome_print'
end

While creating account, a job is added to delayed_jobs table but with a error:
"{Job failed to load: uninitialized constant BCrypt. Handler: "--- !ruby/object:Delayed::PerformableMailer \nargs: \n- :activation_needed_email_method_name\n- !ruby/ActiveRecord:Account \n  attributes: \n    id: 100\n    username: student.ten@retinaindia.org\n    email: student.ten@retinaindia.org\n    crypted_password: !str:BCrypt::Password \n      str: $2a$10$ndL2tnPLheemvBsNqPXMwew6Pakf/Kf8xxt1Q54xkRWS3JfMaTAC6\n      :@checksum: w6Pakf/Kf8xxt1Q54xkRWS3JfMaTAC6\n      :@cost: 10\n      :@salt: $2a$10$ndL2tnPLheemvBsNqPXMwe\n      :@version: !str:BCrypt::Password 2a\n    salt: Aatzxp2m4fp2CYy9ZoCr\n    user_id: 74\n    user_type: Student\n    created_at: &id001 2012-07-09 08:34:23.981292 Z\n    updated_at: *id001\n    remember_me_token: \n    remember_me_token_expires_at: \n    reset_password_token: \n    reset_password_token_expires_at: \n    reset_password_email_sent_at: \n    failed_logins_count: 0\n    lock_expires_at: \n    unlock_token: \n    last_login_at: \n    last_logout_at: \n    last_activity_at: \n    activation_state: pending\n    activation_token: 7XAssTaEqsorDWpbpUY9\n    activation_token_expires_at: \n    created_by: Admin\nmethod_name: :send\nobject: !ruby/class UserMailer\n"
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/backend/base.rb:86:in `rescue in payload_object'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/backend/base.rb:84:in `payload_object'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/backend/base.rb:94:in `block in invoke_job'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:60:in `call'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:60:in `block in initialize'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:65:in `call'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:65:in `execute'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:38:in `run_callbacks'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/backend/base.rb:91:in `invoke_job'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/worker.rb:182:in `block (2 levels) in run'
/home/syed/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/timeout.rb:57:in `timeout'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/worker.rb:182:in `block in run'
/home/syed/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/benchmark.rb:309:in `realtime'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/worker.rb:181:in `run'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/worker.rb:238:in `block in reserve_and_run_one_job'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:60:in `call'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:60:in `block in initialize'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:65:in `call'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:65:in `execute'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:38:in `run_callbacks'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/worker.rb:238:in `reserve_and_run_one_job'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/worker.rb:166:in `block in work_off'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/worker.rb:165:in `times'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/worker.rb:165:in `work_off'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/worker.rb:133:in `block (4 levels) in start'
/home/syed/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/benchmark.rb:309:in `realtime'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/worker.rb:132:in `block (3 levels) in start'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:60:in `call'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:60:in `block in initialize'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:65:in `call'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:65:in `execute'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:38:in `run_callbacks'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/worker.rb:129:in `block (2 levels) in start'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/worker.rb:128:in `loop'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/worker.rb:128:in `block in start'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/plugins/clear_locks.rb:7:in `call'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/plugins/clear_locks.rb:7:in `block (2 levels) in <class:ClearLocks>'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:78:in `call'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:78:in `block (2 levels) in add'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:60:in `call'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:60:in `block in initialize'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:78:in `call'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:78:in `block in add'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:65:in `call'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:65:in `execute'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:38:in `run_callbacks'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/worker.rb:127:in `start'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/command.rb:101:in `run'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/command.rb:89:in `block in run_process'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/daemons-1.0.10/lib/daemons/application.rb:215:in `call'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/daemons-1.0.10/lib/daemons/application.rb:215:in `block in start_proc'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/daemons-1.0.10/lib/daemons/daemonize.rb:192:in `call'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/daemons-1.0.10/lib/daemons/daemonize.rb:192:in `call_as_daemon'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/daemons-1.0.10/lib/daemons/application.rb:219:in `start_proc'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/daemons-1.0.10/lib/daemons/application.rb:255:in `start'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/daemons-1.0.10/lib/daemons/application_group.rb:123:in `block (2 levels) in start_all'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/daemons-1.0.10/lib/daemons/application_group.rb:122:in `fork'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/daemons-1.0.10/lib/daemons/application_group.rb:122:in `block in start_all'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/daemons-1.0.10/lib/daemons/application_group.rb:121:in `each'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/daemons-1.0.10/lib/daemons/application_group.rb:121:in `start_all'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/daemons-1.0.10/lib/daemons/controller.rb:79:in `run'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/daemons-1.0.10/lib/daemons.rb:188:in `block in run_proc'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/daemons-1.0.10/lib/daemons/cmdline.rb:105:in `call'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/daemons-1.0.10/lib/daemons/cmdline.rb:105:in `catch_exceptions'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/daemons-1.0.10/lib/daemons.rb:187:in `run_proc'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/command.rb:87:in `run_process'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/command.rb:80:in `block in daemonize'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/command.rb:78:in `times'
/home/syed/.rvm/gems/ruby-1.9.2-p0/gems/delayed_job-3.0.3/lib/delayed/command.rb:78:in `daemonize'
script/delayed_job:5:in `<main>'"

This is the handler:
"--- !ruby/object:Delayed::PerformableMailer
args:
- :activation_needed_email_method_name
- !ruby/ActiveRecord:Account
  attributes:
    id: 100
    username: student.ten@retinaindia.org
    email: student.ten@retinaindia.org
    crypted_password: !str:BCrypt::Password
      str: $2a$10$ndL2tnPLheemvBsNqPXMwew6Pakf/Kf8xxt1Q54xkRWS3JfMaTAC6
      :@checksum: w6Pakf/Kf8xxt1Q54xkRWS3JfMaTAC6
      :@cost: 10
      :@salt: $2a$10$ndL2tnPLheemvBsNqPXMwe
      :@version: !str:BCrypt::Password 2a
    salt: Aatzxp2m4fp2CYy9ZoCr
    user_id: 74
    user_type: Student
    created_at: &id001 2012-07-09 08:34:23.981292 Z
    updated_at: *id001
    remember_me_token:
    remember_me_token_expires_at:
    reset_password_token:
    reset_password_token_expires_at:
    reset_password_email_sent_at:
    failed_logins_count: 0
    lock_expires_at:
    unlock_token:
    last_login_at:
    last_logout_at:
    last_activity_at:
    activation_state: pending
    activation_token: 7XAssTaEqsorDWpbpUY9
    activation_token_expires_at:
    created_by: Admin
method_name: :send
object: !ruby/class UserMailer
"

[edit]
This error is thrown when it is unable to perform YAML.load. But, weirdly enough when I tried to manually do that in the console, it is loaded with any problems.
ruby-1.9.2-p0 > YAML.load("--- !ruby/object:Delayed::PerformableMailer
ruby-1.9.2-p0"> args:
ruby-1.9.2-p0"> - !ruby/ActiveRecord:Account
ruby-1.9.2-p0">   attributes:
ruby-1.9.2-p0">     id: 106
ruby-1.9.2-p0">     username: student.two@retinaindia.org
ruby-1.9.2-p0">     email: student.two@retinaindia.org
ruby-1.9.2-p0">     crypted_password: !str:BCrypt::Password
ruby-1.9.2-p0">       str: $2a$10$przMrMWjJqTetGj4IhLsEO9AjM12rnTuP2ZiJwz1xzSgr70dvJdM2
ruby-1.9.2-p0">       :@checksum: 9AjM12rnTuP2ZiJwz1xzSgr70dvJdM2
ruby-1.9.2-p0">       :@cost: 10
ruby-1.9.2-p0">       :@salt: $2a$10$przMrMWjJqTetGj4IhLsEO
ruby-1.9.2-p0">       :@version: !str:BCrypt::Password 2a
ruby-1.9.2-p0">     salt: f5CppR8NySi4VEEFNcLT
ruby-1.9.2-p0">     user_id: 81
ruby-1.9.2-p0">     user_type: Student
ruby-1.9.2-p0">     created_at: &id001 2012-07-09 11:08:49.705831 Z
ruby-1.9.2-p0">     updated_at: *id001
ruby-1.9.2-p0">     remember_me_token:
ruby-1.9.2-p0">     remember_me_token_expires_at:
ruby-1.9.2-p0">     reset_password_token:
ruby-1.9.2-p0">     reset_password_token_expires_at:
ruby-1.9.2-p0">     reset_password_email_sent_at:
ruby-1.9.2-p0">     failed_logins_count: 0
ruby-1.9.2-p0">     lock_expires_at:
ruby-1.9.2-p0">     unlock_token:
ruby-1.9.2-p0">     last_login_at:
ruby-1.9.2-p0">     last_logout_at:
ruby-1.9.2-p0">     last_activity_at:
ruby-1.9.2-p0">     activation_state: pending
ruby-1.9.2-p0">     activation_token: YZWfZBoGZj2qC6sVHsbQ
ruby-1.9.2-p0">     activation_token_expires_at:
ruby-1.9.2-p0">     created_by: Self
ruby-1.9.2-p0"> method_name: :activation_needed_email
ruby-1.9.2-p0"> object: !ruby/class Notifier
ruby-1.9.2-p0"> ")
  Account Load (2.4ms)  SELECT "accounts".* FROM "accounts" WHERE "accounts"."id" = $1 LIMIT 1  [["id", 106]]
 => #<Delayed::PerformableMailer:0x9b39a08 @args=[#<Account id: 106, username: "student.two@retinaindia.org", email: "student.two@retinaindia.org", crypted_password: "$2a$10$przMrMWjJqTetGj4IhLsEO9AjM12rnTuP2ZiJwz1xzSg...", salt: "f5CppR8NySi4VEEFNcLT", user_id: 81, user_type: "Student", created_at: "2012-07-09 11:08:49", updated_at: "2012-07-09 11:08:49", remember_me_token: nil, remember_me_token_expires_at: nil, reset_password_token: nil, reset_password_token_expires_at: nil, reset_password_email_sent_at: nil, failed_logins_count: 0, lock_expires_at: nil, unlock_token: nil, last_login_at: nil, last_logout_at: nil, last_activity_at: nil, activation_state: "pending", activation_token: "YZWfZBoGZj2qC6sVHsbQ", activation_token_expires_at: nil, created_by: "Self">], @method_name=:activation_needed_email, @object=Notifier>

A: Answering my own question since the following approach works for me now at least.

*

*require 'bcrypt' in delayed_job_config.rb

    require "bcrypt"
if defined?(BCrypt)
  puts "BCrypt defined."
else
  puts "BCrypt failed loaded!!"
end

Delayed::Worker.destroy_failed_jobs = false

2. Still can't get user_activation module of Sorcery to work and send emails automatillay through delayed_job. Had to disable that module altogether and send activation mails manually.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Basemap imported BUT "TypeError: 'module' object is not callable" Trying to recreate the Earth plotting from here on Mac High Sierra:
https://jakevdp.github.io/PythonDataScienceHandbook/04.13-geographic-data-with-basemap.html
Installed basemap and prerequisites via pip-3.7/macports and the following:
sudo pip-3.7 install https://github.com/matplotlib/basemap/archive/master.zip

Tried reverting to matlibplot==2.2 as per older post:
Installing basemap on Mac / Python
import mpl_toolkits.basemap as Basemap
plt.figure(figsize=(8, 8))
m = Basemap(projection='ortho', resolution=None, lat_0=50, lon_0=-100)
m.bluemarble(scale=0.5);

Error:
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-15-94e6d5b6740c> in <module>
      5 import mpl_toolkits.basemap as Basemap
      6 plt.figure(figsize=(8, 8))
----> 7 m = Basemap(projection='ortho', resolution=None, lat_0=50, lon_0=-100)
      8 m.bluemarble(scale=0.5);

TypeError: 'module' object is not callable

Not sure where to go from here now as it look like it IS importing Basemap OK, but the version or something is incorrect? Perhaps the call is wrong? I'll check that next but any pointers would be super welcome. 73s C

A: What about importing baseman as from mpl_toolkits.basemap import Basemap


text:
Q: Echo value of a header back to the client I am trying to extract value form an incoming request's header and then echo it back to the client, but this code doesn't seem to work.
<?php

$custom_header = $_SERVER['X-Forwarded-Host'];

echo "$custom_header";

?>

I am passing X-Forwarded-Host: google.com as a header in the request and ideally I should get the response google.com but the error that I get is Undefined index: X-Forwarded-Host in C:\xampp\htdocs\reflect.php
I'm running this script on my local machine using XAMPP.

A: php convert custom headers as HTTP_X_FORWARDED_HOST
    $custom_header = $_SERVER['HTTP_X_FORWARDED_HOST'];


text:
Q: Problema con @Render Bundle MVC De antemano agradezco que tomen tiempo para ayudarme.
Estoy montando un plantilla de Bootstrap en un proyecto MVC, he montado gran parte.
El problema viene con unos scripts que no están renderizando correctamente y no ejecuta ciertas funcionalidades en el sitio, por ejemplo, al dar clic en el botón de barras, ejecuta un evento que oculta el nav o lo muestra, simplemente no ejecuta el evento.

Mi BundleConfig.cs es el siguiente:
 public static void RegisterBundles(BundleCollection bundles)
    {
        // Render CSS (OK).
        bundles.Add(new StyleBundle("~/css").Include(
                  "~/css/styles.css"));

        // Render SCRIPTS (Fail)
        bundles.Add(new ScriptBundle("~/js").Include(
            "~/js/Alert.js", //(Solo tiene una alerta("ok"), renderiza correctamente y muestra la alerta).
            "~/js/scripts.js")); //(Tiene funcionalidades para ocultar/mostrar nav, no renderiza y no ejecuta el evento).

        // Render ICONS (Ok)
        bundles.Add(new ScriptBundle("~/Icons").Include(
                  "~/Icons/all.min.js"));

        // Render DATATABLE (Ok)
        bundles.Add(new StyleBundle("~/DataTable").Include(
                  "~/DataTable/dataTables.bootstrap4.min.cs"));

    }

En mi HTML tengo:
<head>
 <!--Resto de codigo...-->

@Styles.Render("~/css")
@Scripts.Render("~/Icons")
@Scripts.Render("~/DataTable")
</head>

<body>
 <!--Resto de codigo...-->

@Scripts.Render("~/js")
@RenderSection("scripts", required: false)
</body>

El script tendría que ejecutar el evento del nav y dar como resultado:

(Pude ejecutar el evento añadiendo <script src="js/scripts.js"></script> directamente a mi index de manera convencional.)
En consola me muestra el siguiente error, no se ha definido el script:

Seguido, me envía a cierta linea del script.js

¿Podrían asesorarme? Gracias.

A: pude solucionar el problema.
Nunca mande a llamar correctamente mi JQuery, lo hacía desde:
<script src="https://code.jquery.com/jquery-3.5.1.min.js" crossorigin="anonymous"></scrip>

Mientras el script.js lo hacia desde:
   // Render SCRIPTS ()
        bundles.Add(new ScriptBundle("~/js").Include(
            "~/js/scripts.js",
            ));

Usando @Scripts.Render
@Scripts.Render("~/js")

Al final quedó de esta manera:
      // Render SCRIPTS (Fail)
        bundles.Add(new ScriptBundle("~/js").Include(
            "~/js/scripts.js",
            "~/js/jquery-3.5.1.min.js"
            ));


text:
Q: New List/Array without a set amount of numbers? I'm working on a restaurant system and a management system, however it is currently the restaurant system. Basically, I am trying to create an empty list so that I can add items to it without saying that it has to have a certain amount of items in the list.
I have looked around but as a beginner, I'm finding it harder to understand the answers on some questions.
If somebody could show me how to incorporate it into my code, that would be great! Thanks in advance :)
    import java.util.Scanner;

class RestaurantMain {
    public static void main(String[] args)
    {
        //Variables//
        int choice;
        int customerChoice;
        boolean trueFalse;
        int restart = 0;
        String choice2;

        //EndVariables//
        Scanner in = new Scanner(System.in);

        System.out.println("Welcome to the Cooper's restaurant system!");
        System.out.println("How can I help?");
        System.out.println("");
        System.out.println("1. Customer System");
        System.out.println("2. Management System");
        System.out.println("");
        System.out.println("");
        System.out.print("Which option do you choose: ");
        choice = in.nextInt();

            if (choice == 1) {
                System.out.println("Our menu's are as follows:");
                System.out.println("");
                System.out.println("1. Drinks");
                System.out.println("2. Starters");
                System.out.println("3. Mains");
                System.out.println("4. Desserts");
                System.out.println("");
                System.out.print("What menu would you like to follow? ");
                customerChoice = in.nextInt();

                    if (customerChoice == 1) {
                        System.out.println("Drinks Menu");
                            System.out.println("Would you like to order? ");
                            in.nextLine();
                    }
                    if (customerChoice == 2) {
                        System.out.println("Starters Menu");
                    }
                    if (customerChoice == 3) {
                        System.out.println("Mains menu");
                    }
                    if (customerChoice == 4) {
                        System.out.println("Desserts Menu");
                    }

            }

A: Try using an ArrayList. It is like an array, but with dynamic size.
Also see: http://www.tutorialspoint.com/java/java_arraylist_class.htm

A: Try the ArrayList class. You can set an initial size on construction time, but it resizes on the go as it gets full. It's behaviour it's the same of an array, but it 'grows' when runs out of space.

A: I have no idea, why do you wanna List. I'm sure that better use arrays and static methods. The one method for handling one menu item. Why is it better? Because if you will use many many if-else you get a spaghetti code(unstructured). Java is very powerful language, just create other class for handling your menu items, use static methods and you will be happy! Good luck!
import java.util.Scanner;

class RestaurantMain {

    //created static variables for using arrays inside static methods of the class
    static String[] menuMainItems = {
            "Customer System",
            "Management System"
    };

    static String[] menuItems = {
            "Drinks Menu",
            "Starters Menu",
            "Mains menu",
            "Desserts Menu"
    };

    static String[] menuCustomer = {
            "Drinks",
            "Starters",
            "Mains",
            "Desserts"
    };

    public static void main(String[] args)
    {
        //Variables//
        int choice = 0;
        int customerChoice = 0;
        boolean trueFalse = false;
        int restart = 0;
        String choice2 = "";

        //EndVariables//
        Scanner in = new Scanner(System.in);

        System.out.println("Welcome to the Cooper's restaurant system!");
        System.out.println("How can I help?\n"); // \n - is just symbol of end line in ascii

        //print our list from array
        for(int i = 0; i < menuMainItems.length; i++)
            System.out.println( (i+1) + ". " + menuMainItems[i] );

        System.out.print("Which option do you choose: ");
        choice = in.nextInt();

        switch(choice)
        {
            case 1:
                    handleCustomerSystem(in); //it's better to use methods
                    break;  //don't forget this! It's important!

            case 2:
                    //and so on
                    break;
        }

    }

    //the handling of the first item
    private static void handleCustomerSystem(Scanner in)
    {
        int customerChoice = 0;
        System.out.println("Our menu's are as follows:\n"); // \n - is just symbol of end line in ascii

        //print our list from array
        for(int i = 0; i < menuItems.length; i++)
                System.out.println( (i+1) + ". " + menuItems[i] ); // (i+1) because we wanna to see the count from 1, not 0

        System.out.print("\nWhat menu would you like to follow? ");
        customerChoice = in.nextInt();

        //and again using switch
        switch(customerChoice)
        {
                case 1:
                        System.out.println(menuItems[customerChoice]);
                        in.nextLine();
                        break;

                case 2:
                        //ans so on
                        break;
        }
    }
}


text:
Q: how can i access the objects in different view functions i am trying to create a header.html to create a header for all pages and i want to create a dropdown for navigate b/w pages and i want to get the title from model i have two view here
one for home page and for header page
home page view:
def homepage(request):

aboutinfo = aboutpage.objects.all()
servicesinfo = services.objects.all()
programinfo = prgm.objects.all()

return render(request, 'index.html', {'aboutinfo': aboutinfo, 'servicesinfo': servicesinfo, 'programinfo': programinfo})

header view
def header(request):

info = services.objects.all()
return render(request, 'header.html', {'info':info})

when i tried the info its not working and i tried the service info from home page it working only index page`

All Services

          {% for services in /* what is here */.all %}

{{ services.title }}

        {% endfor %}

A: try to put parenthesis after all
info = services.objects.all()

A: Try this:
views.py
def header(request):
    services = services.objects.all()
    return render(request, 'header.html', {'services':services})

header.html

    {% for service in services %}

        {{ service.title }}

    {% endfor %}


text:
Q: ASP.NET Core - HttpContext.User.Identity.Name is null in controller I am using a custom CookieAuthentication in ASP.NET Core and I have these three methods in my HomeController:
[Authorize]
public class HomeController : Controller
{
    public async Task<IActionResult> Index()
    {
        _logger.LogInformation("Index()");
        if (HttpContext.User.Identity.Name != null)
        {
            _logger.LogInformation(User.Identity.Name);
        }
        ...
    }

    [HttpGet("getlastdisposal")]
    [AllowAnonymous]
    public JsonResult GetLastDisposal()
    {
        _logger.LogInformation("GetLastDisposal()");
        if (HttpContext.User.Identity.Name != null)
        {
            _logger.LogInformation(User.Identity.Name);
        }
        else
        {
            _logger.LogInformation("IT IS NULL");
        }
        ...
    }

    [HttpGet("getchartdata")]
    public JsonResult GetChartData()
    {
        ...
    }
}

The log I am getting back is this:
...
info: Server.Controllers.HomeController[0]
      Index()
info: Server.Controllers.HomeController[0]
      admin
...
info: Server.Controllers.HomeController[0]
      GetLastDisposal()
info: Server.Controllers.HomeController[0]
      IT IS NULL
...
info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[2]
      Authorization failed for user: (null).
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]
      Authorization failed for the request at filter 'Microsoft.AspNetCore.Mvc.Authorization.AuthorizeFilter'.
info: Microsoft.AspNetCore.Mvc.ChallengeResult[1]
      Executing ChallengeResult with authentication schemes ().
info: Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationMiddleware[12]
      AuthenticationScheme: Cookies was challenged.

Looking at this, it seems like HttpContext.User.Identity.Name becomes null after the first successful authorization (before Index()), which makes the authorization before GetChartData() fail. Any ideas as to why this is happening and how I can fix it?


text:
Q: how to show number of digits on users's request? for example: if a string value is "123456.7890"  .
if user enters the length 6 and the other value 2 for the decimal place.
the output value should be like "123456.78"
if user enters the length 5 and the other value 3 for the decimal place.
the output value should be like "12345.789"
string s = "123456.7890";
 string a = string.Format("{0, 2:F2}", s);
 int index = a.IndexOf('.');
 a = a.Substring(index, (a.Length-index));

A: The most crude and direct way would be:
            var length = 5;
            var decimalPlaces = 2;
            var s = "123456.7890";
            var data = s.Split('.');
            var output1 = data[0].Substring(0, length);
            var output2 = data[1].Substring(0, decimalPlaces);
            var result = output1 + "." + output2;

A: One approach could be like this:
NOTE: If the string's length is less than the number of characters you're taking, code will throw an exception ArgumentOutOfRangeException
int LeftPlaces = 4;
int RightPlaces = 2;
String Input = "123456.7890";
String[] Splitted = Input.Split('.');
String StrLeft = Splitted[0].Substring(0, LeftPlaces);
String StrRight = Splitted[1].Substring(0, RightPlaces);
Console.WriteLine(StrLeft + "." + StrRight);

Output: 1234.78

A: If you want to do this without strings, you can do so.
public decimal TrimmedValue(decimal value,int iLength,int dLength)
{
    var powers = Enumerable.Range(0,10).Select(x=> (decimal)(Math.Pow(10,x))).ToArray();
    int iPart = (int)value;
    decimal dPart = value - iPart;

    var dActualLength = BitConverter.GetBytes(decimal.GetBits(value)[3])[2];
    var iActualLength = (int)Math.Floor(Math.Log10(iPart) + 1);

    if(dLength > dActualLength || iLength > iActualLength)
        throw new ArgumentOutOfRangeException();
    dPart = Math.Truncate(dPart*powers[dLength]);
    iPart = (int)(iPart/powers[iActualLength - iLength]);
    return iPart + (dPart/powers[dLength]);
}

Client Call
Console.WriteLine($"Number:123456.7890,iLength=5,dLength=3,Value = {TrimmedValue(123456.7890m,5,3)}");
Console.WriteLine($"Number:123456.7890,iLength=6,dLength=2,Value = {TrimmedValue(123456.7890m,6,2)}");
Console.WriteLine($"Number:123456.7890,iLength=2,dLength=4,Value = {TrimmedValue(123456.7890m,2,4)}");
Console.WriteLine($"Number:123456.7890,iLength=7,dLength=3,Value = {TrimmedValue(123456.7890m,7,3)}");

Output
Number:123456.7890,iLength=5,dLength=3,Value = 12345.789
Number:123456.7890,iLength=6,dLength=2,Value = 123456.78
Number:123456.7890,iLength=2,dLength=4,Value = 12.789

Last call would raise "ArgumentOutOfRangeException" Exception as the length is more than the actual value


text:
Q: Which version of Javascript Note: I know this is probably a simple and basic question but I just started to learn Javascript a couple of year ago when all these changes started taking place and it seems I learned the old version.
I'm confused with Javascript. I'm trying to implement a basic MEAN stack. I'm using es6 Javascript with Nodejs (6.x) on the server side. Then for the client side, I'm using Angular 1.5 in es5 Javascript, but it seems to not be working.
Is is possible to mix es6 on server-side and use es5 on client-side OR is all or nothing... all es6 on both server/client or vice versa?
UPDATE Thanks for all the info. I've been looking at ES6(ES2015) and it doesn't seem that hard, I've even written some code in it with success. However, I just got a handle on Angular 1 a while back and then it seems like Angular 1.6 and up came out and was quite different. Angular 1 had quite the learning curve, how hard would it be to update my Angular 1 code into 1.6 or above? Is the newer Angular written in ES6? All frontend JS written in ES6 needs a tranpiler or can browsers handle ES6 now?

A:
Is is possible to mix es6 on server-side and use es5 on client-side

Yes you could mix both. But be aware that sharing code between both could be tricky.

is all or nothing... all es6 on both server/client or vice versa?

That's not the case here, but I would recommended to use on both sides es6 and convert to es5 for the browser, eg with Babel

A:
Is is possible to mix es6 on server-side and use es5 on client-side OR is all or nothing... all es6 on both server/client or vice versa?

It's possible to mix entirely separate languages on the server and client, such as PHP or Java or Ruby or C# on the server and JavaScript on the client. So yes, it's just fine if you want to use ES2015 (aka "ES6") and later features in your server-side Node code and restrict yourself to ES5 and earlier features in your client-side browser code.
You don't have to, though, and it's surprisingly hard once you get used to writing let and const and arrow functions to make yourself not write them in your client-side code by accident. So for that reason, you might consider using ES2015+ plus both server-side and client-side, and "transpiling" your client-side code from ES2015+ down to ES5 for use on older browsers. There are multiple transpilers, such as Babel. You can develop with an up-to-date browser such as Chrome or Firefox or Edge, and then have your build tool make the "production" build pass all the client-side code through Babel (perhaps with Webpack or Browserify or similar) for use on older browsers such as IE11.


text:
Q: Setting space within certain elements within a stackview Essentially I am trying to create a UIStackView with some elements that has top margins and bottom margins. For example
| item one |
| item two |
|          |
| itemfour |

I have tried to add a spacerView :
let textField1 = UITextField(text: "one")
let textField2 = UITextField(text: "two")
let textField3 = UITextField(text: "four")
let spacerView = UIView(frame: CGRect(x: 10, y: 10, width: 100, height: 100))

viewStack.addSubView(textField1)
viewStack.addSubView(textField2)
viewStack.addSubView(spacerView)
viewStack.addSubView(textField3)

However, the height that i am setting the spacerView does not seem to effect the space that is being created in the stack view.
PS: If there is a better way of adding top and bottom margins between two items, I am definitely open to it as adding a UIView feels really hacky

A: You could:

*

*Make a spacer view that's a UILabel with text of a single space (" "). This will give you a blank row that's the same height as the rest of your text. This will work if the distribution is set to fillEqually (it works in other modes too, but I mention it because distribution matters in option #2 below).

or,

*Create a subclass of UIView and override its intrinsicContentSize, returning a CGSize that specifies the height you want.  Don't set this view's frame (i.e. let the UIStackView manage the view's frame). Note that this method only works if the distribution of the UIStackView is not set to fillEqually.


text:
Q: Pie Chart XAML Binding I am using MVVM and SL4. I have a collection of VoteResults that are being bound to a ItemsControl. I want a PieChart in EACH VoteResult item. A VoteResult item object properties looks like this: VotedYes 10; VotedNo 4; Abstained 2; DidntVote 6;
How can I pass these VoteItem property values to build the pie chart's series ItemSource in XAML?
Something like :
 <charting:Chart>
    <charting:Chart.Series>
       <charting:PieSeries>
          <charting:PieSeries.ItemsSource>
             <controls:ObjectCollection>

             </controls:ObjectCollection>
          </charting:PieSeries.ItemsSource>
       </charting:PieSeries>
    </charting:Chart.Series>
 </charting:Chart>

A: The charting controls are designed to present data that has been processeda and aggregated ready for presentation.
Sounds to me like you want a PieSeries to present a series that contains the Categories "VotedYes", "VotedNo", "Abstained" and "Did not vote" as its independent value and a vote count as the dependant value.  In that case you need to pass to the ItemsSource a collection containing this set of data, a single object will not do.
You will need to pass the VoteResult object through a function that returns something like IEnumerable<KeyValuePair<String, Int32>>.
 public IEnumerable<KeyValuePair<String, Int32>> ProcessVoteResult(VoteResult vr)
 {
      yield return new KeyValuePair<String, In232>("Voted Yes", vr.VotedYes);
      yield return new KeyValuePair<String, In232>("Voted No", vr.VotedNo);
      yield return new KeyValuePair<String, In232>("Abstained", vr.Abstained);
      yield return new KeyValuePair<String, In232>("Did Not Vote ", vr.DidntVote );
 }

Now you will probably want to bind the VoteResult since you appear to be using MVVM (from looking at your other questions).  You you will need a value converter:-
 public class VoteResultToEnumerableConverter
 {
    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
         if (value != null)
         {
              return ProcessVoteResult((VoteResult)value);
         }
         return null;
    }

    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
         throw new NotImplementedException();
    }
 }

You would then have this converter in a static resources somewhere above the chart:-
 <local:VoteResultToEnumerableConverter x:Key="vrconv" />

Then your chart would look like:-
 <toolkit:Chart>
     <toolkit:PieSeries
         ItemsSource="{Binding SomeVoteResult, Converter={StaticResource vrconv}}"
         DependentValuePath="Key"
         IndependendValuePath="Value"/>
 </toolkit:Chart>


text:
Q: Struggling with aligning buttons using CSS I want to line up the two buttons data analysis and graphing and automated analysis pipeline for bioreactor.
for full code please see here: https://github.com/Betaglutamate/online-cv/blob/master/_includes/skills.html

/*
 * Template Name: Orbit - Responsive Resume/CV Template for Developers
 * Version: 1.0
 * Author: Xiaoying Riley
 * Twitter: @3rdwave_themes
 * License: Creative Commons Attribution 3.0 License
 * Website: http://themes.3rdwavemedia.com/
*/

/* styles.css */

/* ======= Base ======= */

body {
  font-family: 'Roboto', sans-serif;
  color: #545E6C;
  background: #f5f5f5;
  font-size: 14px;
  padding: 30px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
}

a {
  color: #2d7788;
  -webkit-transition: all 0.4s ease-in-out;
  -moz-transition: all 0.4s ease-in-out;
  -ms-transition: all 0.4s ease-in-out;
  -o-transition: all 0.4s ease-in-out;
}

a:hover {
  text-decoration: underline;
  color: #1a454f;
}

a:focus {
  text-decoration: none;
}

p {
  line-height: 1.5;
}

.wrapper {
  background: #42A8C0;
  max-width: 960px;
  margin: 0 auto;
  position: relative;
  -webkit-box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
  -moz-box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
  box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
}

.sidebar-wrapper {
  background: #42A8C0;
  position: absolute;
  right: 0;
  width: 240px;
  height: 100%;
  min-height: 800px;
  color: #fff;
}

.contact-info {
  font-size: 13px;
}

.container {
  display: inline;
  /* or inline-flex */
  padding: 0em;
}

.sidebar-wrapper a {
  color: #fff;
}

.sidebar-wrapper .profile-container {
  padding: 30px;
  background: rgba(0, 0, 0, 0.2);
  text-align: center;
  color: #fff;
}

.sidebar-wrapper .name {
  font-size: 32px;
  font-weight: 900;
  margin-top: 0;
  margin-bottom: 10px;
}

.sidebar-wrapper .tagline {
  color: rgba(255, 255, 255, 0.6);
  font-size: 16px;
  font-weight: 400;
  margin-top: 0;
  margin-bottom: 0;
}

.sidebar-wrapper .profile {
  margin-bottom: 15px;
}

.sidebar-wrapper .contact-list .fa {
  margin-right: 5px;
  font-size: 18px;
  vertical-align: middle;
}

.sidebar-wrapper .contact-list li {
  margin-bottom: 15px;
}

.sidebar-wrapper .contact-list li:last-child {
  margin-bottom: 0;
}

.sidebar-wrapper .contact-list .email .fa {
  font-size: 14px;
}

.sidebar-wrapper .container-block {
  padding: 30px;
}

.sidebar-wrapper .container-block-title {
  text-transform: uppercase;
  font-size: 16px;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 15px;
}

.sidebar-wrapper .degree {
  font-size: 14px;
  margin-top: 0;
  margin-bottom: 5px;
}

.sidebar-wrapper .education-container .item {
  margin-bottom: 15px;
}

.sidebar-wrapper .education-container .item:last-child {
  margin-bottom: 0;
}

.sidebar-wrapper .education-container .meta {
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
  margin-bottom: 0px;
  margin-top: 0;
}

.sidebar-wrapper .education-container .time {
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
  margin-bottom: 0px;
}

.sidebar-wrapper .languages-container .lang-desc {
  color: rgba(255, 255, 255, 0.6);
}

.sidebar-wrapper .languages-list {
  margin-bottom: 0;
}

.sidebar-wrapper .languages-list li {
  margin-bottom: 10px;
}

.sidebar-wrapper .languages-list li:last-child {
  margin-bottom: 0;
}

.sidebar-wrapper .interests-list {
  margin-bottom: 0;
}

.sidebar-wrapper .interests-list li {
  margin-bottom: 10px;
}

.sidebar-wrapper .interests-list li:last-child {
  margin-bottom: 0;
}

.main-wrapper {
  background: #fff;
  padding: 60px;
  padding-right: 300px;
}

.main-wrapper .section-title {
  text-transform: uppercase;
  font-size: 20px;
  font-weight: 500;
  color: #2d7788;
  position: relative;
  margin-top: 0;
  margin-bottom: 20px;
}

.main-wrapper .section-title .fa {
  width: 30px;
  height: 30px;
  margin-right: 8px;
  display: inline-block;
  color: #fff;
  -webkit-border-radius: 50%;
  -moz-border-radius: 50%;
  -ms-border-radius: 50%;
  -o-border-radius: 50%;
  border-radius: 50%;
  -moz-background-clip: padding;
  -webkit-background-clip: padding-box;
  background-clip: padding-box;
  background: #2d7788;
  text-align: center;
  padding-top: 8px;
  font-size: 16px;
  position: relative;
  top: -2px;
}

.main-wrapper .section {
  margin-bottom: 60px;
}

.main-wrapper .experiences-section .item {
  margin-bottom: 30px;
}

.main-wrapper .upper-row {
  position: relative;
  overflow: hidden;
  margin-bottom: 2px;
}

.main-wrapper .job-title {
  color: #3F4650;
  font-size: 16px;
  margin-top: 0;
  margin-bottom: 0;
  font-weight: 500;
}

.main-wrapper .time {
  position: absolute;
  right: 0;
  top: 0;
  color: #97AAC3;
}

.main-wrapper .company {
  margin-bottom: 10px;
  color: #97AAC3;
}

.main-wrapper .project-title {
  font-size: 16px;
  font-weight: 400;
  margin-top: 0;
  margin-bottom: 5px;
}

.main-wrapper .projects-section .intro {
  margin-bottom: 30px;
}

.main-wrapper .projects-section .item {
  margin-bottom: 15px;
}

.skillset .item {
  margin-bottom: 15px;
  overflow: hidden;
}

.skillset .level-title {
  font-size: 14px;
  margin-top: 0;
  margin-bottom: 12px;
}

.level-title {
  display: inline-block
}

.skillset .level-bar {
  height: 12px;
  background: #f5f5f5;
}

.skillset .level-bar-inner {
  height: 12px;
  background: #7bc2d3;
}

.footer {
  padding: 30px;
  padding-top: 60px;
}

.footer .copyright {
  line-height: 1.6;
  color: #545E6C;
  font-size: 13px;
}

.footer .fa-heart {
  color: #fb866a;
}

/* Extra small devices (phones, less than 768px) */

@media (max-width: 767px) {
  .sidebar-wrapper {
    position: static;
    width: inherit;
  }
  .main-wrapper {
    padding: 30px;
  }
  .main-wrapper .time {
    position: static;
    display: block;
    margin-top: 5px;
  }
  .main-wrapper .upper-row {
    margin-bottom: 0;
  }
}

/* Small devices (tablets, 768px and up) */

/* Medium devices (desktops, 992px and up) */

@media (min-width: 992px) {
  .skillset .level-title {
    display: inline-block;
    float: left;
    width: 30%;
    margin-bottom: 0;
  }
  .skillset .level-bar {
    display: inline-block;
    width: 70%;
    float: left;
    position: relative;
    top: 1px;
  }
}

/* Large devices (large desktops, 1200px and up) */

/* Ex-Large devices (large desktops, 1200px and up) */

/*
used for profile image
*/

.profile-img {
  max-width: 100px;
  margin-bottom: 15px;
  border: 0px solid #fff;
  border-radius: 100%;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

Python

            <button type="button" class="close" data-dismiss="modal">×</button>

Automated Analysis Pipeline for Bioreactor

Building an automated analysis software for our custom built bioreactor

                Generating growth curves for bacteria manually is a time-consuming and tedious activity performed by laboratories across the world. Using bioreactors can automate this process. However, these are very expensive putting this technology out of reach for
                many smaller laboratories. Our lab designed a modular bioreactor to make this technology affordable for everyone. I designed an analysis program that                takes raw text files output by the bioreactor and automatically calculates and graphs the growth rates.

            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>

    data analysis and graphing
    <button id="show-img" type="button" class="btn btn-default btn-sm project" data-toggle="modal" data-target="#python-modal-profile">Automated analysis pipeline for Bioreactor</button>

  where does this go

what about this

```

A: I've included a very basic example in JSFiddle, since your example has so much code. ;) Next time I would advice a small sample, this way it is easier for us to debug your problem: https://stackoverflow.com/help/minimal-reproducible-example
Example
If you want to get 2 buttons next to each other you can use flexbox for this, so it will also have a better responsive behaviour: https://jsfiddle.net/8tgm5yo6/
Example HTML

I am some title

  <button class="example_button" type="button">I am a button</button>
  <button class="example_button" type="button">I am a button</button>

Example CSS
.example {
  width: 100%;
  display: flex;
  flex-flow: row wrap;
  justify-content: flex-start;
  align-items: center;
}

.example_title {
  flex: 0 1 auto;
}

.example_buttons {
  margin: 0 0 0 auto;
  flex: 1 1 auto;

  display: inline-flex;
  flex-flow: row wrap;
  justify-content: flex-end;
  align-items: center;
}

.example_button {
  margin: 0.4em 0.2em;
}

As also other point out there is also not enough space to align the buttons next to each other.
You could shorten your button content or increase the container size a little bit, but add a little extra margin because browsers do not render HTML & CSS exactly the same, it can be different by a few pixels.
Increase container width
You can set your container width to 1070 to make the buttons fit:
.wrapper {
    max-width: 1070px;
}

Of course this problem will still persist on smaller screens (tablets/phones) or resized browsers.


text:
Q: Open outlook to inbox by default Using Outlook 2016 for Mac. Upon launching Outlook it loads into whatever folder I quit the program in, which was fine as I usually closed while viewing the inbox anyways.
However, all of a sudden when I close the Outlook window (not quit the program just close the window) it opens back up into whatever folder is 2 under the inbox. I thought it was first an issue with my subfolders so I got rid of those and now it loads into deleted items. This happens no matter what folder I am viewing when I close the window.
How can I get Outlook to always load into the inbox?

A: I don't have a Mac, but in Windows there is an option for this under Advanced:


text:
Q: Configuring Raid for 36 disks Softlayer I have 36 disks that I want to configure for Raid. The first 2 I have setup for Raid 1 in linux basic template but for the others i have 8x 1.7 SSD's and 26x 8 SATA's.
the 8 + 26 = 34 drives are all JBOD raid config. Is this the right way to configure or do I have to have an individual {} for each drive?
"storageGroups": [
            {
                "arraySize": 8000,
                "arrayTypeId": 2,  # Raid 1
                "hardDrives": [
                    0,
                    1,
                ],
                "partitionTemplateId": 1  # Linux Basic
            },
            {
                "arrayTypeId": 9, # JBOD
                "hardDrives": [
                    2,
                    3,
                    4,
                    5,
                    6,
                    7,
                    8,
                    9,
                    10,
                    11,
                    12,
                    13,
                    14,
                    15,
                    16,
                    17,
                    18,
                    19,
                    20,
                    21,
                    22,
                    23,
                    24,
                    25,
                    26,
                    27,
                    28,
                    29,
                    30,
                    31,
                    32,
                    33,
                    34,
                    35
                ]
            }
        ]

I also tried:
    "arrayTypeId": 9, # JBOD
    "hardDrives": [21]
},
{
    "arrayTypeId": 9, # JBOD
    "hardDrives": [22]
},

etc...
but keep getting timed out in the verifyOrder()

A: the storage group configuration is fine the issue must be in your side, review that your network connection does not have timeouts.
Regards

A:
JBOD drive must have exactly 1 drive

So you need to define this for each disk, that's the issue, you should try something like this:
 "storageGroups":[
                {
                    "arraySize":8000,
                    "arrayTypeId":2,
                    "hardDrives":[
                        0,
                        1
                    ],
                    "partitionTemplateId":1
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        2
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        3
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        4
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        5
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        6
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        7
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        8
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        9
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        10
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        11
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        12
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        13
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        14
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        15
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        16
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        17
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        18
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        19
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        20
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        21
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        22
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        23
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        24
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        25
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        26
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        27
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        28
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        29
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        30
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        31
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        32
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        33
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        34
                    ]
                },
                {
                    "arraySize":8000,
                    "arrayTypeId":9,
                    "hardDrives":[
                        35
                    ]
                }
            ]


text:
Q: Cast String Column to Long grails createCriteria I have a domain class in grails which has a column of string type. Below is the domain class structure.
class TravelRequestUpdates{
        updatedAt sqlType:'varchar(40)'

String updatedAt

}

I store epoch dates in this column. Using createCriteria i want to perform a between check on this column for long type values but am unable to do so. Is there a way i can store values in this column as String and still perform Long type operation on the values stored. Below is the code for my criteria where i want that the values stored in this table to behave as long type. The dates are not being compared.
              def criteriaObj = TravelRequestUpdates.createCriteria()

def travelToShow = criteriaObj.get{

                    @Formula("cast(updatedAt as NUMBER(20,0))")
                    long tempUpdatedAt

                    tr{
                      eq('id',g.id)
                    }
                    and{
                      between(tempUpdatedAt, startTimeReport.time, endTimeReport.time)
                    }
                    and{
                      newStatus{
                        eq('id',completedTravelsStatus.id)
                      }
                    }
                  }

I want to generate a query like the one below. The below query gives me the desired result.
SELECT *
FROM travel_request_updates
WHERE tr_id = '439'
AND updated_at BETWEEN ('1478016321000') AND('1478189121000')
AND new_status_id = '4'

A: Sorry my comment won't solve it since I think that is your input range.
There are a few options

*

*Enable a transient object of Long in your domain class that converts the underlying string to Long so:
class TravelRequestUpdates{
 String updatedAt
 Long myConversion

 static transients = [ 'myConversion' ]

 Long getMyConverion() {
  return (this.updatedAt as Long)
 }
}

*Would be to write it in something like HQL and possibly cast the object:
String query = "FROM travelRequestUpdates
WHERE tr_id = :myid
AND cast (updatedAt as Long) BETWEEN (:input1) AND(:input2)
AND newSatusId = :status"
def myParams=[status: '4', input1: 1478016321000L, input2: 1478189121000L, myId: 439L]
def myList = TravelRequestUpdates.execute(query,myParams,[readonly:true])

L has cast them as Long values you can Declare long values if you prefer, alternatively you can run a sql query directly if all of that fails.


text:
Q: How to take the first n items and proceed with remaining in recursion? I want to achieve something like this:
f :: [Int] -> [Int]
f (x@[_,_,_,_]:xs) = g x : f xs

g :: [Int] -> Int
g = ...

So I want to take the first four items in a list calculate something on them and then do the same thing with the remaining items creating a new list of calculated values. It is like a combination of map and take I guess. Is there something like this in haskell?
I know I could do something like:
map g . chunksOf 4

I just thought it would look much more "haskelly" with recursion

A: p1 : p2 is a pattern that matches a non-empty list if the list's head matches the pattern p1 and its tail matches p2. [p1, p2, p3, p4] is a pattern that matches a four-element list if its elements match p1, p2, p3 and p4 respectively. Thus [_, _, _, _]:xs matches a non-empty list if its first element is a four-element list. Since f takes a list of ints, not a list of lists, this pattern leads to a type error in your function.
What you want can be expressed as x1 : x2 : x3 : x4 : xs and then where x = [x1, x2, x3, x4]. Of course that's not particularly pretty and it might be more convenient to just use take and drop or splitAt instead (if you really want to do your own recursion, that is).

I just thought it would look much more "haskelly" with recursion

I would disagree with that. I'd say it's generally preferable in Haskell to use and combine existing standard library functions instead of writing your own recursive functions.


text:
Q: About Googles PubSubHubbub drawback I was reading a paper titled "An Optimized Web Feed Aggregation Approach for Generic Feed Types" and googles PubSubHubbub protocol was discussed and the paper stated its drawback something like

Furthermore, there are patch systems such as pubsubhubbub (Google 2010) which can be seen as a mod-erator between feed readers and servers. All of these solutions only work if both, client and server support the extensions, which is rarely the case. Pubsubhubbub, for example,is only supported by 2 % of the feeds in our dataset.

I have never really interacted with this protocol , does it require clients (subscribers) to have some sort of a software on their system like feed listeners are required on the client side(subscribers) for obtaining feeds (is that what the above means) ?

A: I am not sure where they pulled that 2% number from, but it is probably not right.
For example, all the major blogging platforms support PubSubHubbub. A lot of news outlets (HuffPo, Gawker, Foxnews, ABCLocal...) support the protocol too.
Many other services, like Craigslist, Getglue, (even StackOverflow) . A lot of other services, like Github or Instagram do support PubSubHubbub-like APIs for JSON resources, even though this is outside of the current (0.3) spec.
The list goes on and on and on.
Now as far as complexity, it really isn't that difficult for a huge benefit. The "clients" (technically these are web servers) need to visible, accessible outside the firewall.
For publishers, it is even easier as they just need to ping (a simple HTTP POST request) the hub that they've chosen previously.


text:
Q: In RMarkdown Word document, how to make table of contents appear later When an RMarkdown document is knit to Word, the Table of Contents (if there is one) always appears at the beginning of the document. If I want to, say, make the Table of Contents appear on the second page of the document, how do I do so?
If I was knitting to HTML I could use this method, but it doesn't seem to work for Word. Meaning, I create a Word template to be used in the reference_docx YAML argument and put the Table of Contents at the bottom of this template, but when I knit a report the Table of Contents appears at the front of the document.
Preferably, I'd like to use a solution that doesn't rely on VBA/VBS and instead uses RMarkdown and (if necessary) a reference_docx file only.

A: As explained here, based on this and this, you could change the style of the date in the Word document to add a page break after it.
Of course, that only separates the title page from the table of contents and if you want to insert other pages between those two, it wouldn't work.
But at least that's an idea to start from.

A: I've just been playing around with this issue myself. Unfortunately, I don't think Word allows you to modify a style to insert a break after a style, only before.
However, the TOC header is a style that is created when a TOC is included and can be modified. If you change the TOC header style to include a page break before, save this as your reference style document and run it forces the TOC onto a new page when knit.
As @Ben notes though this only allow you to move the TOC off the title page, not insert it where you want within the document.

A: I was searching for a solution to this today and came across Garrick Aden‑Buie's blog post and render_toc() function.
Full details of which can be found here or his gist
This function allowed me to move the TOC later in to the document.


text:
Q: how can we create/download IPA without ".Sinf" file from Iphone/itunes/Xcode I have one IPA file which i am able to install in any device by ideviceinstaller. That IPA is encrypted but that not have .sinf file .
I think so due this file i am able to install this IPA in any device but now my question is how can we create/download this IPA without .sinf file from Iphone/itunes/Xcode . This IPA file has itunesmetadata.plist  file also . That means this file is downloaded from apple store .


text:
Q: Have a nested parent model pointing to the first child model My models are like this: a discussion has_many posts (nested resource).
I want to add a starter_post_id column to the discussions table, and have it record the 'thread starter post id'. The discussion is created along with the post in the nested form, and that when the logic should be called, because other posts to that discussion will be replies not starter posts.
I am not sure what I need to do after the add_column db migration.

*

*Do I need a belongs_to :post in my Discussion model?

*What's the order of creation for these nested objects. e.g. parent's creation ends before child's starts? or will the parent constructor call the child constructor?

*Which model should the starter post assignment logic go to? This is related to Q2 since both objects needs to be initiated, but preferably before the DB call.

A: I would use the created_at field from you post model to determine the starter_post of a discussion. No need for any columns.
Add something like this in your discussion model
def starter_post
  self.posts.order("created_at ASC").first()
end

If you use this in you discussion.rb :
has_many :posts , :order => "created_at ASC"

you can then simply use :
def starter_post
  self.posts.first()
end

A: I tried before_save and it won't work because at that point in time the discussion has no way to get hold of the starter post object. I was pointed out to use after_create instead.
def after_create
    self.starter_post_id = self.posts.first.id
    self.save!
end

This will cause one extra sql query, but it is better than doing it at the post model.
I used belongs_to so I can use discussion.start_post_id, but I guess it is optional.


text:
Q: AS3 Switch conditions being ignored So recently I've been working on a game in Flash, using the program Flash Builder and the Flixel engine. I hit a strange snag though, one of the first things that runs is a parser I made to create the screen for each level based on a 2D array in a .txt file, and for some reason, the final letter in each line is being ignored in the switch statement that decides what that index stands for.
This is the part I'm having issues with (what happens in each condition is irrelevant, I just left it in for context, but they all behave correctly):
var row:int;
var column:int;
var currentColor:int = 0;
for (row = 0; row < m_levelData.length; row++) {
    for (column = 0; column < m_levelData[0].length; column++) {
        var offset:FlxPoint = new FlxPoint(0, 0);
        var thisIndex:String = m_levelData[row][column];
        //trace("This Line is " + m_levelData[row]);
        trace("Current index is " + thisIndex);

        //trace(row + " " + column);
        switch(thisIndex) {

            case Statics.GRID_BIN:
                offset.y = (spaceSize.y / Statics.SPRITE_SCALE - BinFront.SIZE.y / Statics.SPRITE_SCALE) / 2;
                offset.x = (spaceSize.x/Statics.SPRITE_SCALE - BinFront.SIZE.x/Statics.SPRITE_SCALE) / 2;
                var color:uint;
                if (m_colors.length < currentColor) {
                    color = Statics.COLOR_BLACK;
                    trace("No color found");
                } else {
                    color = m_colors[currentColor];
                    currentColor++;
                    trace("Color is " + color);
                }
                makeBin(spaceSize.x * column + offset.x + levelOffset.x, spaceSize.y * row + offset.y + levelOffset.y, color);
                break;

            case Statics.GRID_BUILDER:
                offset.y = (spaceSize.y/Statics.SPRITE_SCALE - BuilderMain.SIZE.y/Statics.SPRITE_SCALE)/2
                offset.x = (spaceSize.x/Statics.SPRITE_SCALE - BuilderMain.SIZE.x/Statics.SPRITE_SCALE) / 2;
                makeBuilder(spaceSize.x * column + offset.x + levelOffset.x, spaceSize.y * row + offset.y + levelOffset.y);
                break;

            case Statics.GRID_CONVEYOR:
                var length:int = 0;
                if (column == 0 || m_levelData[row][column - 1] != Statics.GRID_CONVEYOR) {
                    for (i = column; i < m_levelData[row].length; i++) {
                        if (m_levelData[row][i] == Statics.GRID_CONVEYOR) {
                            length++;
                        } else {
                            break;
                        }
                    }

                    offset.y = (spaceSize.y/Statics.SPRITE_SCALE - Statics.GRID_SIZE.y/Statics.SPRITE_SCALE)/2
                    offset.x = (spaceSize.x/Statics.SPRITE_SCALE - Statics.GRID_SIZE.x/Statics.SPRITE_SCALE) / 2;
                    makeConveyor(spaceSize.x * column + offset.x + levelOffset.x, spaceSize.y * row + offset.y + levelOffset.y, length);
                }
                break;

            default:
                trace("Nothing at this index, it was " + thisIndex);
        }

Statics.GRID_BIN, Statics.GRID_CONVEYOR, and Statics.GRID_BUILDER are all constant strings ("a", "b", and "c" respectively), and I know that this all should be working because it was working before I switched to the parser. Now, your immediate response to that is that the problem is my parser, but I have suspicions that something is a little screwy other than that. Before the switch, I print the value of thisIndex..(trace("Current index is " + thisIndex);), and whenever it is the last letter in a line that was parsed (using split(","), even when it matches one of the switch conditions, the default condition is run and nothing happens.
Has anyone else seen something like this, or am I just making a really dumb mistake?

A: When you parse and compare strings loaded from a .txt you have to deal with various "hidden" characters. At line endings you might run into CR (\r) LF(\n) or both or the other way round.
It can get a bit fiddly to find out which applies to your system or .txt.
In the end you could probably make it work using String.replace() .
This has been discussed for example here: How do I detect and remove "\n" from given string in action script?
Apart from this it's hard to judge whether there's something wrong with your parser.
Your use of the switch{}-statement itself looks fine and should be working.
If you need to debug the code try feeding it with a hardcoded const :String instead of the .txt-file. Then set a breakpoint (in Flash Builder by double-clicking the line number next to the switch-statemen) and step through it line by line.


text:
Q: Heroku compiled slug size is too large but can't find large files I'm trying to build a Python app (using streamlit) and getting
Compiled slug size: 664M is too large (max is 500M).
However, when I run
heroku run bash -a pitchcast
$ du -ha --max-depth 1 /app

the only thing that shows up is
4.0K    /app

Where are the large files and what can I do to reduce them?

A: Answering my own question: it seems like the size was due to the Python libraries, especially tensorflow. Switching from tensorflow to tensorflow-cpu got it under 500M


text:
Q: Linq query has an implicit cast error for DataGridViewRow when option strict is enabled I have a DataGridView that is bound to a list of objects called "BaseChange". The BaseChange objects are made up of 4 properties...

*

*ChangeType

*ChangeStatus

*ChangeDescription

*LastChangeDate

The datagridview has columns for all 4 values as well as a 5th (a checkbox column called "colIsSelected"). There is no problem binding the list to the grid and displaying the items.
The problem is that the query that gets the selected items in the grid is giving me an implicit cast error when option strict is enabled.
This is the query...
Dim _changes As List(Of BaseChange)

_changes = (From _row As DataGridViewRow In dgvChanges.Rows() _
            Where Convert.ToBoolean(_row.Cells(NAME_COLUMN_IS_SELECTED).Value) = True _
            Select DirectCast(_row.DataBoundItem, BaseChange)).ToList()

...and it produces the correct results with option strict off. The implicit cast squiggle is on the "_row As DataGridViewRow" code, and the full message is "Implicit conversion from 'Object' to 'System.Windows.Forms.DataGridViewRow'".
If I exclude the "As DataGridViewRow" from the query, I get a late binding error on the _row.Cells and _row.DataBoundItem and this also fails option strict.
I need this to work with Option Strict enabled, and in VB. Am I missing something here? Anyone have suggestions?

A: (From _row As DataGridViewRow In dgvChanges.Rows()

your type of the _row object has to match the single version of the collection type.
as in:
    'Assumes Option Strict On and Option Implicit On
    Dim _changes = (From _row In dgvChanges.Rows() _
           Where Convert.ToBoolean(ctype(_row,DataGridViewRow).Cells(NAME_COLUMN_IS_SELECTED).Value) = True _
Select DirectCast(ctype(_row,DataGridViewRow).DataBoundItem, BaseChange)).ToList()

Linq sees your Rows() collection as IEnumerable, so your row is an object.  Explanation at the bottom goes into more detail.
Added:
Adding Option Infer should simplify this.
See for more details:
What is the best way to mix VB.NET's Option Strict and the new Option Infer directives?
and
http://social.msdn.microsoft.com/forums/en-US/linqprojectgeneral/thread/e3ec737a-42f8-4767-a190-78390202a991/
Explanation:
I did some more digging as to why it isn't simpler.  RowCollection for a DataGridView implements the older IEnumberable interface which returns objects, while newer collection types Implement the Generic IEnumerable(Of T) Interface, which returns the type directly, removing the need for casting.
See msdn for implemented interfaces.


text:
Q: JavaScript changing checkbox status before submitting form EDIT Note on the user experience...
After the first comment I'd like to point out that every submit leads to a POST/redirect/GET and take the user to a new page.  It's actually a very pleasant user experience: don't get this wrong, when the user arrives on the next page he sees his checkbox checked. And then if he clicks on the back button he sees his previous page, as it was before its checkbox was checked. The user never notices that his checkbox changes its state, because he's taken immediately to a new page: I'm using a Post/redirect/GET...
I've got a webapp which works nicely with the back button and which respects the back button.  However I've got an issue.  As commented by a user with lots of rep here, apparently the fact that the checkboxes are reset to their final state is a feature of the browsers (not all of them that said):
Yet another checkbox/backbutton issue
So I'm thinking about a workaround and this question is not the same as the above question.  This question is about how to do specifically the following from JavaScript.
Currently I have very simple checkboxes that do all look like this:
<input type="checkbox" name="collapseFolds" value="na" checked onchange="document.getElementById('someid').submit()>

now can how can I, in the onchange handler:

*

*set another element (for example some hidden element) to the value of the checkbox (at least to either "checked" or "unchecked")

*set the checkbox back to the value it was before it was clicked (so either "checked" if the user just unchecked it, or nothing if the user just checked it)

*submit
My reasoning is that if I can do that, I can trivially workaround the issue I described in the other question and this is nothing too fancy: I'd simply need to check the value of a hidden parameter instead of checking the value of the checkbox.
So what would happen would be the following:

*

*user clicks on a checkbox, toggling its state

*onchange intercepts this, sets a hidden value to the state of the checkbox

*changes back the checkbox to its original state

*submits

This way if the user clicks on the back button, he's taken not to the final state the checkbox was in but to the original state.
Ideally it should work on every browser (I don't even know if my onchange is good enough).
It's the only .js I've got on these pages, so I'd rather not have to use JQuery but if JQuery is the way, then so be it...
P.S.: note that the entire webpage is generated on the server side but there's no AJAX going on.  It's really just simply POST / GET and submit when the user clicks a checkbox.

A: @Cedric...my solution may not work on IE ( 8 & 9) ....other than that it works just fine. For the issue on IE 8 and IE 9 I raised this   If for some reasons it worked on IE 8/9 please let me know :)
<input type="checkbox" name="collapseFolds" value="na" checked onchange="document.getElementById('someid').submit()">

Instead of writing inline onchange you probably want to keep html and javascript separate for ease of future maintenance.
so you can change your code to:
HTML:
<input type="checkbox" name="collapseFolds" value="na" checked >

Javascript:
function submitThisFormOnCheckBoxClick(event){
    event.preventDefault(); // This will ensure that history will be taken care of
    var form = document.getElementById("formId");
    form.submit();
}

var collapsefolds = document.getElementsByTagName("collapseFolds");

for (var el in collapsefolds){

   if (el.addEventListener) { // for non-IE browsers
    el.addEventListener('change', modifyText, false);
   } else if (el.attachEvent)  { // for IE based browsers
    el.attachEvent('change', modifyText);
   }
}

Let me know if you have any questions.


text:
Q: Weird problem porting application. Undefined reference errors in standard libraries I've recently been trying to port a C++ application. I believe I have all of it's dependencies and such and it all compiles. But then, when it goes to link it I get a lot of weird undefined reference errors.
/usr/local/lib/libglibmm-2.4.so.7.0: undefined reference to `std::basic_istream<char, std::char_traits<char> >::seekg(long, std::_Ios_Seekdir)'
/usr/local/lib/libglibmm-2.4.so.7.0: undefined reference to `std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_S_empty_rep_storage'
/usr/local/lib/libxml++-2.6.so.0.1: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_empty_rep_storage'
/usr/local/lib/libxml++-2.6.so.0.1: undefined reference to `std::__default_alloc_template<true, 0>::deallocate(void*, unsigned long)'

What can cause this kind of errors? What do the linking errors mean? I can't really understand the complicated template error messages that gcc gives..
The linking command in it's entirety:
gmake[3]: Entering directory `/home/earlz/synfig-0.62.00/src/tool'
/bin/sh ../../libtool --tag=CXX   --mode=link eg++ -I/usr/local/include/libxml++-2.6 -I/usr/local/lib/libxml++-2.6/include -I/usr/local/include/libxml2 -I/usr/local/include -I/usr/local/include/glibmm-2.4 -I/usr/local/lib/glibmm-2.4/include -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include/sigc++-2.0 -I/usr/local/lib/sigc++-2.0/include -I/usr/local/include -I/usr/local/include/sigc++-2.0 -I/usr/local/lib/sigc++-2.0/include -DSYNFIG_NO_DEPRECATED -DLOCALEDIR=\"/usr/local/share/locale\" -DNDEBUG -O2 -W -Wall   -o synfig synfig-main.o ../synfig/libsynfig.la -L/usr/local/lib -lxml++-2.6 -lxml2 -lglibmm-2.4 -lgobject-2.0 -lglib-2.0 -lintl -liconv -lsigc-2.0 -lpthread -L/usr/local/lib -lsigc-2.0 -L/usr/local/lib -lintl -L/usr/local/lib -liconv  -lpthread
libtool: link: eg++ -I/usr/local/include/libxml++-2.6 -I/usr/local/lib/libxml++-2.6/include -I/usr/local/include/libxml2 -I/usr/local/include -I/usr/local/include/glibmm-2.4 -I/usr/local/lib/glibmm-2.4/include -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include/sigc++-2.0 -I/usr/local/lib/sigc++-2.0/include -I/usr/local/include -I/usr/local/include/sigc++-2.0 -I/usr/local/lib/sigc++-2.0/include -DSYNFIG_NO_DEPRECATED -DLOCALEDIR=\"/usr/local/share/locale\" -DNDEBUG -O2 -W -Wall -o .libs/synfig synfig-main.o  -L../synfig/.libs -lsynfig -L/usr/local/lib -lxml++-2.6 -lxml2 -lm -lz -lglibmm-2.4 -lgmodule-2.0 -lgobject-2.0 -lglib-2.0 -lpcre -lsigc-2.0 -lintl -liconv -lpthread -Wl,-rpath,/usr/local/lib

Also, I do not get any kind of linking errors about missing files, just stuff about weird string and filestream stuff missing

A: Use g++ to link C++ applications, that add C++ standard libraries to the link phase.


text:
Q: How to open chrome extension page programmatically I am a new one for the extension. I want to open a chrome extension page programmatically. Eg:
chrome-extension://njlkegdphefeellhaongiopcfgcinikh/options.html

When I click the web page button or link I want to open the particular extension tab.
I tried many ways. Directly call using javascript and so many ways. But I couldn't find the proper solution. Anybody have any idea.
(My target is using JavaScript to open the extension tab)

A: Here is one of the solutions:

*

*Make sure your content script runs on the page on which you are clicking on the button.

*When you click on button on web page, add event listener from content script and in the event listerner pass a messgae to background.
chrome.runtime.sendMessage({message: 'buttonClicked'},
  function() {
    /* callback */
  });

*In your background script, listen to the message from content script.
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
  if (request.message == 'buttonClicked') {
  // Create a new tab with options page
 }
});

*To create a new tab with options.html page, you can do this
chrome.tabs.create({
  active: true,
  url:  'options.html'
}, null);

A: The web extension API includes a runtime.openOptionsPage() method for just this purpose. To use it:

*

*You must have an options page defined.

*Call browser.runtime.openOptionsPage() (or chrome.runtime.openOptionsPage(), depending on the browser you're working with) from your background script.

Though this message is ostensibly part of runtime, it seems to only work correctly when called from a background script.
MDN docs are here.


text:
Q: Cómo obtener un atributo de un botón que esta dentro de una tabla con Js o JQuery? Tengo una tabla que en cada fila tiene botones uno de estos es eliminar y ahí en le pongo como atributo una ruta = "", al hacer click en el botón quiero que me muestre este valor pero me aparece

undefined

function eliminarMenu(cod) {
    var url = $(this).attr('ruta');
    console.log(url);
}

<button  id="eliiminarMenu" name="eliiminarMenu"  data-toggle="tooltip" title="ELIMINAR" onclick="eliminarMenu();" ruta="{{URL::to('menu/eliminar')}}/{{$menu->idMenu  }}" class="btn btn-outline btn-danger"></button>

Cuando veo en el inspector del navegador el atributo ruta me sale correctamente lleno

A: ya que usas jquery, evita el uso onclick y agrega el evento click de jQuery
html
<button  id="eliiminarMenu" name="eliiminarMenu"  data-toggle="tooltip" title="ELIMINAR" ruta="{{URL::to('menu/eliminar')}}/{{$menu->idMenu  }}" class="btn btn-outline btn-danger"></button>

jquery
$('#eliiminarMenu').click(function(){
    var url = $(this).attr('ruta');
    console.log(url);
});

Saludos

A: Para complementar del porque el codigo original no funciona:
Cuando agregas un atributo onclick en el contenido HTML automaticamente estas creando una funcion anonima que ejecuta el contenido de lo que agregas en el atributo. Dicha funcion anonima recibe this como el elemento actual, pero para las funciones invocadas this corresponde al objeto Window
En el codigo siguiente el boton eliiminarMenu2 ejecuta eliminarMenu.call(this) efectivamente cambiando el contexto de ejecucion al esperado por la funcion.
Mientras que el boton eliiminarMenu3 agrega un event handler de forma manual, apuntando a la funcion eliminarMenu directamente, sin intermediarios.

function eliminarMenu(cod) {
    console.log("this es ", this.toString());
    var url = $(this).attr('ruta');
    console.log(url);
}

document.getElementById("eliiminarMenu3").onclick=eliminarMenu;

<button  id="eliiminarMenu" name="eliiminarMenu"  data-toggle="tooltip" title="ELIMINAR" onclick="eliminarMenu();" ruta="{{URL::to('menu/eliminar')}}/{{$menu->idMenu  }}" class="btn btn-outline btn-danger">Button</button>

<button  id="eliiminarMenu2" name="eliiminarMenu"  data-toggle="tooltip" title="ELIMINAR" onclick="eliminarMenu.call(this);" ruta="{{URL::to('menu/eliminar')}}/{{$menu->idMenu  }}" class="btn btn-outline btn-danger">Button con this</button>

<button  id="eliiminarMenu3" name="eliiminarMenu"  data-toggle="tooltip" title="ELIMINAR" ruta="{{URL::to('menu/eliminar')}}/{{$menu->idMenu  }}" class="btn btn-outline btn-danger">Button con event handler manual</button>


text:
Q: Finding indexes of each element in a multidimensional array in ruby Eg
:a=[["hello", "world"], ["good", "lord"], ["hello", "lord"]]

I need to find and record the indexes of each word with respect to the super-array.
i.e
hello => 0,2
world => 0
lord => 1,2.

here's my shot ,but its very amateurish and lengthy.
all_tokens=tokens.flatten
all_tokens.each do|keyword|
    tokens.each do|token_array|
        if token_array.include?keyword
            x << i
        end
        i=i+1
    end
    y[k] = x.clone
    y=y.clear
end

A: Slight improvement (imho) on vava's solution:
tokens = [["hello", "world"], ["good", "lord"], ["hello", "lord"]]

tokens_hash = Hash.new{|h, k| h[k] = []}

tokens.each_with_index do |subarr, i|
  subarr.each do |word|
    tokens_hash[word] << i
  end
end

A: ret = []
a.each_with_index {|x, i| if x.include?(keyword) then ret << i end }

A: a.each_with_index.inject({}){|acc,(elem,i)|
  elem.each{|e|
    acc[e] ||= []
    acc[e] << i
  }
  acc
}
#=> {"hello"=>[0, 2], "world"=>[0], "good"=>[1], "lord"=>[1, 2]}

A: tokens = [["hello", "world"], ["good", "lord"], ["hello", "lord"]]

tokens_hash = Hash.new([])

tokens.each_with_index do |subarr, i|
    subarr.each do |word|
        tokens_hash[word] = tokens_hash[word] + [i]
    end
end

p tokens_hash #=>{"good"=>[1], "world"=>[0], "lord"=>[1, 2], "hello"=>[0, 2]}

My solution will scan the whole structure just once.

A: Just for grins, a functional solution:
#!/usr/bin/ruby1.8

a = [["hello", "world"], ["good", "lord"], ["hello", "lord"]]

b = a.flatten.uniq.inject({}) do |hash, word|
  hash.merge(word => a.each_with_index.collect do |list, i|
               list.index(word) && i
             end.compact)
end

p b    # => {"world"=>[0], "good"=>[1], "lord"=>[1, 2], "hello"=>[0, 2]}

A: a=[["hello", "world"], ["good", "lord"], ["hello", "lord"]]
result = Hash.new{|k,v| k[v] = []}
a.each_with_index{|b,i| b.each{|c| result[c] << i} }
result
#=> {"good"=>[1], "world"=>[0], "lord"=>[1, 2], "hello"=>[0, 2]}


text:
Q: Sequelize query to get records not in associations There are two tables userMedium and medium. medium hasMany userMedia. For a user, wanna get the medium records that not included in the userMedia. With the Sequelize library, it was implemented as:
const um = await Models.UserMedium.findAll({
    where: {userId},
    attributes: ['mediumId']
  }),
     media = await Models.Medium.findAll({
          where: {
            id: {
              $notIn: _.pluck(um, 'mediumId')
            }
          }
        });

Wonder is there a better way to run the query by using the eager loading?

A: I'm not sure that the version of Sequelize that you are using supports this, but on the documentation explains how to use eager loaded models in top level where clause.
The following piece of code exploits eager loading and should work for you.
const media = await Medium.findAll({
    where: { '$UserMedium.userId$': userId },
    include: ['UserMedium']
});


text:
Q: assembly language tricky memory addresses We are given the prompt (using AT&T ASM)
eax      = A

ebx      = B

ecx      = &X

edx      = &Y

I understand that (%eax) would grab the data in the memory location at A, but what would doing (%edx) grab? Say for example the call
 movl (%edx), %ebx

Also
movl %eax, (%ecx)

Does the first call just replace %ebx's current value with &Y (memory location of y) and the second call replace the data in the memory location &X with the value A?
What about the operation movl %edx, %eda? Does this just move the memory location of &Y into eax?
Thanks

A: From the 'C' language perspective:
eax      = A

eax gets a copy of the value of A.
ebx      = B

ebx gets a copy of the value of B.
ecx      = &X

ecx gets the address (or memory location) of X.
edx      = &Y

edx gets the address (or memory location) of y.


text:
Q: Proving Convergent Subsequence Let ${a_n}$ be a sequence and $b_n := \frac {2a_n + (-1)^n}{|a_n| +1}$ for $n$ in $\mathbb N$. Prove that ${b_n}$ has a convergent subsequence.
Attempt:
To show that the subsequence converges, I just have to show boundedness right? Is what I have here correct? Am I missing anything?
$|b_n| = |\frac {2a_n + (-1)^n}{|a_n| +1}| = \frac {|2a_n + (-1)^n|}{|a_n| +1} \le \frac {2|a_n| + 1}{|a_n| +1} \le \frac {2|a_n| + 2}{|a_n| +1} = 2$


text:
Q: Ionic: Why if I have the title attribute nothing shows up on the app (?) I am using ion-tabs and the last version of Ionic framework, as you can see here at the bottom there are 3 options: Home, About, Contact.
I want to display something similar in my app, the icons are displaying correctly but with no title.
this is what I am getting instead of this
and here my code:
 <ion-tabs class="tabs-positive tabs-icon-only">

  <ion-tab title="Straight" icon-on="ion-android-arrow-forward" icon-off="ion-ios-arrow-thin-right" ng-click="showBetType('displayStraight')">
    Straight
  </ion-tab>
  <ion-tab title="Parlay & Robin" icon-on="ion-ios-loop-strong" icon-off="ion-ios-loop" ng-click="showBetType('displayParlayRobin')">
    Parlay & Robin
  </ion-tab>
  <ion-tab icon-on="ion-ios-redo" icon-off="ion-ios-redo-outline" ng-click="showBetType('displayParlayIfBet')">
    If & Reverse
  </ion-tab>
  <ion-tab icon-on="ion-arrow-shrink" icon-off="ion-arrow-expand" ng-click="showBetType('displayParlayTeaser')">
    Teaser
  </ion-tab>

</ion-tabs>

A: Try to remove the tabs-icon-only class form ion-tabs.
<ion-tabs class="tabs-positive">

 ...


text:
Q: Java open source library to generate pivot table out of excel Given an excel file I want to generate a pivot table programmatically. I have heard of Aspose.Cells but it is paid version. Can someone suggest some open source libraries similar to Aspose.Cells or atleast any tutorial link where I can get some help to generate pivot table programmatically.

A: Please try https://github.com/jbaliuka/x4j-analytic, it is open source and it is designed for pivot reports with huge details sheet.
There are several other open source libraries to achieve the same thing but we developed this library to workaround performance issues, we use temp file to avoid  unreasonable memory consumption and write XML to stream as raw bytes to avoid overhead caused by XML API.
See samples https://github.com/jbaliuka/x4j-analytic/blob/master/samples/src/test/java/x4j/samples/X4JEngineTest.java, it needs XLSX template, XML descriptor and several lines of code to implement basic pivot report.


text:
Q: Telerik.Web.UI could not be found, yet in project references I am trying to move some existing webforms over to a new Web Application project type and they make use of the Telerik AJAX UI controls. I have installed the Telerik package and gone through their configuration steps (i.e. Convert to Telerik  Web Application).
When I try and reference the controls via the using directive ...
using Telerik.Web.UI;
I get an error saying ..
The type or namespace name 'Telerik' could not be found (are you missing a using directive or an assembly reference?)
What is confusing me is that the project has the references to the Telerik DLLs as shown below.

Why can't they be referenced?

A: This reference can point to a wrong location or version of the assembly.
Please remove the reference and add it again.
Note that all Telerik assemblies should be taken from the same installer.


text:
Q: Shopify: Cannot get rid of an element even after editing base CSS I have a <p> element which I wish to remove by display:none. I am adding the following code in the main CSS file (core.css). This file is getting referenced on all pages as per the Network tab. Also, in Inspect Element I see the code for this particular element is coming from inline styling, which isn't part of any asset file on Shopify Code Editor, and cannot be edited as a result. What is the way out here?
Code I am adding to core.css:
p.hulk-powered-wrapper {
    display:none !important;
  }

Page in question: https://shop.rallyappliances.com/pages/contact
Upon further investigation, I found that the only CSS file that is able to edit this element (where adding the following code works) is an external stylesheet from the app developer's website. However, given as the HTML is finally on my website, doesn't it mean I should have a master CSS which overrides the external CSS? In the screenshot I have marked which CSS file being loaded is able to make this change.

A: I added identical code in the Chrome DevTools and it worked (i.e., Shopify Forms Powered by HulkApps disappeared).
Two questions:

*

*Is this the only thing you have inside the core.css?

*I'm not familiar with Shopify, but in Magento 2 sometimes CSS doesn't work because of the cache. Have you cleared the cache?

UPDATE

*

*I see you have a lot of code inside the core.css. Everything else works? Is this display: none; the only thing that doesn't?

*I see that p.hulk-powered-wrapper{display:none !important} is inside the core.css so the problem shouldn't be related with the cache.

A: Looks like that p tag is inside an iframe, so maybe try something like this (with jQuery):
$("#frame_ai7L9yHu4aWawvcQdO6NJw").contents().find(".hulk-powered-wrapper").hide();


text:
Q: Can't Install eclipse theme I have recently switched Eclipse workbench and installed again the MoonRise UI Theme for my Eclipse.
Unfortunately I don't know why font colors don't change. Can anyone help me?
Running Eclipse Mars
How it should be:

How it is:

A: I hope you would have got the answer by now.
To get the fonts one must change the preference. There is an existing preference available by name RainbowDrops.epf. You can import the same to get a dark theme look.
A complete tutorial along with the RainbowDrops.epf file is available in the below link.
https://marketplace.eclipse.org/content/eclipse-moonrise-ui-theme/metrics


text:
Q: Prevent Opera browser from enriching HTML5 fields I'm using loads of inputs with HTML5 types (such as 'date' or 'time') using the jQuery Tools library. Some browsers (like Opera) automatically recognize that and, for example, transform the <input type="time" /> into a time input.
However, I do not want that behavior (since Opera's time input does not include seconds). Is there any common HTML5 way of disabling such special behavior?
Thanks,
Remo

A: If you want a time element on Opera to display seconds, add the attribute step="1", you can get milliseconds by setting step="0.1" and step=60 will give you the default hh:mm again.  This also works in Chrome (tested in 9.0.597.98 beta).

A: As most of the commenters on the original question already stated:  No, there is no "common HTML5 way" to prevent this behavior.
Even if so, you shouldn't. You're effectivly asking Opera to ignore something you asked for in the first place: a special UI.