Posts

Showing posts from March, 2011

c++ - Ambiguous pointer; <SiHCollection> is ambiguous -

below i've posted code meant store hits collections in hce (hit collection of events). code compiles on running program, following error printed terminal 7 times: < sihcollection> ambiguous. i have feeling because using namespace std although don't know how amend code. thoughts? #include "sisd.h" #include "sihit.h" #include "g4hcofthisevent.hh" #include "g4step.hh" #include "g4threevector.hh" #include "g4sdmanager.hh" #include "g4ios.hh" #include "g4unitstable.hh" #include <fstream> #include <iostream> #include <sstream> using namespace std; extern ofstream outfile; sisd::sisd(g4string name) :g4vsensitivedetector(name) { collectionname.insert("sihcollection"); ...

function - Generating Radio propagation pattern in matlab? -

Image
i want implement part of article. following explanations expressed in it. "we evaluate performance of proposed localization method @ varying degree of irregularity, doi defines radio propagation irregularity per unit degree change in direction. radio propagation irregularity model used in paper shown follows:" i have tried write code of part doesn't work , can't result. function coeff=k(i) rand=rand(1,100); doi=0.02; if(i==0) coeff=1; %terminating condition else while i<360 coeff=k(i-1)+rand*doi; %doi=[0.01,0.02,0.03,0.04,0.05] end end end and following figure has been shown in article doi=0.02...i need output this, how can it thanks in advance. it if post link article, in case generate circular path noise. doi=0.05; phi = linspace(0,2*pi,360); %360 angles r=-doi+2*doi*rand([1,360]); %random values between -doi , doi r=cumsum(r)+1; %add them make path, mean value 1 while abs(r(end)-r(1))> doi %start , ...

mysql - SQL Find All user that have two history in a certain order -

