text:
Q: ExecJS Error when pushing to heroku I have a rails app that I'm trying to push heroku but it fails each time with this message:
ExecJS::RuntimeError: SyntaxError: Unexpected token: eof (undefined) (line: 14023, col: 0, pos: 385975)

as well as some JS parsing errors. I have no idea where to even look for this error, as there's no file name given! I'm wondering if it's an issue with my application.js file, which is:
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs

Also, I have a .coffee file for every js file I have, but I only have an application.js file, not an application.coffee file. Do I need one?
Also, for what it's worth, I get this error after running
RAILS_ENV=production bundle exec rake assets:precompile

before trying push to heroku.
AND, in my config/environments/production file, I changed:
config.assets.compile = false

to:
config.assets.compile = true

Please help!!
Full result when I run git push heroku master:
    rake aborted!
ExecJS::RuntimeError: SyntaxError: Unexpected token: eof (undefined) (line: 14023, col: 0, pos: 385975)

Error
    at new JS_Parse_Error (/private/var/folders/0f/gkfrtx592rg1vvlngny3pvfw0000gn/T/execjs20170110-43579-1j8a3cpjs:3623:11948)
    at js_error (/private/var/folders/0f/gkfrtx592rg1vvlngny3pvfw0000gn/T/execjs20170110-43579-1j8a3cpjs:3623:12167)
    at croak (/private/var/folders/0f/gkfrtx592rg1vvlngny3pvfw0000gn/T/execjs20170110-43579-1j8a3cpjs:3623:22038)
    at token_error (/private/var/folders/0f/gkfrtx592rg1vvlngny3pvfw0000gn/T/execjs20170110-43579-1j8a3cpjs:3623:22175)
    at unexpected (/private/var/folders/0f/gkfrtx592rg1vvlngny3pvfw0000gn/T/execjs20170110-43579-1j8a3cpjs:3623:22263)
    at block_ (/private/var/folders/0f/gkfrtx592rg1vvlngny3pvfw0000gn/T/execjs20170110-43579-1j8a3cpjs:3623:28063)
    at /private/var/folders/0f/gkfrtx592rg1vvlngny3pvfw0000gn/T/execjs20170110-43579-1j8a3cpjs:3623:27686
    at function_ (/private/var/folders/0f/gkfrtx592rg1vvlngny3pvfw0000gn/T/execjs20170110-43579-1j8a3cpjs:3623:27782)
    at expr_atom (/private/var/folders/0f/gkfrtx592rg1vvlngny3pvfw0000gn/T/execjs20170110-43579-1j8a3cpjs:3623:31068)
    at maybe_unary (/private/var/folders/0f/gkfrtx592rg1vvlngny3pvfw0000gn/T/execjs20170110-43579-1j8a3cpjs:3624:1752)
    at expr_ops (/private/var/folders/0f/gkfrtx592rg1vvlngny3pvfw0000gn/T/execjs20170110-43579-1j8a3cpjs:3624:2523)
    at maybe_conditional (/private/var/folders/0f/gkfrtx592rg1vvlngny3pvfw0000gn/T/execjs20170110-43579-1j8a3cpjs:3624:2615)
    at maybe_assign (/private/var/folders/0f/gkfrtx592rg1vvlngny3pvfw0000gn/T/execjs20170110-43579-1j8a3cpjs:3624:3058)
    at expression (/private/var/folders/0f/gkfrtx592rg1vvlngny3pvfw0000gn/T/execjs20170110-43579-1j8a3cpjs:3624:3384)