i'm looking sql request can't find in internet (and didn't found solution myself). i have 2 different table user , history , table user_history link 2 tables. for example : user id name 1 john 2 edie 3 france 4 gabriel 5 ellen history id date_entered type 1 2017-07-01 36 2 2017-07-02 52 3 2017-07-03 25 4 2017-07-04 69 5 2017-07-05 85 6 2017-07-06 74 7 2017-07-07 45 8 2017-07-08 85 9 2017-07-09 25 10 2017-07-10 78 user_history id id_user id_history 1 1 1 2 1 2 3 1 3 4 1 4 5 2 5 6 2 6 7 1 7 8 1 8 9 2 9 10 1 10 in example, history made user 1 , 2 (user 2 have history 5,6 , 9). so question : what sql request me users have in history history type 25 , days later history type 85 ? in example, user 1 (john) ok because has history type 25 on 2017-07-03 , history type 85 on 2017-07-08. user 2 (edie) not ok because if has ...

bit manipulation - Java simple bitwise operation -

we given integer n, value v (v=0 or 1) , position p. write sequence of operators modifies n hold value v @ position p binary representation of n. example: n = 5 (00000101), p=3, v=1 -> 13 (00001101) n = 5 (00000101), p=2, v=0 -> 1 (00000001) this code: int n1 = 35; int p1 = 3; int v = 1; n1 = n1 + (v << p1); system.out.println(n1); it works when v=1 when v=0 doesn't. since want "set" index value, need 1 of 2 operations 'and' set 0 values @ index 0, won't work 1 values 'or' set 1 values @ index 1, won't work 0 values now need put right number @ right index. can done shifting 1. '<<' moves 1 number of places for example '1 << 3' shifts 1 3 places, resulting in '00001000' remember, need 0 of operations, 0 in place, need invert bits 'not' or '~' flips bits in number ~00001000 yeilds 11110111 now can have 1 or 0 in index wish, , need use if stateme...

excel - how can i bring information from one sheet to my userform and transfer it to another sheet? -

i'm new coding vba, got information online , book. im trying ask user part# after userfrom bring information in sheet 2 information testbox2 , testbox3. user input quantity , date entered , due date initialize. once user form complete user click next part , boxes clear , inserted data worksheet. problem cant not working , dont know did wrong. in bottom added code can please me. enter image description here private sub commandbutton1_click() dim emptyrow long 'make sheet1 active sheet1.activate 'determine emptyrow emptyrow = worksheetfunction.counta(range("a:a")) + 1 dim ws worksheet dim lastrow long, lrow long, trow long dim tempvalue string dim targetsheet string dim templist(1 4) string dim long dim match boolean match = false 'set targetsheet , clear previous contents targetsheet = "sheet1" trow = 15 lastrow = sheets(sheet2).range("a3" & rows.count).end(xlup).row 'set array of strings, based on index mat...

vb.net - Search button not responding -

i created search button query ms access database , display results whenever type in id , click search button nothing. everything else working, copies data vb form , stores in ms access database search button not query database , retrieve data. below code search button: private sub button1_click(byval sender system.object, byval e system.eventargs) handles btnsearch.click dim found boolean try cm = new oledb.oledbcommand cm .connection = cn .commandtype = commandtype.text .commandtext = "select* tblinfo (id = @id & txtfind.text = @id)" dr = .executereader end while dr.read() found = true txtfirst1.text = dr("pfirst").tostring txtmid1.text = dr("pmiddle").tostring txtlast1.text = dr("plast").tostring txtadd1.text = dr("paddress").tostring txtphone1.text = dr("pp...

javascript - GET PHP variable value from HTML data-id -

Image
i asked a question earlier today in nutshell asks when user clicks button on page -- pop modal comes up, should php variable value. since there no or post request when popup modal btn clicked means can not variable value using above 2 options tried following: `<a id="myid" data-id="<?php echo $userid ?>">link</a> <script> $('#myid').data("id"); </script>` now have php $userid value in javascript variable. leads me question efficient way retrieve $userid variable , insert php variable. additional info i found question on not applicable me. example image of im trying achieve loop generated php list $teacherclass = new teachersearch(); $teachers = $teacherclass->showallteachers(); if (is_array($teachers)) { foreach ($teachers $teacher) { $src = $teacher['userid']; <div class="teacher-info"> ...

html - AngularJS- how to hide elements using ng-hide? -

Image
i have app has been written in angularjs, , trying add functionality hide headings of widgets displayed on 1 of web pages when user selects checkbox indicate should hidden. at moment, have page displays number of widgets- on 'heading' of each widget, there 'settings' button. when user clicks settings button, dialog box opens on top of current page (i.e. user not navigate page- url not change @ all). dialog box contains form number of input fields- 1 of checkbox want use 'hide' headings of of widgets on webpage. i have been following example at: https://docs.angularjs.org/api/ng/directive/nghide try , this, can't quite seem working... i have added ng-hide attribute html element, in example: <div data-ng-if="widget.name === 'tag-box'" ng-hide="hidewidgetheading"> <!-- class="ng-hide"--> <div class="divider"></div> ... <div class="divider"></div...

c++ - how to get enum value from enum type? -

the question in title may sound trivial, better explain code want do... in c++11 can this: #include <iostream> namespace x { enum class foo { a,b }; } template <typename t> void foo(t t) { if (t == t::a) { std::cout << "a"; } } int main() { foo(x::foo::a); } the important point here template foo not need know in namespace enum declared. call foo(y::foo::b) (provided there enum class called foo in namespace y having members a , b ). now question is: how same plain old enums (and c++98 stuff)? this works: #include <iostream> namespace x { enum foo { a,b }; } template <typename t> void foo(t t) { if (t == x::a) { std::cout << "a"; } } int main() { foo(x::a); } but because foo knows in namespace enum declared. , wont work y::foo::b ! (in c++11 works if replace line if (t == t::a) ... , plain enum ) is there way working in c++98/03 without refering x in template explicitly? ...

Rails render wrong format type -

i have problem rails respond_with , renders json instead of html when access through browser. problem occurs not, when load time high. here's specification in controller, use respond_to :html, :json in last statement of action, use respond_with(@object) i use same endpoint (i.e /reports, not /reports nor /reports.json) both browser (html) , mobile (json), json request done attaching http header accept: application/json . works on json request, html request render json instead of html ruby v2.3.1 , rails v4.2.6 only happens on production nginx server, never happens on development production server: unicorn v5.1.0 i use own responder json key instead of formatted error message when record isn't valid, in applicationcontroller put self.responder = apiresponder this code of apiresponder: class apiresponder < actioncontroller::responder def json_resource_errors i18n.locale = "json" resource.valid? # refreshes locale in error messages transl...

activerecord - Rails updating column rows for has_one relationship -

i have added iconfolio character model. each character has_one :iconfolio . character.rb has_one :iconfolio, dependent: :destroy accepts_nested_attributes_for :iconfolio before_validation self.create_iconfolio unless iconfolio end here migration file: class createiconfolios < activerecord::migration def change create_table :iconfolios |t| t.integer :character_id t.string :icon_url t.timestamps null: false end add_index :iconfolios, :character_id end end the iconfolio class: iconfolio.rb class iconfolio < activerecord::base belongs_to :character validates :character_id, presence: true before_create self.icon_url = '/assets/icon1.png' end end firstly, how ensure iconfolio has been created each character ? secondly, how update rows in character_id column? character_id value different every iconfolio record. updating icon_url column can done in console: iconfolio.all.update_all(person_normal_i...

data structures - Efficiently implementing search algorithm for a list of strings which can be similar -

i dont know how put this. give 1 example. having list of strings, {"abc-1","abc-2","abc-3",abc-4", "xyz-98","xyz-76","xyz-34","xyz-87" "foo-1a","foo-1b","foo-1c"} hope got picture of problem. algorithm best kind of scenario can have similar strings of large number. or may how can optimize existing algorithm achieve best performance? optimize what? speed or size. if list small enough , looking exact matches map ( hashmap / hashtable ) work take amount of space. use trie (prefix tree) space on space , allow prefix matching slower map.

java ee - Parsing incoming SOAP Request in JAX-RS application -

i using java library available @ https://github.com/officedev/ews-java-api interface several exchange servers in jax-rs application. library includes functionality subscribing push notifications on particular folder, requires listener implemented user. the incoming request push notification consists of soap envelope. have route set request lands, use guidance on when arrives. since i'm not directly consuming soap api, don't have jax-ws class representations of data structures. there way can write class in similar way represent request , allow easy access information within? if not, best practice add dependency on jax-ws, or should parse xml directly?

Scala: Find max sum of consecutive negative numbers in a List of Double -

i have list[double] following values: {-1.2200000000000006, -1.3200000000000003, -1.0099999999999998, 22.22, 11.11, -31.310000000000002, -0.9799999999999986,-4, -5, 3, 2, 2.959999999999999}` i find max sum of consecutive negative numbers. so original list separate consecutive lists of negative , positive { {-1.2200000000000006, -1.3200000000000003, -1.0099999999999998}, {22.22, 11.11}, {-31.310000000000002, -0.9799999999999986,-4, -5}, {3, 2, 2.959999999999999} } then remove positive consecutive numbers { {-1.2200000000000006, -1.3200000000000003, -1.0099999999999998}, {-31.310000000000002, -0.9799999999999986,-4, -5} } then sum {-3.5500000000000007, -41.29} then change absolute values {3.5500000000000007, 41.29} then find max = 41.29 if really mean sum consecutive negative numbers, , find maximum sum, it. val nums = list(-1.2200000000000006, -1.3200000000000003, -1.0099999999999998, 22.22, 11.11, -31.310000000000002, -0.9...

I can't import all the rows of my csv file in R with read.csv in R -

i have large dataset in csv file. when opening in data visualization software (spotfire) can see has more 7 millions rows. however, working rstudio, , when try open file read.csv2, being cautious of quotes or other options affect dataset, end 4 million file. here code when import file my_data <- { as.data.frame(read.csv2(file, sep = ";", header = true, na.strings=c(""," ","na"), quote = "", check.names=false, stringsasfactors=false)) } moreover, when take @ data in rstudio view(my_data) can see lines correct is related size limit of files in rstudio or ?

java - private messages spring websocket -

i learning spring websocket , stuck on how can send messages specific users using @destinationvariable("username") here code configuration @configuration @enablewebsocketmessagebroker public class websocketcontextconfig extends abstractsessionwebsocketmessagebrokerconfigurer<expiringsession> { @override protected void configurestompendpoints(stompendpointregistry registry) { registry.addendpoint("/ws-cfg").withsockjs(); } @override public void configuremessagebroker(messagebrokerregistry registry) { registry.enablestompbrokerrelay("/queue/","/topic","/exchange/") .setrelayhost("localhost"); registry.setapplicationdestinationprefixes("/app"); } } controller @messagemapping("/chat.private.{username}") public void filterprivatemessage(@payload message message, @destinationvariable("username") string username, prin...

ruby on rails - How to set i18n-tasks not to get false positive unused keys? -

i have various methods across app overwrite t() : def t(key) i18n.t("foo.bar.#{key}") end def t(*args) i18n.t(*args) end def t(string, options = {}) if string[0] == '.' i18n.t string, options.merge(scope: some_scope) else i18n.t string, options end end when run i18n-tasks unused , finds lot of keys used through 1 of these methods. is possible config i18n find unused keys only? aware of magic comments, patternmapper , custom scanners, understanding have implement separately each key, makes tedious (the number hits on 700). please help, getting desperate here :(

node.js - create-react-native npm start hangs -

after successful create-react-native tried initialize project npm start. after 2 hours doesn't finish loading. basic example has finished couple of time after waiting, when added code more advanced never finishes. use npm 4.2.0 , node 7.10.0. not able find out npm start does. has download lot? if so, might know why never finishes, because i'm in remote place in india crappy internet. sudo npm start --verbose npm info worked if ends ok npm verb cli [ '/usr/local/bin/node', npm verb cli '/usr/local/bin/npm', npm verb cli 'start', npm verb cli '--verbose' ] npm info using npm@4.2.0 npm info using node@v7.10.0 npm verb run-script [ 'prestart', 'start', 'poststart' ] npm info lifecycle cameratest@0.1.0~prestart: cameratest@0.1.0 npm info lifecycle cameratest@0.1.0~start: cameratest@0.1.0 > cameratest@0.1.0 start /home/piepongwong/programming/reactnativeex/cameratest > react-native-scripts start 9:35:47 pm: s...

Check if multiple elements exist in one if statement in jQuery -

hello using waypoints.js , breaks when not on page targeting. to fix have check if element exists on page before running waypoints function this: if (jquery(".section-2-box").length) { //my code } if (jquery(".section-3-box").length) { //my code } if (jquery(".section-4-box").length) { //my code } it works, problem have many elements need check. dont want have write out 20 if statements. is possible 1 if statement type of logic if of these elements exist run code ? if know there 1 element each of classes, standard group selector can it: if (jquery(".section-2-box, .section-3-box, .section-4-box").length === 3) if not (there might 2 section-2-box s , no section-3-box ), have throw jquery-specific :first s in there: if (jquery(".section-2-box:first, .section-3-box:first, .section-4-box:first").length === 3) example: if (jquery(".section-2-box:first,...

python - No scalar data in tensorboard -

i have been reading tensorboard documentation scalars , have problem presenting in tensorboard. i have pip install tensorflow in windows 10 my code looks this: import tensorflow tf = tf.constant(7, name='test_variable') tf.summary.scalar('variable', a) tf.session() sess: tf.summary.filewriter('my_folder', graph=sess.graph) x = tf.global_variables_initializer() sess.run(x) i see there file in my_folder in command prompt: tensorboard --logdir=my_folder --port 6006 out: c:\users\mm>tensorboard --logdir=my_folder --port 6006 starting tensorboard b'54' @ http://desktop-9s2d9vf:6006 (press ctrl+c quit) when open browser get: no scalar data found. probable causes: etc. etc. you need run summary_op , pass result filewriter . example: import tensorflow tf = tf.constant(7, name='test_variable') tf.summary.scalar('variable', a) summary_op = tf.summary.merge_all() tf.session() sess: summary_wr...

sql - efficently get nearest id based on counting a column in one-to-many table -

i have relational table (one-to-many) , need efficiently similarities between ids giving associated items. table this: id item 1 a2231 1 a2134 2 a2134 2 b2313 ... what need how many rows common between ids: a_id b_id count_items 1 2 1 1 3 0 2 1 1 ... i have made query, o(n2), , doesn't work because spool space. select a.id a_id, b.id b_id, count(b.item) count_items tab left join tab b --same table on (a.item = b.item) group a.id, b.id edit: n_rows ~ 50mm n_items ~ 100k n_ids ~ 170k combinations id/item unique it'a there way efficiently accomplish this? in advance! i start using inner join: select a.id, b.id, count(*) count_items tab left join tab b --same table on a.item = b.item group a.id, b.id; next, if table has duplicates, might work: with t ( select distinct id, item tab ) select a.id, b.id, count(*) t join t b on a.item = b.item group a.id, b.id; and ...

python - Keras Backend Modeling Issue -

i having issue declaring model. inputs x_input , y_input, , outputs predictions. follows: model = model(inputs = [x_input, y_input], outputs = predictions ) my inputs (x,y) both embedded, matmult together. follows: # build x branch x_input = input(shape = (maxlen_x,), dtype = 'int32' ) x_embed = embedding( maxvocab_x + 1, 16, input_length = maxlen_x ) xe = x_embed(x_input) # result: tensor("embedding_1/gather:0", shape=(?, 31, 16), dtype=float32) # 31 happens maxlen_x similarly y branch... # build y branch y_input = input(shape = (maxlen_y,), dtype = 'int32' ) y_embed = embedding( maxvocab_y + 1, 16, input_length = maxlen_y ) ye = y_embed(y_input) # result: tensor("embedding_1/gather:0", shape=(?, 13, 16), dtype=float32) # 13 happens maxlen_y i batch dot between two. (simply dotting data each instance) from keras import backend k dot_merged = k.batch_dot(xe, ye, axes=[2...

java - How to auto fix checkstyle warnings of FinalLocalVariable and FinalParameters by Intellij -

Image
code style has rules: finallocalvariable finalparameters it give warning like: parameter xxx should final. some people don't add final while writing code. in case team has practice add that. how can easier add them up? find in setting -> editor -> inspections. search keyword "final". in "code style issues", check "local variable or parameter can final" , make sure "report local variables" , "report method parameters" checked. then run analyze -> inspect code. make sure select profile created in "inspection profile". then can auto fix them in "inspection results" panel.

android - No value passed for parameter item -

hello have code : override fun oncreateoptionsmenu(menu: menu): boolean { menuinflater.inflate(r.menu.menu_search, menu) val searchitem = menu.finditem(r.id.action_search) val searchview = menuitemcompat.getactionview() searchview //*** setonquerytextfocuschangelistener *** searchview.setonquerytextfocuschangelistener(object : view.onfocuschangelistener { override fun onfocuschange(v: view, hasfocus: boolean) { } }) searchview.setonquerytextlistener(object : searchview.onquerytextlistener { override fun onquerytextsubmit(query: string): boolean { return false } override fun onquerytextchange(searchquery: string): boolean { adapter!!.filter(searchquery.trim { <= ' ' }) tvlistanimal.invalidate() return true } }) return true } and found bug in line : ...

java - Creating new users with Spring Data LdapRepository fails with LDAP error code 32 -

i attempting use spring data , ldaprepository api read, update , create user data in ldap. have been able read , update successfully, whenever attempt insert new record error: 2017-07-25 17:31:01.966 error 14404 --- [nio-8080-exec-1] o.a.c.c.c.[.[.[/].[dispatcherservlet] : servlet.service() servlet [dispatcherservlet] in context path [] threw exception [request processing failed; nested exception org.springframework.ldap.namenotfoundexception: [ldap: error code 32 - search base entry 'uid=testy1@testy.org,ou=people,ou=myou,dc=bar,dc=foo' not exist]; nested exception javax.naming.namenotfoundexception: [ldap: error code 32 - search base entry 'uid=testy1@testy.org,ou=people,ou=myou,dc=bar,dc=foo' not exist]; remaining name 'uid=testy1@testy.org'] root cause javax.naming.namenotfoundexception: [ldap: error code 32 - search base entry 'uid=testy1@testy.org,ou=people,ou=myou,dc=bar,dc=foo' not exist] my application.properties is: user-api....

smartsheet api - All Cell properties null except ColumnId C# SDK -

when retrieving sheet via c# sdk cell values null. there access level api or c# sdk have bug? can column names , id's fine. smartsheetclient ss = new smartsheetbuilder().setaccesstoken(mytoken).build(); long sheet_id = 0000000000000000; sheet ssheet = ss.sheetresources.getsheet(sheet_id, null, null, null, null, null, null, null); lblfeedback.text = "sheet: " + ssheet.name + " <br>rows: " + ssheet.rows.count.tostring(); that works fine, know i'm accessing sheet want, example column map https://github.com/smartsheet-samples/csharp-read-write-sheet/blob/master/csharp-read-write-sheet/program.cs however... cell completedcell = getcellbycolumnname(r, "completed", columnmap); string cellvalue = completedcell.displayvalue; cellvalue null. cell property, except columnid comes null. doing wrong? what value in cell? suggestions: in debugger, take @ row object , cells. use tool postman make call , examine results

caching - How to cache a multipart POST request with NGINX reverse proxy -

we have nginx reverse proxy in front of our web server, , need cache responses based on request body (for detailed explanation of why see this other question ). the problem have though post data same, multipart boundary different every time (the boundaries created web browser). here's simplified example of request looks (notice browser-generated webkitformboundaryv2blneaih1rggo0w ): post http://my-server/some-path http/1.1 content-length: 383 accept: application/json content-type: multipart/form-data; boundary=---- webkitformboundaryv2blneaih1rggo0w ------webkitformboundaryv2blneaih1rggo0w content-disposition: form-data; name="some-key"; filename="some-pseudo-file.json" content-type: application/json { "values": ["value1", "value2", "value3"] } ------webkitformboundaryv2blneaih1rggo0w-- if it's useful someone, here's simplified example of nginx config use proxy_cache_path /path/to/nginx/cache levels...

python - invalid syntax when trying to open jupyter notebook -

when type in command jupyter notebook in terminal,i getting error. working fine , seems pop up decentmakeover@decentmakeover:~$ jupyter notebook traceback (most recent call last): file "/home/decentmakeover/anaconda3/bin/jupyter-notebook", line 4, in <module> import notebook.notebookapp file "/home/decentmakeover/anaconda3/lib/python3.6/site- packages/notebook/notebookapp.py", line 74, in <module> .services.kernels.kernelmanager import mappingkernelmanager file "/home/decentmakeover/anaconda3/lib/python3.6/site- packages/notebook/services/kernels/kernelmanager.py", line 16, in < module> jupyter_client.multikernelmanager import multikernelmanager file "/home/decentmakeover/anaconda3/lib/python3.6/site- packages/jupyter_client/__init__.py", line 7, in <module> .manager import kernelmanager, run_kernel file "/home/decentmakeover/anaconda3/lib/python3.6/site- packages/jupyter_client/manag...

node.js - How to include space and new line in regular expression? -

i have html file contains below code snippet. <div class="col-sm-2 col-sm-offset-1"> <div class="countbox success" id="success"> <h2>467</h2> passed tests <span class="glyphicon glyphicon-eye-open"></span> </div> </div> i have regular expression (.*)</h2>\r\npassed value 467. worked till yesterday. but, not working now. have tried replacing single slash double slash new line , row. used "\s+" cover whitespace. failed in error. please guide me on how value 467 using regular expression above code snippet? it better catch <h2>(\d+)</h2> ensure h2 header number inside. way, \r\n 1 convention (in windows) represent end of line, in unix \n more platform independent, can \r?\n (marking \r optional) , have on whitespace in front of passed. , (but not best) regexp be: <h2>(\d+)...

javascript - removing duplicate objects in an array, keeping ones with maximum property value -

i have array this: const array=[ {id:0, quantity:1}, {id:1, quantity:2}, {id:0, quantity:4} ] my goal this: const array=[ {id:1, quantity:2}, {id:0, quantity:4} ] the order of object not matter long can find 'id' larger quantity i tried filter + findindex, map +filter, etc kept making mistake. need help. you use hash table , check if object same id in result set. if actual quantity greater, assign actual object. var array = [{ id: 0, quantity: 1 }, { id: 1, quantity: 2 }, { id: 0, quantity: 4 }], hash = object.create(null), unique = array.reduce(function (r, o) { if (!(o.id in hash)) { hash[o.id] = r.push(o) - 1; return r; } if (o.quantity > r[hash[o.id]].quantity) { r[hash[o.id]] = o; } return r; }, []); console.log(unique); .as-console-wrapper { max-height: 100% !important; top: 0; }

vba locking / unlocking selection macro -

i want create macro lock / unlock cells based on locked range property, having trouble firing case null section of statement( first 2 work fine) sub lockunlockselection() dim c range dim wb workbook dim ws worksheet 'dim lck string 'dim unlck string set wb = activeworkbook set ws = wb.activesheet 'lck = empty 'unlck = empty set c = selection select case c.locked case false c.locked = true msgbox "selection " & c.address & " locked!", vbinformation, date case true c.locked = false msgbox "selection " & c.address & " unlocked!", vbinformation, date case null ' if mix of locked , unlocked c.locked = true msgbox "mix of locked , unlocked cells!" & vblf & vblf & "cells locked!", vbinformation + vbexclamation, "info.." end select end sub why not firing?? thanks! solution (if interested): sub lockunlockselection() dim c range dim wb workbook dim ws w...

javascript - HTTP_ACCEPT_LANGUAGE differs from navigator.language in Firefox in Linux -

i programming webpages in local apache 2 web server in linux, , use php auto-recognize browser language. in webpage trying console.log() javascript language client has preferred , 2 different outputs: javascript ( console.log(navigator.language); ) returns es-es php ( <?php echo $_server['http_accept_language'] ?> ) returns en-us,en;q=0.5 in about:config , variable intl.accept_languages set es-es, es, en-us, en . note: local language, want achive get, spanish ( es-es ). for reason, firefox seems not configured in linux distro (linux mint 18.1), while have installed ( firefox , firefox-locale-es ). if try chromium in same computer, php output es-es,es;q=0.8;q=0.6 , correct. if try firefox in other computer windows, or firefox android, php output correct: es-es,es;q=0.8;en-us,en;q=0.5 . why php output wrong in firefox linux , how solve it? in advance. edit: these http headers (i crossed out authentication headers) request: get / http/1.1 ho...

android - How to make a view resize/shorten itself when a new view appears on screen? -

i have 2 views on screen, google map fragment , different custom fragment. before custom fragment appears on screen, google map fullscreen good. once new fragment appears @ bottom of screen, want google map resized takes available space not used new fragment. ie. before new fragment |----------------| | | | | | | | | | map | | | | | | | | | | | | | |----------------| after new fragment |----------------| | | | | | | | map | | | | | | | |----------------| <-- map ends here | | | new fragment | | | |----------------| xml file: <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.and...

matlab - fsolve error when solving a quadratic function -

so im trying use fsolve in code below, keep on getting error , have no clue on how fix it, appreciated. reference use (1/2,1,1,1/2,0) input arguments. function [ b_a , a_b ] = secondordersimulation(delta,c1,c2,s0,m2a_current) m1a_current = (-delta -c2*m2a_current)/c1; m1b_current = 0; m2b_current = 0; syms t positive; b_a = []; a_b = []; k = 0:5 if mod(k,2)==0 || k==0 %if k / interval a_n b_n f = c1*(m1a_current + (1+s0)*t) +c2*(m2a_current + m1a_current*t + ((1+s0)*(t)^2)/2) - delta; solve_even = fsolve(f,1); b_a = [b_a solve_even]; m1b_next = m1a_current + (1+s0)*solve_even; m2b_next = (delta - c1*m1b_next)/c2; m1b_current = m1b_next; m2b_current = m2b_next; else %if k odd / interval b_n a_n+1 g = c1*(m1b_current - (1-s0)*t) +c2(m2b_current + m1b_current*t - ((1-s0)*(t)^2)/2) + delta; solve_odd = fsolve(g,1); a_b = [a_b solve_odd] m1a_next = m1b_current - (1-s0)*solve_...

javascript - Change audio file on button click -

i trying change audio file on button click , getting error uncaught typeerror: audio.load not function my code below, idea press button , audio file change. without audio.load() line, code run , src update, audio not change. missing? html: <!doctype html> <html> <body> <br> <audio controls> <source src = "audio_file_1.mp3" id="audio" type="audio/mpeg"> browser not support audio element! </audio> <br> <button onclick="changeaudio();">change</button> </body> <script src="temp.js"></script> </html> javascript: // temp js var = 1; function changeaudio() { var audio = document.getelementbyid('audio'); if (a==1) { audio.src = 'audio_file_1.mp3'; = 2; } else { audio.src = 'audio_file_2.mp3'; = 1; } audio.load(); } changeaudio(); (also, if knows example sound f...

javascript - How can I add 2d collision to the bottom of the obstacles in my game? -

the square ball bounce off top of obstacles goes straight through them if comes bottom. can add collision detection code allow check collisions bottom. in advance. code: <!doctype html> <html> <head> <meta charset="utf-8" /> <title>paddle game</title> <style> * { padding: 0; margin: 0; } canvas { background: #eee; display: block; margin: 0 auto; } </style> </head> <body> <h1>instructions</h1> <p>hit square paddle @ bottom of screen. have 5 lives. if hit square gain 1 point if miss loose 1 life. if lives fall below 0 loose , game restarts. score 10 points win.</p> <canvas id="mycanvas" width="1000" height="800"></canvas> <script> var canvas; //this variable use reference canvas object var ctx; //a variable hold value of context //square ball var rectx = 100;//rect x pos var recty = 200;//...

Bootstrap navBar have unexpected design -

i'm try use bootstrap and give me wrong format nav bar when use code <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- above 3 meta tags *must* come first in head; other head content must come *after* these tags --> <title>bootstrap 101 template</title> <!-- bootstrap --> <link href="css/bootstrap.min.css" rel="stylesheet"> <!-- html5 shim , respond.js ie8 support of html5 elements , media queries --> <!-- warning: respond.js doesn't work if view page via file:// --> <!--[if lt ie 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"> </script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min...