new JS_Parse_Error ((execjs):3623:11948)
js_error ((execjs):3623:12167)
croak ((execjs):3623:22038)
token_error ((execjs):3623:22175)
unexpected ((execjs):3623:22263)
block_ ((execjs):3623:28063)
(execjs):3623:27686
function_ ((execjs):3623:27782)
expr_atom ((execjs):3623:31068)
maybe_unary ((execjs):3624:1752)
expr_ops ((execjs):3624:2523)
maybe_conditional ((execjs):3624:2615)
maybe_assign ((execjs):3624:3058)
expression ((execjs):3624:3384)
/Users/lisabuch/.rbenv/versions/2.2.1/bin/ruby_executable_hooks:15:in `eval'
/Users/lisabuch/.rbenv/versions/2.2.1/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
buchoroney [master] :> git push heroku master
Counting objects: 261, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (246/246), done.
Writing objects: 100% (261/261), 80.90 MiB | 1.69 MiB/s, done.
Total 261 (delta 132), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.2.4
remote: -----> Installing dependencies using bundler 1.13.6
remote:        Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote:        Fetching gem metadata from https://rubygems.org/..........
remote:        Fetching version metadata from https://rubygems.org/..
remote:        Fetching dependency metadata from https://rubygems.org/.
remote:        Using rake 11.3.0
remote:        Using i18n 0.7.0
remote:        Using json 1.8.3
remote:        Using minitest 5.10.1
remote:        Using thread_safe 0.3.5
remote:        Using builder 3.2.2
remote:        Using erubis 2.7.0
remote:        Using mini_portile2 2.1.0
remote:        Using rack 1.6.5
remote:        Using mime-types-data 3.2016.0521
remote:        Using arel 6.0.3
remote:        Using execjs 2.7.0
remote:        Using sass 3.4.22
remote:        Using coderay 1.1.1
remote:        Using coffee-script-source 1.11.1
remote:        Using thor 0.19.4
remote:        Using concurrent-ruby 1.0.2
remote:        Using high_voltage 3.0.0
remote:        Using multi_json 1.12.1
remote:        Using method_source 0.8.2
remote:        Using pg 0.19.0
remote:        Using slop 3.6.0
remote:        Using bundler 1.13.6
remote:        Using rdoc 4.3.0
remote:        Using tzinfo 1.2.2
remote:        Using nokogiri 1.6.8.1
remote:        Using mime-types 3.1
remote:        Using autoprefixer-rails 6.5.3
remote:        Using uglifier 3.0.4
remote:        Using bootstrap-sass 3.2.0.2
remote:        Using rack-test 0.6.3
remote:        Using coffee-script 2.4.1
remote:        Using pry 0.10.4
remote:        Using sdoc 0.4.2
remote:        Using activesupport 4.2.6
remote:        Using sprockets 3.7.0
remote:        Using mail 2.6.4
remote:        Using pry-rails 0.3.4
remote:        Using rails-deprecated_sanitizer 1.0.3
remote:        Using globalid 0.3.7
remote:        Using activemodel 4.2.6
remote:        Using jbuilder 2.6.1
remote:        Using loofah 2.0.3
remote:        Using activejob 4.2.6
remote:        Using activerecord 4.2.6
remote:        Using rails-html-sanitizer 1.0.3
remote:        Using rails-dom-testing 1.0.7
remote:        Using actionview 4.2.6
remote:        Using actionpack 4.2.6
remote:        Using actionmailer 4.2.6
remote:        Using railties 4.2.6
remote:        Using sprockets-rails 3.2.0
remote:        Using coffee-rails 4.1.1
remote:        Using jquery-rails 4.2.1
remote:        Using rails 4.2.6
remote:        Bundle complete! 14 Gemfile dependencies, 55 gems now installed.
remote:        Gems in the groups development and test were not installed.
remote:        Bundled gems are installed into ./vendor/bundle.
remote:        Bundle completed (2.49s)
remote:        Cleaning up the bundler cache.
remote:        Removing turbolinks (5.0.1)
remote:        Removing turbolinks-source (5.0.0)
remote:        Removing sass-rails (5.0.6)
remote:        Removing tilt (2.0.5)
remote: -----> Detecting rake tasks
remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
remote:        I, [2017-01-11T04:11:56.664376 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/alpaca-df4ffb199b8c9840fad0e7e0bce8cd8cefc72e22344c0a5f176afbee4f6a8769.png
remote:        I, [2017-01-11T04:11:56.667287 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/beer-4bac3a4ff9a53e5ed7780c3d1fbfad9abf5e5720d4507f18e51d0ce7ad294a09.png
remote:        I, [2017-01-11T04:11:56.669620 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/cam-c87079ad40acfa1664069bb7e4ea894db2ed282bfcfa724a84e0afa0e81d8569.png
remote:        I, [2017-01-11T04:11:56.672490 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/canoe-d8b8b614ded174cfda9ded8a38e0717ce413b1985ddc8ff9796ed17f69a47aed.png
remote:        I, [2017-01-11T04:11:56.674929 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/cow-608a748a0f233089233c8d10bcdb1283015ba3504ea24e6687f43544b21a413b.png
remote:        I, [2017-01-11T04:11:56.698746 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/dave_lisa_005-547aa608ad73f0f08cf6d7ded8062849c432eb749587f9b4e4ec8b5af7ad0337.jpg
remote:        I, [2017-01-11T04:11:56.752823 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/dave_lisa_009-33866f70c9a80c30121917bf67fc44cec9fdb2715f4d1accc525a3582f795acd.jpg
remote:        I, [2017-01-11T04:11:56.769483 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/dave_lisa_027-01d142fd5a9cd6000331b161c7125c50c09c7f5afd087f76c09ed8828c1b382a.jpg
remote:        I, [2017-01-11T04:11:56.783824 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/dave_lisa_033-57919df03b7ca690ee356c6a0344e9b4a3e7212f639e7a110ffc445364c04eb1.jpg
remote:        I, [2017-01-11T04:11:56.822990 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/dave_lisa_038-b77b2874171caf15b3ccabf01c009f7aeb1d9c8519df7a16f2c5e6a3c3c4982a.jpg
remote:        I, [2017-01-11T04:11:56.860187 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/dave_lisa_041-a9a6360d0ffcb73e96d71de04d48065e62d4fcea744c9e4cfdfa4783e4b73c98.jpg
remote:        I, [2017-01-11T04:11:56.893716 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/dave_lisa_046-31666604ace314f441c85b55d80e88060ba0e75d789df5759e7815769a975eea.jpg
remote:        I, [2017-01-11T04:11:56.930575 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/dave_lisa_056-69d36d0467dbe972e6564a455c72d5fac47994ac2c3c0affc301a491b4e069e3.jpg
remote:        I, [2017-01-11T04:11:57.018137 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/dave_lisa_076-2-5ae4592685fcbc23bec11e7709a4b14223f924eae08956bc93837b3a6af4205b.jpg
remote:        I, [2017-01-11T04:11:57.048294 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/dave_lisa_083-5f2a2b4a38a0e22ff06fb7385032f6e7dde5e426067149f083583cce25ac47d0.jpg
remote:        I, [2017-01-11T04:11:57.070724 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/dave_lisa_110-2-754645bffd02aa512f8bc20a69df00bb9ee047707b825708ce9493d232a2f397.jpg
remote:        I, [2017-01-11T04:11:57.096807 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/dave_lisa_122-2b6c44727d328c8e6c1cc1ea5d10ed1b4bb31962e2fbcf19808ee793d3576003.jpg
remote:        I, [2017-01-11T04:11:57.159980 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/dave_lisa_137-111c1fa98392a48a0ade5594ce069eb7ce5050fc3cdd0fdf6db3bc51626445b0.jpg
remote:        I, [2017-01-11T04:11:57.164788 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/dave_lisa_148-f33ee4abc8f9124559f7360b7bea0ca02e6a0f53de211022b00fd812e1d25d58.jpg
remote:        I, [2017-01-11T04:11:57.199334 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/dave_lisa_153-18b8a425ef3a2d576a39109cf74e99deeff70a3d782d041ef8fa54e996622cd2.jpg
remote:        I, [2017-01-11T04:11:57.236982 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/dave_lisa_161-c0e920e27eab1dfa87ddced6a3575656970aeb868d10755fe7987160ec2aec9e.jpg
remote:        I, [2017-01-11T04:11:57.275939 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/dave_lisa_167-e96fe77279ddeddee6cb31252989e7d94bc43c92a50c700fdbcecd736f778e61.jpg
remote:        I, [2017-01-11T04:11:57.288059 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/hamilton-8604a101dbd9140966dd27b31eb814f92b24f654dd4a2b101f3f3027b14ff6d1.png
remote:        I, [2017-01-11T04:11:57.374823 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/hero-b014eb100249b79821482d82d088aa79ea48a4b47724cfe37a89833b606cc131.ai
remote:        I, [2017-01-11T04:11:57.390492 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/hero-9eb57ee5fb893691023138931bab42ff95342fd0389c1af713a1db8f14065305.png
remote:        I, [2017-01-11T04:11:57.395194 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/hikersfll-c59462b036f36426b7fe9771b99b63764c50a9b87682113827e2a3425920b574.png
remote:        I, [2017-01-11T04:11:57.399108 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/kimballs-dcc133eb4f6e062e90e74739dde8e5fc57d1eff199e83314caeb9cebdae7f290.png
remote:        I, [2017-01-11T04:11:57.402917 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/lisadave1-606308b8824d6f27e5c4f75b5ec51c94cfa8744f6a764407977a4d76b64fe514.jpg
remote:        I, [2017-01-11T04:11:57.405918 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/lisadave10-20fa30db1c380aea8ed5d3811013cc225770d836eb4fec8e44817e3b8d8001e7.jpg
remote:        I, [2017-01-11T04:11:57.408969 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/lisadave11-269ddbd59bd80273229da49898e9b758ccf0b34f0967a80659530c432ea909f7.jpg
remote:        I, [2017-01-11T04:11:57.411399 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/lisadave12-e9ff5bb0e198bf38a8a2f1aec6b666b88146b4d8339389c24218fa2926c36e1a.jpg
remote:        I, [2017-01-11T04:11:57.413896 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/lisadave13-f98d6d4bbc7d643b4325a5816b042fba7e2fd2ef17943766264fb1fd850e6ca5.jpg
remote:        I, [2017-01-11T04:11:57.416221 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/lisadave14-e7f0d1011120522a87d0f2361670f02282484afb9dae5dcf2f01aed506f41845.jpg
remote:        I, [2017-01-11T04:11:57.418625 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/lisadave15-fb11b642966b37a9f20e35819f2439fcb3ad3447e0cee06fff4ea223647a9945.jpg
remote:        I, [2017-01-11T04:11:57.420933 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/lisadave16-02ac6041f124732cfd09a692d441ee9c19629dc3e8dd81f2d9b21a4a179e10d3.jpg
remote:        I, [2017-01-11T04:11:57.423633 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/lisadave18-0b62f7da231d69d9c0fb9590e61339822f100d29040a00a3fc02d84947fd8a91.jpg
remote:        I, [2017-01-11T04:11:57.426137 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/lisadave19-6951b2c7daa7753348aa634fcfe102fd41c32ab8640d6023c7d34b7dda187338.jpg
remote:        I, [2017-01-11T04:11:57.428679 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/lisadave2-37df1eaac9be0374473201127858be3808dbf547628f5db527ec344a53676fcd.jpg
remote:        I, [2017-01-11T04:11:57.431044 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/lisadave20-a6ad32180a92439757595342ba879f97c305ca3a311e647bb608e0d72c7257a4.jpg
remote:        I, [2017-01-11T04:11:57.433451 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/lisadave21-2c5563a5d8581f9c23554359f34227c8ecf927e9bbfa60777e7f661231fac50d.jpg
remote:        I, [2017-01-11T04:11:57.435760 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/lisadave22-9de7121d5861e6cb27c96aeb0a4e658b5e05ca378ba8305b62e4327e1501b2e2.jpg
remote:        I, [2017-01-11T04:11:57.438153 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/lisadave3-2b0157491b87626e065f9b29768e9a5f0c161b73d125eedf45aaf28424de0b42.jpg
remote:        I, [2017-01-11T04:11:57.440881 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/lisadave4-b8ff8eeb74b500943020ac96362fafe7ab72e4822fee0b50175c8edbbb6bece1.jpg
remote:        I, [2017-01-11T04:11:57.443190 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/lisadave5-9d77809062b3a5d3c08964f6b077b8478c3b9143c9555b2999e0d78ab920446f.jpg
remote:        I, [2017-01-11T04:11:57.445635 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/lisadave6-42e87aa80d804d7790b84181e30af4582b2f401dc6e4afe08ddb6469c24fb734.jpg
remote:        I, [2017-01-11T04:11:57.448011 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/lisadave7-63ccc9204063c316506d6845071a96cd76960270240b790cc25804fd6a80d12a.jpg
remote:        I, [2017-01-11T04:11:57.450691 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/lisadave8-bccd869c69444bc47581aaf64bf5e68765565d3b9316e16c531255208d02dfbd.jpg
remote:        I, [2017-01-11T04:11:57.453438 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/lisadave9-931ce7f441153253d63d6a4dafe66eac08024d05894ec91059dca172ff12b526.jpg
remote:        I, [2017-01-11T04:11:57.458226 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/map2-180dc2e10d2714614d6d1490558333df6c3636bf69e69902824c0944bde9670c.png
remote:        I, [2017-01-11T04:11:57.460749 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/point-4b0f49dae07c43320da2a3cbf304f43802d197e2aa3ed7623115131f28becfcb.png
remote:        I, [2017-01-11T04:11:57.462880 #399]  INFO -- : Writing /tmp/build_fe8ef243326ee2b905f4daf134cdd349/public/assets/zola-logo-pride-d108e071e53520801701f2bf28688c7509d1bace56e907094c71116399cbe2ef.png
remote:        rake aborted!
remote:        ExecJS::RuntimeError: SyntaxError: Unexpected token: eof (undefined) (line: 14023, col: 0, pos: 385975)
remote:        Error
remote:        at new JS_Parse_Error (/tmp/execjs20170111-399-kkh7m3js:3623:11948)
remote:        at js_error (/tmp/execjs20170111-399-kkh7m3js:3623:12167)
remote:        at croak (/tmp/execjs20170111-399-kkh7m3js:3623:22038)
remote:        at token_error (/tmp/execjs20170111-399-kkh7m3js:3623:22175)
remote:        at unexpected (/tmp/execjs20170111-399-kkh7m3js:3623:22263)
remote:        at block_ (/tmp/execjs20170111-399-kkh7m3js:3623:28063)
remote:        at ctor.body (/tmp/execjs20170111-399-kkh7m3js:3623:27686)
remote:        at function_ (/tmp/execjs20170111-399-kkh7m3js:3623:27782)
remote:        at expr_atom (/tmp/execjs20170111-399-kkh7m3js:3623:31068)
remote:        at maybe_unary (/tmp/execjs20170111-399-kkh7m3js:3624:1752)
remote:        at expr_ops (/tmp/execjs20170111-399-kkh7m3js:3624:2523)
remote:        at maybe_conditional (/tmp/execjs20170111-399-kkh7m3js:3624:2615)
remote:        at maybe_assign (/tmp/execjs20170111-399-kkh7m3js:3624:3058)
remote:        new JS_Parse_Error ((execjs):3623:11948)
remote:        js_error ((execjs):3623:12167)
remote:        croak ((execjs):3623:22038)
remote:        token_error ((execjs):3623:22175)
remote:        unexpected ((execjs):3623:22263)
remote:        block_ ((execjs):3623:28063)
remote:        ctor.body ((execjs):3623:27686)
remote:        function_ ((execjs):3623:27782)
remote:        expr_atom ((execjs):3623:31068)
remote:        maybe_unary ((execjs):3624:1752)
remote:        expr_ops ((execjs):3624:2523)
remote:        maybe_conditional ((execjs):3624:2615)
remote:        maybe_assign ((execjs):3624:3058)
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:39:in `exec'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:21:in `eval'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:46:in `call'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/uglifier-3.0.4/lib/uglifier.rb:184:in `run_uglifyjs'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/uglifier-3.0.4/lib/uglifier.rb:146:in `compile'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/uglifier_compressor.rb:52:in `call'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/uglifier_compressor.rb:28:in `call'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:75:in `call_processor'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:56:in `reverse_each'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:56:in `call_processors'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/loader.rb:134:in `load_from_unloaded'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/loader.rb:60:in `block in load'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/loader.rb:44:in `load'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/cached_environment.rb:20:in `block in initialize'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/cached_environment.rb:47:in `yield'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/cached_environment.rb:47:in `load'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/base.rb:66:in `find_asset'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/base.rb:73:in `find_all_linked_assets'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/manifest.rb:142:in `block in find'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:228:in `block in stat_tree'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:209:in `each'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:209:in `stat_directory'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:227:in `stat_tree'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:105:in `each'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:105:in `block in logical_paths'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:104:in `each'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:104:in `logical_paths'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/manifest.rb:140:in `find'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/sprockets/manifest.rb:185:in `compile'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-3.7.0/lib/rake/sprocketstask.rb:147:in `with_logger'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
remote:        /tmp/build_fe8ef243326ee2b905f4daf134cdd349/vendor/bundle/ruby/2.2.0/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
remote:        Tasks: TOP => assets:precompile
remote:        (See full trace by running task with --trace)
remote:  !
remote:  !     Precompiling assets failed.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !   Push rejected to immense-basin-69611.
remote:
To https://git.heroku.com/immense-basin-69611.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/immense-basin-69611.git'

A: Try to uncomment gem 'therubyracer' and run bundle and push the code to heroku.


text:
Q: Dynamically create new variable in SAS dataset using an existing variable I have a SAS dataset:
+-------+-------+-------+-------+
| var_1 | var_2 | var_3 | index |
+-------+-------+-------+-------+
|     1 |    10 |   100 |     2 |
|     2 |    20 |   200 |     1 |
|     3 |    30 |   300 |     3 |
+-------+-------+-------+-------+

Now, I want to create a new variable in the same dataset, whose value in each row is from one of var_1, var_2 and var_3, using the corresponding entry in the index variable.
That is, if my output variable is var_out, then the dataset will look like:
+-------+-------+-------+-------+---------+
| var_1 | var_2 | var_3 | index | var_out |
+-------+-------+-------+-------+---------+
|     1 |    10 |   100 |     2 |      10 |
|     2 |    20 |   200 |     1 |       2 |
|     3 |    30 |   300 |     3 |     300 |
+-------+-------+-------+-------+---------+

Here, the first value of index is 2, hence var_out takes the value of var_2, i.e. 10
Is there any way I can do it, using macro variables if required?

A: You would use an array.
data want;
 set have;
 array vars var1-var3;
 var_out = vars[index];
run;

A: This can also be achieved by using functions, e.g.:
data want;
  set have;
  var_out=input(scan(catx(',', of var1-var3),index),8.);
run;

A: The VVALUE and VVALUEX are also options though they return character values instead of numeric.
data have;
input var_1 var_2 var_3 index;
cards;
1 10 100 2
2 20 200 1
3 30 300 3
;
run;

data want;
set have;
var_out=vvaluex("var_"|| put(index, 2. -l));
run;

http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002233818.htm

A: If you want macro:
%macro out(i); var_&i %mend out;
data t2;
  set t1;
  call symput('index', index);
  var_out=%out(&index);
run;

redpajama_set_name: RedPajamaStackExchange


text:
Q: Read input until the value is < 0 There are plenty of implementations for any other language but not Fortran, and I was not able to adopt from them.
Sample Input:
5 10 15 20 25 0
Output:
Array: [5, 10, 15, 20, 25]

Sample Input:
5
10
15
20
25
0
Output:
Array: [5, 10, 15, 20, 25]

Both types of input should work (one-line and multiple lines).
So, what I've tried is implied do loop (because I know exactly that I can read up to N values); however, I could not find a way to stop reading if the input is 0 or any other value.

What I've tried already
This piece of code clearly does not read values from one line:
do while (.not.input<0)
    read *, input
end do

And this one does not continue until implied do-loop ends
do while (.not.input<0)
    read *, (x(i), i=1, 10)
    input = x(i)
end do

A: This program accepts input from stdin.  You can put more than 1 integer on a line separated by a space. The line can end with 0, e.g., 10 20 30 0.  You can also enter 1 integer per line with the final line being 0.  A blank line is an not allowed.
   program foo
   character(len=3) :: fmt = '(A)'
   character(len=80) s, t
   integer :: m=0
   integer, allocatable :: n(:)
   allocate(n(0))
   do
   read(*,fmt) s
5  call get_token(s,t)
   if (len_trim(s) == 0 .and. len_trim(t) == 0) goto 30
   read(t,*,err=15) i
   if (i == 0) goto 20
   n = [n,i]
   m = m + 1
   if (len_trim(s) /= 0) goto 5
   end do
15 write(*,fmt) 'conversion issue'
   goto 40
30 write(*,fmt) 'blank line'
   goto 40
20 if (m == 0) then
   write (*,fmt) 'no elements'
   goto 40
   end if
   write(s,'(I0)') m
   s = '(' // trim(s) // '(I0,1X))'
   write(*,s) n
40 if (allocated(n)) deallocate(n)
   contains
   subroutine get_token(str, token)
   character(len=*), intent(inout) :: str
   character(len=*), intent(out) :: token
   j = scan(trim(str), ' ');
   if (j /= 0) then
   token = str(1:j)
   str = adjustl(str(j:len_trim(str)))
   else
   token = trim(str)
   str = ''
   end if
   end subroutine get_token
   end program foo

There may be a bug or two.  Ah, there was a bug!  Nothing like a last minute small change to throw a wrench into the mix.


text:
Q: EF4 - is it possible to see which ObjectContext is tracking a particular Entity? EDIT: I'd like to get a definitive answer on whether or not it's possible to determine which ObjectContext is tracking which Entities. Is there a particular property that says "Entity x belongs to this context?"

A: This doesn't necessarily answer your question but its important for a developer to understand the contexts for which they are instantiating and one method is to realize the "UnitOfWork".  For each unit of work there exists a single context and for that unit of work to perform the specific task at hand (e.g. save form data).  Using the "UnitOfWork" pattern, it then receives Id's for dependent objects (or the object itself for the Id), retrieves the objects, creates new objects, wires up dependent and new objects then saves changes.  Then for the code block calling the unit of work to notify other areas of code for which changes have been made via messaging.  But since you are stateless the messaging convention would not directly apply.
The second is, I hardly use AutoMapper or alike and instead use POCO with Code First.  Using this convention I now use my POCO objects as by business objects which get populated by the data layer (EF) where my configurations now occur in the DbContext (UnitOfWork) OnModelCreating method.  Removing the entire mapping process reduces a fair amount of code and complexity.  So my recommendation is to look at your design and ensure there are clear cut patterns for which you manage/seperate data access.
With all that said, mappers are great for web services.  The purpose is to minimize the amount of data sent and received through the request and response processing.  For example if all the caller wants is the first and last name therefore it doesn't make sense to send the entire profile.

A: If you have references to all possible ObjectContext instances, you can determine to which one a given entity instance is attached to by calling their .ObjectStateManager.TryGetObjectStateEntry(Object, out ObjectStateEntry) methods - the right one will return true. If you don't, there is no straightforward public API to get from an entity instance to an ObjectContext instance. If the entity has relationships and implements IEntityWithRelationships, you can retrieve its RelationshipManager, ask it to get any related end (aka "navigation property") with GetAllRelatedEnds, ask the related end to create a query with CreateSourceQuery, cast it to an ObjectQuery and finally retrieve the .Context. You don't have to do all this if you're willing to use reflection to access internal members of Entity Framework classes, but still the best you can get from an instance of an entity without relationships is an ObjectStateManager, not ObjectContext. Better yet, if you require to access the ObjectContext from an entity instance, you can use a custom entity base class (with custom code generation template or otherwise) with an ObjectContext property which you can populate and clear in the event handler for ObjectStateManagerChanged.


text:
Q: Flex Null Integer I take data from Java to Flex by AMF (BlazeDS)
In java side object has Integer field. So it can be null.
In Flex side object is int. So null values are deserialized as 0.
This is not what I want, I want to see whether it is 0 or null.
Is there wrapper like (Integer in Java) for Flex?
Thanks

A: As far as I can tell, there is no such wrapper. You can write one that assigns NaN to the internal int if the argument to the constructor is null

A: We solved this by creating a BeanProxy class which overrides setValue and getValue. In there we return NaN to the flex side if the value is a Number and null, and we return null to the Java side if it's a Double and NaN. Job done:

@Override
public void setValue(Object instance, String propertyName, Object value) {
    if ((value instanceof Double)) {
        Double doubleValue = (Double) value;
        if (doubleValue != null && doubleValue.isNaN()) {
            super.setValue(instance, propertyName, null);
        }
    }else{
          super.setValue(instance, propertyName, value);
        }
}

@Override
public Object getValue(Object obj, String propertyName) {
    final Class classType = super.getType(obj, propertyName);
    if (isNumber(classType) && super.getValue(obj, propertyName) == null) {
        return Double.NaN;
    }
    return super.getValue(obj, propertyName);
}

A: Amarghosh has the correct answer, but you'll find as you continue through your project that life is so much easier in the amf world when you apply the "everything is a string" rule.  Simply a suggestion that might help a lot in the long run.
Best of luck,
Jeremy

A: As Amarghosh answered, there is no such wrapper. As a workaround, we check the int value for -1 which equals an unassigned int value in our domain.


text:
Q: How to create multiple HTML pages with same layout? I'm building a website that has a similar format with all of the pages is there a way to have a template so you don't have to retype the same code over and over again so that if I want to redesign the website I only have to redesign the main template instead of every page

A: Creating multiple HTML pages with the same layout is exactly the reason why frameworks such vuejs and react are so popular. if you are new in web dev I can recommend you vuejs. It's very easy to learn.


text:
Q: Is it an incorrect practice to use URL params as a way to fetch data using react router in an react application? In my app I have a Home page that has a child named Posts the routes are set up in the following manner:
<Route path='/' element={<Home />}>
  <Route path='/posts/popular' element={<Posts />} />
  <Route path='/posts/new' element={<Posts />} />
</Route>

I would like to set it up where if I am on the popular path then my api call will be:
axios.get('/posts?sort=-popular')

But if I am on new, then the call would be:
axios.get('/posts?sort=-createdAt')

The way I was thinking of implementing it was to make the second param into a selector like:
<Route path='/' element={<Home />}>
  <Route path='/posts/:sortBy' element={<Posts />} />
</Route>

// in my Posts component I would call useParams
const {sortBy} = useParams();

// then in useEffect
axios.get(`/posts?sort=-${sortBy})

But this feels off, like I am doing it wrong. What is a better way, if any, of implementing this functionality?

A: You can pass props into the <Posts /> component in your Route.
Here's an example:
<Route path='/' element={<Home />}>
  <Route path='/posts/popular' element={<Posts sort="popular" />} />
  <Route path='/posts/new' element={<Posts sort="createdAt" />} />
</Route>

Then inside Posts you can use the prop to determine which call to make:
const Props = ({ sort }) => {

// then in useEffect
axios.get(`/posts?sort=-${sort})

A: What you did is ok, but it will make the component harder to reuse, also if you changed the path you will need to change also the component Posts. It's better to add a new prop sortBy inside your component Posts and pass the prop inside your Route component.
<Route path='/' element={<Home />}>
 <Route path='/posts/popular' element={<Posts sortBy="popular" />} />
 <Route path='/posts/new' element={<Posts sortBy="new"/>} />
</Route>


text:
Q: How to input an external load perturbation on the second order differential equation of a spring-mass-damper? I am trying to input an random external perturbation (F) on the ODEs modeling a spring-mass-damper system, but I am not having success.
When I try a constant value for the perturbation (F=5), as in the following example, the code runs perfectly.
But when I try the random external perturbation that I calculate before the function (mydiff), this message appears: "Setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part."
def mydiff(x,t):
    c=2 #damping
    k=4 #stiffness
    m=20  #mass
    F=5 #constant value

    dx1dt=x[1]
    dx2dt=(F-c*x[1]-k*x[0])/m

    dxdt=[dx1dt,dx2dt]
    return dxdt,F

x=odeint(mydiff,x_ini,t)


text:
Q: Python Pandas Dataframe Memory error when there is enough memroy
Exception has occurred: MemoryError Unable to allocate 34.6 MiB for an array with shape (2265257,) and data type complex128

Hello, I have encountered this error. But I can't understand why this kind of error occurs.
I know that It is raised due to lack of memory.
But I have enough memory to handle that data.
Do you know why Python limits it even when I have more memory?

A: It looks like you are using the 32 bit version of python. On Microsoft Windows, 32 bit processes can only utilize 2 GB of 4 GB maximum possible memory and your Python process is near the limit. I suggest using the 64 bit version.


text:
Q: C# Installer Shortcut StartIn Property I have a C# project that I've created an installer for.
I've read the instructions on how to add a shortcut to the primary output file of my project to the startup and start menu folders.  This works well.
The problem is that I need the StartIn property of the shortcut to be a specific folder on the clients machine (not the default value).  I can manually go in and edit this property, but I have to deploy this on several machines.
The startin directory I'm trying to point to is always the same (on all computers), but I can't seem to figure out how to set the StartIn property on the shortcut to point to that directory.
Suggestions?

A: I think I actually figured it out.
I'm using the built-in C# Installer class in VS Studio 2010.

*

*In the File System on Target Machine panel (on the left) I right-clicked and selected Add Custom Folder.

*In the properties of that folder, I put the target directory I'm trying to get my shortcut to start in (call it the working folder).

*I then went over to my shortcut in the start menu folder and set the Working Folder property to the folder I just created.

Once I built it and ran the installer... it appears that the Start In property of the shortcut is now using the working directory I specified, instead of the default value.  There may be another way to do this, but this seemed to work for me.


text:
Q: VueJS Router - change named view in root with child route The ask

*

*Control a root-level view from a child route. The example below is one level deep, but I could need to control the other view from deeper routes.

*Have both the default view and another view in a single template, other simply must live at this level and will not work how I need if nested within other components:
<router-view name="default"/>
<router-view name="other">/>

*Must have a parent-child route relationship to maintain navigation functionality (router-link-active)
Attempts
For a route, have the view set:
{
    path: '/my-path',
    component: ComponentOne,
}

Going to /my-path shows ComponentOne in default view, other view is empty, as it should.
Now at a child route, I want the other view to show ComponentTwo.
This does not work because it expects other view to be within default view, and so ComponentTwo is simply not rendered:
{
    path: '/my-path',
    component: ComponentOne,
    children: [
        {
            path: '/my-path/more',
            components: {
                'other': ComponentTwo
            }
        }
    ]
}

This does not work because it does not maintain the parent-child relationship:
{
    path: '/my-path',
    component: ComponentOne
},
{
    path: '/my-path/more',
    components: {
        default: ComponentOne,
        other: ComponentTwo
    }
}

A: I don't think it's possible to control a router-view from a nested route.
However, to do what you ask quickly, the solution would be to manage the contents of all (/my-path and sub-routes), in a nested route even for the path /my-path as well. You don't even need named routes.
I'll explain better with an example:
{
    path: '/my-path',
    component: ComponentWrapper,
    children: [
        {
            path: '', // Match '/my-path' or '/my-path/'
            component: ComponentOne
        },
        {
            path: 'more', '/my-path/more'
            component: ComponentTwo
        }
    ]
}

In the ComponentWrapper you have to insert a router-view to render the nested routes and everything will work fine, even parent-child route relationship.

A: Unfortunately Leonardi's solution does not work if you wanted to refer to the the current child's component from a component that's more than 1 level higher in the hierarchy (i.e. a layout).
I was able to work around this by writing a computed method to determine the component of the current child route in the parent component.

{
    path: '/my-path',
    component: ComponentOne,
    children: [
        {
            path: '/my-path/more',
            components: {
                'other': ComponentTwo
            }
        }
    ]
}

<!-- App.vue or SomeLayout.vue -->
<template>
  <router-view /> <!-- ComponentOne -->
  <component :is="componentOfCurrentChildRoute" /> <!-- ComponentTwo -->
</template>

<script>
export default {
  computed: {
    componentOfCurrentChildRoute() {
      // Get an array of the current route ancestor hierarchy
      const {matched} = this.$route;

      // Return the component defined by the current child route
      return matched?.[matched.length - 1]?.component; // or components.sidebar if using named views
    }
  }
}
</script>


text:
Q: Google places API does this violate the TOC? I want to have a little search box, where the user can search for a place (using API), then when they select a place e.g "statue of liberty, new york", I want to take them to a detail
page I.E mysite/ID/statue-of-liberty-new-york
and then let them do some things on that page,
The only data I want from google on the detail page, is the places ID and of course the name and address of the place, that's it then I want to do my own stuff and attach my own data to the places.
I'm a bit annoyed it's hard to understand what is acceptable, they should have expressed this TOC in laymans terms.
Here's some relveant info from their TOC:
a) No Unauthorized Copying, Modification, Creation of Derivative Works, or Display of the Content. You must not copy, translate, modify, or create a derivative work (including creating or contributing to a database) of, or publicly display any Content or any part thereof except as explicitly permitted under these Terms. For example, the following are prohibited: (i) creating server-side modification of map tiles; (ii) stitching multiple static map images together to display a map that is larger than permitted in the Maps APIs Documentation; (iii) creating mailing lists or telemarketing lists based on the Content; or (iv) exporting, writing, or saving the Content to a third party's location-based platform or service.
(b) No Pre-Fetching, Caching, or Storage of Content. You must not pre-fetch, cache, or store any Content, except that you may store: (i) limited amounts of Content for the purpose of improving the performance of your Maps API Implementation if you do so temporarily (and in no event for more than 30 calendar days), securely, and in a manner that does not permit use of the Content outside of the Service; and (ii) any content identifier or key that the Maps APIs Documentation specifically permits you to store. For example, you must not use the Content to create an independent database of "places" or other local listings information.

A: The relevant policies for your question you'll find here: https://developers.google.com/places/policies

*

*you may use the searchbox and you also may use the results to show them on a page without showing a google-map

*it's still not clear if you use any type of map inside your application, but when you do so, you may not use any data delivered by the places-service to use them on this map(e.g. you may not use the latLng of the place-result to create a marker on this map)

*you must show the google-logo (because you show data -name and address- received from the service)

*when the response contains html_attributions for the place  you also must show these html_attributions


text:
Q: bootstrap tooltip at the end of countdown I have a countdown on a page that will display "Please wait" when it reaches 0. I would like to display a bootstrap tooltip with some text.
The "Please wait" text is either generated by the javascript below or if the user reloads the page (and that the database has been updated yet after the countdown - I have a script running every two minutes to update the database status).
When I reload the page the tooltip is well displayed:

The produced code is:

Please wait

But if the "Please wait" comes from the javascript, the tooltip is not well displayed:

In that case the produced code is:

Please wait

This is my javascript:

How can I make the tooltip displayed correctly from the javascript as well?

A: micmia's opinion should be right, let me try to clarify a bit more.
Firstly, as stated in bootstrap document, For performance reasons, the Tooltip and Popover data-apis are opt-in, meaning you must initialize them yourself. Also, I tried out on jsfiddle: https://jsfiddle.net/qbfz6zcu/ , it appears to be true that tooltips won't work without explicit initialization(note the init js codes are commented, if you uncomment them, tooltip will show). Not sure how your page-reload-and-tooltip-works part works.
And here's a brief clarification on what the initialization does: bootstrap's tooltip works by adding an eventListener to the "please wait" part so when you hover on them, event triggered and you see the tooltip. I guess there's some init code in your page you didn't notice, so anyway, if you modify your dom some time after the page's loaded, you'll have to initialize again after every time you do so, cause the newly added html elements won't have the event listener to show tooltips


text:
Q: Contradiction of total energy of a system? I consider a situation in a system in which an observer is sitting in body of mass $M$ and another observer in a body of mass $2M$, both moving with velocity $v$ towards each other. If observers in each body consider themselves at rest and the other one is in motion, total energy calculated by the first observer is $\frac{2M(2v)^2}{2}$ but for the second observer it is $\frac{M(2v)^2}{2}$ which is half of the first. How am I getting different total energy of system at same instant?

A: Kinetic energy is not reference-frame-independent, as you are observing now. Instead, the total energy of the two is related by an additive constant which doesn't physically do anything (just like adding a constant term to the potential energy has no physical ramifications).
A helpful example
It helps to work out an example which contains a common fallacy (a fallacy so common that the Mythbusters committed it in one episode and got so many complaints that they tested it in another, proving the doubters right!). This is the "a car crashes into a fixed-to-the-ground immobile wall; the car is moving at velocity $+v$ relative to the ground. Would it sustain more damage if it, still moving at $+v$ relative to the ground, crashes into an identical oncoming car moving at $-v$ relative to the ground?" scenario. Let $K_0 = \frac12mv^2$ be the energy that the car crashing into the wall must dissipate to come to a complete stop.
The answer from the ground frame is a clear "no!". The total kinetic energy is $2K_0$ which gets evenly distributed into crushing either car, so each car must absorb $1K_0,$ exactly the same as crashing into an immovable, unbreakable wall.
The common fallacy occurs when we switch into the one car's reference frame, where the relative velocity is $-2v$, calculate the total kinetic energy as $\frac12 m (-2v)^2 = 4K_0$, and distribute it among the cars evenly, so they each must dissipate $2K_0$, which should presumably lead to more carnage. The error here is to neglect the final kinetic energy of the two cars: in this particular reference frame both cars travel off with velocity $-v$ after the crash, which costs $\frac12(2m)(-v)^2=2K_0$ kinetic energy. So we're not evenly distributing $4K_0$ among the two cars, but rather initial minus final, or $4 K_0 - 2 K_0=2K_0.$ Therefore, in this reference frame each car must also dissipate $K_0$ and we see the exact same carnage.
A helpful proof
In Newtonian mechanics, everyone agrees on forces, masses, times, and changes of velocity. Let me define the symbol $\Delta$, greek capital "delta" for "difference", as $\Delta A = A_1 - A_0$ for how a thing changes between two times $t_0, t_1$. Given a constant force $F$ that acts over this time difference $\Delta t$ on a mass $m$, it produces the change in velocity $\Delta v = v_1 - v_0 = F~\Delta t/m.$
The change in kinetic energy we can write as $$\Delta K = \frac12m\Delta(v^2) = \frac12m(v_1^2 - v_0^2) = m~\frac{v_0 + v_1}2 (v_1 - v_0),$$ because it contains a difference of squares $a^2 - b^2 = (a - b)(a + b).$ Defining the average velocity over this short time as $\bar v = (v_0 + v_1)/2$ we see that $\Delta K = m~\bar v~\Delta v.$
Combining this with the previous result we get $\Delta K = m \bar v (F \Delta t / m) = F~\bar v~\Delta t,$ and the product of the average velocity with a time difference is just a position difference as $\bar v = \Delta x / \Delta t.$ So we get the so-called work-energy theorem $\Delta K = F~\Delta x.$
Now consider two particles of masses $m, M$ interacting this way. We know that everyone sees them exert equal and opposite forces on each other, but they might travel for different distances $\Delta x, \Delta X$. The total change in kinetic energy is therefore $F \Delta x - F \Delta X.$ This might be positive, negative, zero, whatever. Conservation of energy occurs when we can define a "potential energy" which exactly balances this change out; we think (as a law of physics) that we can always do so.
Now if we add a velocity $u$ onto both of these particles, switching into a new reference frame, we see that $\bar v \mapsto \bar v + u$ while $\Delta t$ stays the same, hence they both travel an extra distance $\Delta x' = \Delta x + u~\Delta t.$
However, we see that the force balance gives just $$F~\Delta x' - F~\Delta X' = F~(\Delta x + u~\Delta t) - F~(\Delta X + u~\Delta t) = F~\Delta x - F~\Delta X,$$ so the additional kinetic energy of each of them cancel out when we want to evaluate the change-of-total-kinetic-energy. So when summed over all of the particles, we see that the total kinetic energy is the same up to a constant.


text:
Q: Get a list of team projects using REST api in C# for on premise TFS 2015 Update3 I am trying to get all the projects using REST api call from c# and following the below MSDN documentation:

https://www.visualstudio.com/en-us/docs/integrate/api/tfs/projects

While executing the GetTeamProjects() I am getting the below response:

response  {StatusCode: 404, ReasonPhrase: 'Not Found', Version: 1.1,
  Content: System.Net.Http.StreamContent, Headers:

I am assuming the error may be due to the authentication type. I am passing Basic while my on premise uses NTLM.
I am trying to get the TFS porjects to get the user permission details.

A: I just use this without the need to enable basic authentication:
var client = new WebClient();
client.Credentials = new NetworkCredential("user", "password", "domain");
var response = client.DownloadString("http://tfsserver:8080/tfs/teamprojectCollection/_apis/projects?api-version=2.2");

A: If you have authentication issue, you should get 401 error, not 404. I'm afraid there is something wrong with your code. You can refer to my code below:
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;

namespace GetTeamProjectREST
{
    class Program
    {
        public static void Main()
        {
            Task t = GetTeamProjectREST();
            Task.WaitAll(new Task[] { t});
        }
        private static async Task GetTeamProjectREST()
        {
            try
            {
                var username = "domain\\username";
                var password = "password";

                using (var client = new HttpClient())
                {
                    client.DefaultRequestHeaders.Accept.Add(
                        new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));

                    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic",
                        Convert.ToBase64String(
                            System.Text.ASCIIEncoding.ASCII.GetBytes(
                                string.Format("{0}:{1}", username, password))));

                    using (HttpResponseMessage response = client.GetAsync(
                                "http://tfsserver:8080/tfs/teamprojectCollection/_apis/projects?api-version=2.2").Result)
                    {
                        response.EnsureSuccessStatusCode();
                        string responseBody = await response.Content.ReadAsStringAsync();
                        Console.WriteLine(responseBody);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
    }
}


text:
Q: Volume of ellipsoid via determinant From Convex Optimization by Boyd & Vanderberge:

Let $$E = \{v : \|Av + b\|_2 \le 1\}$$ be the equation of a general
   ellipsoid for $A \in S^n_{++}$ and $b \in \Bbb R^n$, where $S^n_{++}$
   means positive definite symmetric matrices of size $n$. Then, the volume of $E$ is proportional to $\det \left( A^{-1} \right)$.

Can someone explain or prove why this is true?  I have no idea how to show this and this is mentioned in passing.

A: This is a consequence of the multidimensional change of variables formula which states that (under suitable hypotheses) the following formula holds:

\begin{equation}
\int_{g(B)} f = \int_B (f \circ g) \cdot |\det g'|,
\end{equation}
where $g'$ is the gradient of $g$.

For your case, choose $f = 1$ (the constant function), let $B = \{\xi \in \mathbb{R}^n : \lVert \xi \rVert_2 \leq 1\}$ be the unit ball in $\mathbb{R}^n$, and define $g: \mathbb{R}^n \to \mathbb{R^n}$ by
\begin{equation}
g(\xi) = A^{-1} \cdot(\xi - b)
\end{equation}
Then, you can easily verify that $E = g(B)$, so that by the formula above,
\begin{align}
\text{vol}(E) &= \int_E 1 \\
&= \int_{g(V)} 1 \\
&= \int_B (1 \circ g) \cdot |\det g'| \\
&= \int_B 1 \cdot |\det A^{-1}| \\
&= \left( \det A^{-1} \right) \cdot \text{vol}(B)
\end{align}
In the last line, I got rid of the absolute values because of positive-definiteness. So, the volume of $E$ is indeed proportional as claimed, with the constant of proportionality being the volume of the unit ball in $\mathbb{R}^n$.


text:
Q: What would happen if a female vampire hybrid was bitten? The Twilight Wiki says that female half-vampire hybrids do not produce vampire venom. Males, on the other hand, do and one such male has even turned a human into a full vampire with it.
Unlike vampires, hybrids have a functioning heart with blood flowing through their system.
Having no venom, what would happen to a female hybrid if bitten?  Would they turn into a full vampire?

A: Well, for starters, I don't think the novels ever make it very clear why the male hybrid's saliva contains venom and the females don't; it may be gender linked, it may be random genetics. But that's not terribly relevant, as we can still group the hybrids into two categories: those that don't produce venom, and those that do, and still ask:

If a vampire hybrid that is not venomous is bitten by a vampire, what happens?

Canonical Answer
The only canonical answer is "no one knows", because it's never happened in the novels, and presumably won't happen on-screen. There is talk of continuing Twilight well past the end of Breaking Dawn - Part Two, possibly as a television series; depending on who they get to write and direct that, we may or may not get some internally-consistent mythology to draw from, and can maybe answer this question.
For now, they best we can do is make an educated guess, based on what we do know about hybrids and vampire venom, and extrapolate that into real-world biological processes.
Conjectured answer
When injected into a human, the venom attacks their cells and slowly (and painfully) converts them into a vampire. When injected into a vampire, the venom causes some temporary, mild pain. The key questions we need to answer, then, are "What is it about human cells that the vampire venom attacks?", and "Do hybrid vampire's cells have that?"
The action of vampire venom appears similar to snake or insect venom, so lets assume it works the same way as well. Venom attacks the proteins that make up human tissue. Typically, it will attack structures on the cell walls that cause key biological processes to fail, or even the cell walls to rupture. This is very similar to how antibiotics attack bacteria, for example. And just like antibiotics bind better, and thus have more effect against some bacteria than others, vampire venom has more of an effect against human cells than vampire ones. Therefore, it seems logical to assume there is some molecular component expressed on the cell walls of vampire tissue that is distinct from human tissue. (This idea will be reinforced in a bit -- the receptors on the cell wall are a product of the DNA sequence.)
So, the venom most likely attacks something that is found on human cell walls, and not vampire. Would a hybrid have this "venom targeting factor"? Probably not.

(Quick side-note about the genetics. The Twilight wiki claims that hybrids have 24 chromosome pairs; I don't remember that detail but, if true, would almost certainly reflect a genetic defect in the hybrid. There's no way for a hybrid to get an extra pair of chromosomes naturally from a human mother; at worst it would have two extra unpaired chromosomes from the father, and then only if vampires had 25 pairs. If you introduce the idea of genetic defects into the mix, the rest of this hypothesis sort-of goes out the window, so I'm going to ignore it for now.)

A hybrid does not have "human cells" and "vampire cells" -- that's not how genetic hybrids work. The cell has a mixture of genetic material, 50% from each parent, in a combination that just happens to be viable. In order for this to work, the genetics of the two parents must be similar enough that their combined DNA can still code for valid proteins that perform the tasks needed for "life". Presumably, as former humans, vampire DNA is extremely similar to human DNA, so that's good. But hybrids inherit enhanced attributes -- speed, strength, etc. -- that come with being vampires, so those must also be coded within the DNA, meaning vampire DNA must be slightly different from humans. That fits well with the idea that vampire cells are structurally close but not identical to human cells.
Given all of that, I suspect the answer is that lots of pain would happen to a hybrid that got bitten, but probably not anything permanent. Their cell walls would not match exactly what human would be, but would be about halfway (on average) between the vampire and human cells. Thus, the venom would likely find some receptors to bind to and cause cellular disruption, as it does with vampires, only more efficiently. But it likely would not be able to fully bind to the cells and perform whatever transformation process it would against a human cell.

A: As far as the Twilight series goes, there is no definitive answer because it has not happened. It has, however, happened in other series and would likely similarly in the twilight series. In the Night Huntress series by Jeanine Frost, the main character, Cat, is turned from a dhampir to a full-blooded vampire. In doing so, she gains unique abilities, her diet is not human blood but vampire blood instead and she even has a heartbeat at times. Knowing that a dhampir already has vampire DNA, it makes sense that when turned the dhampir would exhibit unique traits that neither dhampir nor vampire have i.e. greater strength, special abilities, greater speed. This is all speculation as to what will happen to a dhampir who attempts the change. As it stands, I see four distinct possibilities. One, the dhampir's vampire half will always reject the change and subsequently die. Two, the dhampir's vampire half will fight the vampiric infection and be unable to change but will still survive. Three, the dhampir will make the change without any problems or complications and become in all respects a normal vampire. The final possibility is the most interesting and is the one where the change will affect the dhampir in a unique way. Instead of becoming a normal vampire, the dhampir will become an unusual vampire and gain unpredictable traits that may help or hinder the dhampir turned vampire. Again, I'm going to mention that this is all speculation and that this is not a definitive answer to your question.

A: I don't think the genetics are scientifically based, so discussion is moot.  I think it more likely is intended as a possible link in the story of the Twilight books, to continue the saga later.  Renesmee has the same number of chromosome pairs as Jacob, making successful reproduction more possible, in terms of thinking about pairings. In Breaking Dawn there was also a brief side plot with Quil (?) babysitting the child he had imprinted on, and having to wait till she grew up, so this is not viewed as an aberration. Also, Leah could possibly imprint on that lone male hybrid from S. America, and this has been somewhat set up by Leah's desire to leave and travel alone. In other words, an entirely new race with two genetic lines to establish that new race, a genetic line that also have includes the ability to mend DNA from the wolves to avoid harmful inbreeding problems, going back go trying to minimally make genetic sense. Personally, I would enjoy more books.  I love the character development and concentration on developing gifts and personalities.


text:
Q: Expressing any given number in the form of $x^y + y^x$ I was told by one of my friends that any given positive integer can be expressed in the form of $x^y + y^x$ where x & y are integers.
For example: 17 = $2^3+3^2$
Surprisingly,this could be done for any number. Now he gave me some another number (like 23421) and asked me to find out the values of x & y.
I racked my brain but couldn't get it. Can any one please explain, how is this possible
and how to get the values of x & y

A: It is a joke problem ("spoiler" below).
$$ $$
The joke is that if $x > 1$ and $y > 1$ the set of  integers of the form $x^y + y^x$ has density zero, so that most numbers are not expressible, while if $x=1$ is allowed the problem is trivial.  Hence the misdirection.


text:
Q: Change image in exe file I have an exe file, when it is executed, has an image in the program interface. I want to modify that image to replace it with another image. Can I get the path to the image that the exe file unpacks into the temp directory when it's executed, or is the image accessed directly from the exe file and I can't modify it?
I tried resource hacker but when open the exe file with it, I can't find the image I need, it not there. So I need other solution, like modify the image when the exe is running.
The exe file could have been written in C++.


text:
Q: Rigid motion on an unknown object A rigid motion of $\mathbb {R^{n}}$ is a map
$M = T ◦ R : \mathbb {R^{n}} \to \mathbb {R^{n}}$
where $ \mathbb {R^{n}} \to \mathbb {R^{n}} $ is linear and satisfies $|R(v)| = |v| \space \space \space \space \space \space ∀v \in \mathbb {R^{n}}$
And T : $ \mathbb {R^{n}} \to \mathbb {R^{n}} $
is
translation, i.e. there exists $ w \in \mathbb {R^{n}}$
 such that $T (v) = v + w$ $\space \space \space \space \space∀v \in \mathbb {R^{n}} $
(Q) Let $α : (a, b) \to \mathbb {R^{n}} $ be a curve and let $M :\mathbb {R^{n}} \to \mathbb {R^{n}}$
 be a rigid motion.
Show that $(M ◦ α)'
 (t)$ = $R ◦ α'(t)$ for all $t \in (a, b)$.
i claim that
$(M ◦ α)'
 (t) = (T◦R◦α)'(t) = (T◦(A(α)))'(t)= (A(α)+w)'(t) = ((A(α))'+(w)')(t)= (A(α))' +0= A'α'(t)$
i also claim that $A'α'(t)= R_1 ◦α' t$
Q1) is this correct?
Q2) how do i show that $R_1=R$?

A: You have $DM(x) = DT(R(x)) D R(x)$, and $DT(x) = I$, hence
$DM(x) = DR(x)$.
Since $R$ is linear, $DR(x) = R$.
Then $D (M \circ \alpha) (t) = DM(\alpha(t)) D \alpha(t) = DR(\alpha(t)) D \alpha(t) = R \alpha'(t)$.


text:
Q: Perfecting the product integral (integral sign with loop at the top) I want to use this symbol for the product integral:

Perhaps with a bigger loop, too. What's the best way of building this notation?

I got it to work for just the integral sign itself.
\usepackage{adjustbox}

\def\Prodint
{\adjustbox{trim = 0pt 0pt 0pt 0.15\height, clip} {$\displaystyle\int$}
{\hspace{-0.45em} \mathrel{\raisebox{0.9em}{$\rho$}}}}

$$|\psi(t)\rangle=\Prodint U_t(dt)|\psi(0)\rangle$$

But its behaviour with (especially lower) limits is really bad.
$$|\psi(t)\rangle=\Prodint_0^T U_t(dt)|\psi(0)\rangle\ne\int_0^T U_t(dt)|\psi(0)\rangle$$

How can I get the lower limit to be placed like in the standard \int (see above for reference)?

A: If you're happy with the symbol, set the lower limit together with the integral, then add the upper limit to the whole block.
\documentclass{article}
\usepackage{amsmath}
\usepackage{adjustbox,xparse}

\NewDocumentCommand{\Prodint}{e{^_}}{%
  \mathop{}\!%
  {%
   \adjustbox{trim = 0pt -0.5pt 0pt 0.15\height, clip}{$\displaystyle\int\IfValueT{#2}{_{#2}}$}%
   \hspace{-0.45em}%
   \raisebox{0.9em}{$\rho$}%
  }%
  \IfValueT{#1}{^#1}%
  \!\mathop{}%
}

\begin{document}

\[
\int_0^T f(t)\,dt \ne
\Prodint_0^T f(t)\,dt
\]

\end{document}


text:
Q: How to get TypeCode of an Array of byte? I need to tell the type of an unknown variable. Type.GetTypeCode() seems good enough for my purposes, but in the case of byte[] it does not provided the desired result.
Here is the simplified code for my problem:
var bytes = new byte[10];
var typeCode = Type.GetTypeCode(bytes.GetType());

// Actual result: typeCode equals Object
// Desired result (pseudocode): "array of TypeCode.Byte"

A: TypeCode is an enumeration, and given there is no enum member representing "array of Byte", you'll get TypeCode.Object, because:

Object
  A general type representing any reference or value type not explicitly represented by another TypeCode.

You're probably looking for Type.GetElementType(), as that returns:

The Type of the object encompassed or referred to by the current array [...]

Using that returned Type you then in turn can call Type.GetTypeCode():
var byteArray = new byte[0];

Type arrayType = byteArray.GetType();
Type elementType =  arrayType.GetElementType();
TypeCode elementTypeCode = Type.GetTypeCode(elementType);

Here, elementTypeCode will be TypeCode.Byte.

A: var typeCodeName = bytes.GetType().Name;//Byte[]
var typeCodeFName = bytes.GetType().FullName;//System.Byte[]

You can return Byte[] if you are taking the Name of GetType. If this is what you desire.


text:
Q: JavaScript version of while True loop I wrote this bit of code
while True:
   text = input('type here > ')
   print text

I've tried the below but it doesnt seem to be working
I'm having bit of a struggle trying to create a JavaScript version of it, since it seems js while loops constantly rerun but python seems to wait for input before rerunning. I am using the readline module to receive input from the console.
const readline = require('readline');

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

while (true) {
 rl.question('type here > ', text => {
       console.log(text)
    })
}

Is there something im getting wrong? Im fairly new to programming
Any solutions?

A: If what you are trying to do is get input from the console in JavaScript you can use NodeJS process.stdin the implementation below :
process.stdin.resume();
process.stdin.setEncoding('utf-8');

let input = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    input += inputStdin;
});

process.stdin.on('end', _ => {
    input = input.trim()
        .split('\n')
        .map(str => str.trim());

    // calling the function that works on the input
    doSomething();
});

function readInput() {
    return input[currentLine++];

}

Sample function to do something with what you get from the console
function doSomething() {
    console.log(readInput())
}


text:
Q: How to get a list of launchable apps? I tried some of the solutions found here but they all have some kind of errors.
Here's what I got:
final PackageManager packManager = getPackageManager();
List<ApplicationInfo> appsInfo;

appsInfo = packManager.getInstalledApplications(PackageManager.GET_META_DATA);

for ( int i = 0 ; i < appsInfo.size() ; i++ ) {
    if (/*app is not launchable*/) {
       appInfo.remove(i);
    }
}

What I want to know is:

*

*What is the condition that should go inside that if statement?

*Surely there has to be a faster way to get launchable apps other than getting all the apps then looping through them to remove the un-launchable ones? I'm hoping for a statement similar to getInstalledApplications like above except it only returns launchable apps.

*Sorry I'm a beginner but what does GET_META_DATA in the above code do and should something else be in its place?


text:
Q: How to NOT pre-load images in expand script? I have a question that's bugging me quite a bit, been working on it a while with every road leading to dissapoints, and no suitable alternatives I've found.
How do I have the following NOT pre-load images?
var oStyle = document.createElement('style');
oStyle.setAttribute('type','text/css');
var css = 'a.hovex-imageview { -moz-outline: 1px dotted red; }';
css += 'a.hovex-imageview img.hovex-imageview { display: none;position: fixed;left: 15%;right: 85%;top:15%;bottom:85%;max-width: 100%;margin: 0;border: none; }';
css += 'a.hovex-imageview:hover img.hovex-imageview { display:block;max-width:80%;max-height:80%; }';
oStyle.innerHTML = css;
document.getElementsByTagName('head')[0].appendChild(oStyle);

var aElm = document.getElementsByTagName('a');
for (i=0; i<aElm.length; i++) {
    if (aElm[i].href.match(/\.(jpg|jpeg|gif|png)$/)) {
        var oImg = document.createElement('img');
        oImg.setAttribute('src',aElm[i].href);
        oImg.setAttribute('class','hovex-imageview');
        aElm[i].appendChild(oImg);
        aElm[i].setAttribute('class','hovex-imageview');
    }
}

Basically, it is perfect in almost every way for my purpose, though the one drawback is it often finds itself on pages with >1000 large images, so having it only load the full image on mouseover of the link/thumb would save people some crashed browsers, I've had people complain about that.
I can see why this could be difficult to do, as it works by creating every image on load and hiding them, then showing them on hover, with it said if I'd found/managed to write an acceptable alternative I'd of used it: this seems to be what I've got.
Great thanks to any helpful wizards in advance~

A: I would approach it by only setting the image src on mouse over...
See this fiddle: http://jsfiddle.net/LD8t6/
var aElm = document.getElementsByTagName('a');
for (i=0; i<aElm.length; i++) {
    if (aElm[i].href.match(/\.(jpg|jpeg|gif|png)$/)) {
        var oImg = document.createElement('img');
        oImg.setAttribute('class','hovex-imageview');
        oImg.setAttribute('src','');
        aElm[i].appendChild(oImg);
        aElm[i].setAttribute('class','hovex-imageview');
        aElm[i].onmouseover = function() {
            oImg.setAttribute('src', this.href);
        }
    }
}


text:
Q: Are there any Design Guidelines for Documental Databases? Just wondering if there are any kind of guidelines for when you are designing a document-oriented db and I am talking especially about CouchDb.
I know that being schemaless things can take the shape that we want but, are there any best practices?
Thanks in advance! =D

A: Jan Lehnardt recently wrote up a useful overview of data modeling (I would not quite call it "schema" design as you correctly point out).
http://blog.couchbase.com/document-modeling-rules-thumb

A: I don't know specifically about CouchDB, but there is something over in the MongoDB Docs about Schema Design.


text:
Q: Upload of Image in SAPUI5 without FileUploader Is it possible to upload a file to SAP GW by using the create-method of ODataModel?
I send the Image as a Base64-String to backend. In backend the create-stream method is executed and in parameter is_media_resource the value is filled. Now I call a function module to save the image to a order.
But when I look into the order attachments, I can choose the Image but it shows nothing.
Additional my code:
oModel.create(
    sPath, {
      value: oEvent.detail.base64
    },
    {
      headers: {
        slug: oEvent.detail.filename
      },
      success: function (oData, oResponse) {
        var aPhotolist = oListsModel.getProperty("/photoList");

        aPhotolist.results.push(oData);
        oListsModel.setProperty("/photoList", aPhotolist);
        oCarousel.getBinding("pages").refresh();
        oDialog.close();
        sap.m.MessageToast.show(JSON.parse(oResponse.headers["sap-message"]).message, {
          closeOnBrowserNavigation: false
        });
      },
      error: function (oError) {
        MessageBox.error(JSON.parse(oError.responseText).error.message.value);
        oDialog.close();
      }
    }
);

A: Now I found a solution:
    var sPath = this.getBindingContext().getPath() + "/ToAttachments",
            oListsModel = this.getModel("listsModel"),
            oCarousel = this,
            imgData = JSON.stringify(oEvent.detail.base64);

        oCarousel.setBusy(true);
        this.getBindingContext().getModel().create(
            sPath,
            imgData, {
                headers: {
                    slug: oEvent.detail.filename
                },
                success: function (oData, oResponse) {
                    var aPhotolist = oListsModel.getProperty("/photoList");

                    aPhotolist.results.push(oData);
                    oListsModel.setProperty("/photoList", aPhotolist);
                    oCarousel.getBinding("pages").refresh();
                    oCarousel.setBusy(false);
                    sap.m.MessageToast.show(JSON.parse(oResponse.headers["sap-message"]).message, {
                        closeOnBrowserNavigation: false
                    });
                },
                error: function (oError) {
                    oCarousel.setBusy(false);
                    MessageBox.error(JSON.parse(oError.responseText).error.message.value);
                }
            });

First you have to convert the data of the image to a string.
In backend take the value from parameter is_media_resource and convert it first back from xstring to string.
lf_data = is_media_resource-value.

lo_conv_x2c = cl_abap_conv_in_ce=>create( ).

lo_conv_x2c->convert( EXPORTING input = lf_data

                      IMPORTING data  = base64_string ).

After that, convert the string again into xstring. This is now a xstring, which can be interpreted by SAP
CALL FUNCTION 'SSFC_BASE64_DECODE'
  EXPORTING
    b64data                  = base64_string
  IMPORTING
    bindata                  = lf_data
  EXCEPTIONS
    ssf_krn_error            = 1
    ssf_krn_noop             = 2
    ssf_krn_nomemory         = 3
    ssf_krn_opinv            = 4
    ssf_krn_input_data_error = 5
    ssf_krn_invalid_par      = 6
    ssf_krn_invalid_parlen   = 7
    OTHERS                   = 8.

It seems, SAP has some problem to interpret the base64 string vom Javascript.


text:
Q: Setting custom fields using the PSI - Microsoft Project Server I'm new to Project Server development and was wondering if you can use the PSI to set resource custom field values.
I can't seem to find any information for a beginner at this.
I currently have web references set up for the CustomFields and the Resource web service, but am unsure how to set a custom field for a particular resource.
Any help would be really appreciated!
Thanks!

A: I know your problem. Microsoft has really bad examples on MSDN. Lot of stuff doesn't work or has just been copied from the 2007 manual. I've started yesterday to develop with the Webservice for Project Server 2010.
Here is a simple (maybe not the best) solution for setting custom fields:
Complete source code: http://pastebin.com/tr7CGJsW
Prepare your solution
First I've added a Service Reference to:

http: //servername/instance/_vti_bin/PSI/Project.asmx?wsdl

After that, I've edited the app.config because I had to use special credentials to login into the project server (maybe this is not necessarily for you):
...
  <security mode="TransportCredentialOnly">
    <transport clientCredentialType="Ntlm" proxyCredentialType="Ntlm" realm="" />
    <message clientCredentialType="UserName" algorithmSuite="Default" />
  </security>
    <!--<security mode="None">
        <transport clientCredentialType="None" proxyCredentialType="None"
            realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
    </security>-->
</binding>

The commented code has been created by Visual Studio
Connect and Update
Now we can create a new SoapClient which communicates with the Project Server:
//Creating a new service client object
ProjectSoapClient projectSvc = new ProjectSoapClient();

//Just if you need to authenticate with another account!
projectSvc.ClientCredentials.Windows.ClientCredential = new NetworkCredential("test", "test", "demo");
projectSvc.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation;

Now I have declared two Guids, that we know, what we want to update. The other variables are used later and are comment in the code:
//Guid of my project
Guid myProjectId = new Guid("{610c820f-dc74-476c-b797-1e61a77ed6c6}");

//Guid of the custom field
Guid myCustomFieldId = new Guid("{cd879634-b3ee-44eb-87f7-3063a3523f45}");

//creating a new sessionId and a new jobId
Guid sessionId = Guid.NewGuid(); //the sessionId stays for the whole updating process
Guid jobId = Guid.NewGuid(); //for each job, you give to the server, you need a new one

//indicator if you have to update the project
Boolean updatedata = false;

Then we are ready to load the ProjectDataSet from the server, find the CustomField and updating the data. It's really simple:

*

*loading the ProjectDataSet

*iterate trough the CustomFieldsRow

*checking if the CustomField matches with our Guid

*updating the value

*setting the indicator to update

//loading project data from server
//Every change on this dataset will be updated on the server!
ProjectDataSet project = projectSvc.ReadProject(myProjectId, DataStoreEnum.WorkingStore);

//To find your custom field, you have to search for it in the CustomFieldsRow
foreach (ProjectServerCSVImport.PSS.Project.ProjectDataSet.ProjectCustomFieldsRow row in project.ProjectCustomFields)
{
    //check if the GUID is the same
    if (row.MD_PROP_UID == myCustomFieldId)
    {
        //if yes, write it into the container
        row.NUM_VALUE = 12345;

        //and set the indicater
        updatedata = true;
    }
}

If we changed a value, we have to send the ProjectDataSet to the ProjectServer now. It will update the changed values in the ProjectDataSet. For this, we have to check out our project, update it and check in again:
//update if you have changed anything
if (updatedata)
{
    //check out the project first
    projectSvc.CheckOutProject(myProjectId, sessionId, "custom field update checkout");

    //send the dataset to the server to update the database
    bool validateOnly = false;
    projectSvc.QueueUpdateProject(jobId, sessionId, project, validateOnly);

    //wait 4 seconds just to be sure the job has been done
    System.Threading.Thread.Sleep(4000);

    //create a new jobId to check in the project
    jobId = Guid.NewGuid();

    //CheckIn
    bool force = false;
    string sessionDescription = "updated custom fields";
    projectSvc.QueueCheckInProject(jobId, myProjectId, force, sessionId, sessionDescription);

    //wait again 4 seconds
    System.Threading.Thread.Sleep(4000);

But now we just have updated the database. The server will still show us the "old" value and not the new one. This is because we didn't have published our project yet:
//again a new jobId to publish the project
jobId = Guid.NewGuid();
bool fullPublish = true;
projectSvc.QueuePublish(jobId, myProjectId, fullPublish, null);

//maybe we should wait again ;)
System.Threading.Thread.Sleep(4000);

Finally we're done and our project is updated!
Enhancements
I'm very new to this platform (Project Server 2010), so this code maybe is not the best example. So there are some enhancements, which would made the solution better:

*

*The Sleep function is a very bad workaround, but I couldn't find an example which handles the same thing (like here) with a QueueSystem for 2010?!

*If you don't know the Guid of your project, but the name, you can resolve it by following function:

/// <summary>
/// Returns the GUID for a specified project
/// and sets the guid for this class
/// </summary>
/// <param name="client">soap service client</param>
/// <param name="projectname">name of the project</param>
/// <returns>Project GUID</returns>
public Guid GetGuidByProjectName(ProjectSoapClient client, string projectname)
{
    Guid pguid = new Guid();
    ProjectDataSet data = client.ReadProjectList();

    foreach (DataRow row in data.Tables[0].Rows)
    {
        if (row[1].ToString() == projectname) //compare - case sensitive!
        {
            pguid = new Guid(row[0].ToString());
        }
    }

    return pguid;
}


text:
Q: Append div class contain spesific class using javascript I Have one problem , I have one div with dynamic class, but i want to append in that div,which contain class name "detail-news"
Example div :

</div

class name music can dynamically change, but "detail-news" still there. I try with javascript , but i dont know how to append all div class contain class name "detail-news"
Here my javascript :
function appenddiv() {
var div = document.createElement('div');
div.className = 'append_test';
document.getElementById('music-detail-news').appendChild(div);
}

how to append all div class contain class name "detail-news" , not only "music-detail-news" ?

A: You can use querySelectorAll with attribute class ending with the substring detail-news and then forEach over the returned NodeList to append your div element.
Check out the 2. Selectors Overview

E[foo$="bar"]
an E element whose foo attribute value ends exactly with the string bar

var detailsNews = document.querySelectorAll('div[class$="detail-news"]');

detailsNews.forEach(function(item) {
  var div = document.createElement('div');
  div.className = 'append_test';
  div.textContent = "appended div to " + item.classList;
  item.appendChild(div);
})

A: You can use querySelectorAll('div[class*=detail-news')

Selects every "div" element whose class attribute value contains the
  substring "detail-news"

Demo: https://jsfiddle.net/yzw11ok1/1/
function appenddiv() {
  var elements = document.querySelectorAll('div[class*="detail-news"');
  for(var k in elements){
  var div = document.createElement('div');
  div.className = 'append_test';
  elements[k].appendChild(div);
  }
}

A: Instead of using IDs, you indeed have to use class. An ID is unique, but a class is not, so when you get elements by their classname you get more than one element. They can also have more than one class. In this example, the second div will have two classes music-detail-news and detail-news.
Assuming that you have multiple divs with this class

 </div

 </div

You could get all of them using document.getElementsByClassName.
var elements = document.getElementsByClassName("detail-news");

Now you can apply the div to each element in the array
var div = document.createElement("div");
for(var i = 0; i < elements.length; i++){
  elements[i].appendChild(div);
 }

Or if you'd want to append to only the divs with class music-detail-news, you'd write:
var elements = document.getElementsByClassName("music-detail-news");
for(var i = 0; i < elements.length; i++){
   elements[i].appendChild(div);
}

A: You can select using a partial class.
document.querySelectorAll("[class$=-detail-news]");
Will select any class that ends in "-detail-news"


text:
Q: ASPNET MVC: ow can I make a page located in a given area (as opposed to the root structure) as default? How and where do I configure my application so that, when it launches, the action (thus the page to be displayed) be, not in the root structure, but rather in a given area of my choice?
Let's say, Action = "IndexOfArticles", Controller = "Articles", Area = "News". I want this setting to be the default when I launch the application.
I've worked on the NewsAreaRegistration class and set up the above configuration. now I suspect that, to make it work, I need to do something with Global.asx.cs as well, but I don't know what to do.
EDIT
This is what I mean
routes.MapRoute(
            "Default", // Route name
            "{controller}/{action}/{id}", // URL with parameters
            new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
        );

The above code, for instance, will cause the application to start with Index action located in Home controller to execute. That's not what I want.
Thanks for helping.

A: Considering the nature of the questions you've been asking, I want to recommend a resource that I think you'll REALLY love. Steven Sanderson's book "Pro ASP.NET MVC 2 Framework (second edition)" by apress. Chapter 8 in particular goes into a LOT of detail about routing and areas. The book itself is excellent and thourough; one of the best examples of dev/programming books I've ever read. It is available in Kindle form, and if you order from apress directly you can get it in PDF e-book form. It is of course available in paper form too:
Amazon Link
or
Direct from Apress
The specific thing you might want to understand about areas are that they are based on namespaces. When you create an area, the namespace of that area is how MVC locates them and decides what is "in" and area and what isn't. Generally this means that routing to areas is done via the URLs that have the area's name as the first folder in the URL, but this maps to the controller's namespace, not necessarily the physical folder names (though they should match if you want to preserve your sanity).
The route in Manaf's example is working "by accident" more than by intent, which is probably why you aren't quite getting what it does. There is a quirk with ambiguous controller names in the "root area" (that is, the controller's folder that isn't in an area). For a route leads to the root area, but it can't find a controller there, it will scan all areas looking for a match. In this case it finds a match in your news namespace, and works. But this scanning only works if there is only one controller that matches. So if you were to create another controller in another area with the same name, it will fail with a "multiple types found" kind of exception.
You have two good ways to make this work more reliably. Either by prioritizing the news area in the routes, or by redirection:
Redirection:
Instead of routing root requests to a controller in a specific area, you can redirect the Browser to the URL of the area you want them to start on. So they start at "yoursite.com/" and will be redirected to the "yoursite.com/news/articles" URL. To do this, you create a root level controller and use the default route. So, create HomeController in the root controllers folder (not in an area). On that controller create an action method called Index. And in that Index method, redirect them to the controller you really want them to start on.
In global.asax, you can rely on a pretty standard default route like this:
routes.MapRoute(
     "Default",
     "{controller}/{action}/{id}",
     new { controller = "Home", action = "Index", id = UrlParameters.Optional }
);

In your Index action on the Home controller, just redirect the client to the correct controller in the news area using RedirectToAction and specifying the area:
return RedirectToAction("IndexOfArticles", "Articles", new { area = "News" });

The second technique is to prioritize the route so it knows which area to use. This doesn't require any root level controllers. Just add a route entry that looks a little like this:
routes.MapRoute(
    "Default",
    "{controller}/{acion}/{id}",
    new {controller = "Articles", action = "IndexOfArticles", id = UrlParameters.Optional},
    new[] {"YourApplication.News"}
);

The drawback to this is that the 4th parameter (namespaces) is going to apply to all requests, so it may cause more to be redirected to your specific news area than you wanted. It might be better to be more specific about the second parameter so this route doesn't catch other requests... perhaps set the second parameter to an empty string so it only catches a site root request.

A: Custom Routes to your Areas should be registered in your AreaRegistration class Not in Global.asx.cs
to add the route modify your NewsAreaRegistration and add the new default route to your server after the area route. (the order is important here !)
Default routes should always be in the bottom of the routing table so that more specific routes can be matched.
Your routes in the RegisterArea method should look something like this :
        context.MapRoute(
            "News_default",
            "News/{controller}/{action}/{id}",
            new { action = "Index", id = UrlParameter.Optional }
        );

        context.MapRoute(
            "DefaultStart",
            "",
            new { controller = "Articles", action = "IndexOfArticles"}
        );

Update : Forgot to mention that you need to make sure you registered your areas in the Application_Start method in the Global.asx.cs file.
AreaRegistration.RegisterAllAreas();

Update 2: How Routing Works In ASP.NET MVC
I understand your concern. Let me explain briefly how routing works.
In ASP.NET MVc there's one routing table that is used to match all url requests.
When you register a route in the Global.asx.cs or in AreaRegistration those routes are added to the routing table by the order they were registered by (that's why the orders is important and we should push our more specific routes to the top so they can get matched).
When it comes to Areas routes (those that are registered in the AreaRegistration class). Those are always added to he top of the routing table before any of the routes registered in the Global.asx.cs file ( Areas routs are the first ones to be matched) which make since because otherwise you will miss match an Area called News for a Controller named News.
If you have more than one area, which Area's routes get checked first ? I'm not 100% sure,  but by experiment i found out that they are ordered by the creation time, old areas comes first at the top of the routing table. ( it doesn't really matter because you won't have 2 areas with the same name)
Examples:
Suppose you have created the following areas. News, Dashboard, Api
and added the following route to your NewsAreaRegistration to match the root route as in your example above
context.MapRoute(
        "DefaultStart",
        "",
        new { controller = "Articles", action = "IndexOfArticles"}
    );

Your routing table will look something like this:
No   Route Name                        URL                               Explanation
1   News_default         News/{controller}/{action}/{id}          Default For News Area
2   DefaultStart         (empty)                                  Root Route (match root url)
3   Dashboard_default    Dashboard/{controller}/{action}/{id}     Default For Dashboard Area
4   Api_default          Api/{controller}/{action}/{id}           Default For Api Area
5   Default              {controller}/{action}/{id}               Default (No Areas)

Now when you application receives a request. It will go through the routes one by one and look for a match. In our case when your request the root url. The second route will be matched. and because we set the default values for controller = "Articles" and  action ="IndexOfArticles" the request will be redirected accordingly.
Hope that was helpful.


text:
Q: Kong Enterprise on Postgres Master/Slave architecture I'm installing Kong Enterprise API Management (1.5) and am utilising the Postgress database option.  My setup is that I have 2 RedHat servers on premise.

*

*Both have the Docker environment installed.

*Both have Kong Enterprise, and initially, both instances of Kong talk to their respective, local container.

Nominating one node as the Master, (and the other as the Slave), I successfully setup postgres replication so that changes made to the master database tables are replicated to the slave postgres database (I've proven this works).
I now want to re-run the Kong container on my second node and this time, nominate for the KONG_PG_HOST environment variable (in my docker-compose file) to reference the 1st node.  The intention being that, irrespective of which Kong Node is processing the request, the live master database is only, on the nominated master.
Starting a shell script into the Kong container, I can ping the first node ok.
Still - if I specifically go to :8002/overview it seems that Kong has no route to any database content, as the landing pages of the admin portal says no workspaces exists and 'vitals are disabled'.
Pointing browser at 8002/overview works fine.
What else do I need to make sure exists, for a Kong container one node to to use the postgres database on node 2 ?  Postgres port 5432 is open on node 1 as I can connect remotely to is and postgres replication between both nodes works..
What have I missed ?
thanks -


text:
Q: Using the MongoDB Ruby driver in Rails? (without an object mapper) I have recently been getting my feet wet in MongoDB using Mongoid w/ Rails 3, but I'm now interested in learning the low level MongoDB features using only the Ruby driver, and trying some map/reduce that would not be possible through Mongoid (afaik)
I'm not entirely sure where in Rails I should be setting up the db connections etc, and any pointers would be much appreciated!

A: check out the docs over at mongodb
http://www.mongodb.org/display/DOCS/Rails+-+Getting+Started
I have no personal experience with mongo (hopefully soon), i've only watched some online presentations so far, looks really cool!
EDIT: this one looks like its specific to the ruby driver
http://www.mongodb.org/display/DOCS/Ruby+Tutorial
some other resources I have been checking out over the last month you might find useful?

*

*http://www.10gen.com/event_mongosf_10apr30 (a bunch of really good presentations on mongodb; many using ruby)

*http://vimeo.com/11323139 (Schema Design with MongoDB) this one takes a few minutes to get going and the sound and video quality are not the best, but has good info

*if I recall most map/reduce can be handled via javascript functions that get passed to the mongodb server, see below screen shot taken from the vimeo screen cast


text:
Q: Yahoo auction placebid api url I am working in auction website using yahoo japan auction API. I have a search and product details page API URL. But I don't know how to bid yahoo action using the API.
This link does not guide how to bid yahoo auctions using the API. I have spent much more time for searching this flow but of not use.
I am trying this code
<form action="http://bid11.auctions.yahoo.co.jp/jp/config/placebid" method="post" onsubmit="disabledSubmit(this)">
   <input type="hidden" name="Partial" value="0">
   <input type="hidden" name="ItemID" value="n121912467">
   <input type="hidden" name="login" value="suresh_3971">
   <input type="hidden" name="cc" value="jp">
   <input type="hidden" name="Quantity" value="1">
   <input type="hidden" name="Bid" value="15,500">
   <input type="hidden" name="bidType" value="">
   <input type="hidden" name="a" value="dj0zaiZpPU9jRE5IdWYyQVFOaCZkPVlXazlaVlp6UmxGTE5XRW1jR285TUEtLSZzPWNvbnN1bWVyc2VjcmV0Jng9M2M-">
   <input type="hidden" name="u" value="">
   <input type="submit" value="submit">
</form>

how to bid yahoo auctions using the API?