Posts

jquery - JavaScript Calculate total price of items -

please me type total price of selected items. here jsfiddle <section id="items"> <div class="item">monitor <span class="price">100$</span></div> <div class="item">mouse <span class="price">20$</span></div> <div class="item">keyboard <span class="price">60$</span></div> </section> <section id="basket"> <p>total price:<span class="total_price"></span></p> </section>` check demo var total = 0; $("#items").on('click', ".item", function() { $(this).appendto("#basket"); gettotal() }); $("#basket").on('click', ".item", function() { $(this).appendto("#items"); gettotal() }); function gettotal(){ total = 0; ...

javascript - 'Range.detach' error at injecting loopback angular sdk -

i have automatically created services library loopback angular sdk when call angular app keeps in blank page , in javascript console have next error: "'range.detach' no-op, per dom ( http://dom.spec.whatwg.org/#dom-range-detach )." take @ link .it addresses similar error , discusses fix related github page.

aql - Arangodb removing subitems from document -

how 1 remove subitems document. have document called sales each sale has sale.item contains {name,price,code}. i want remove each item not valid, checking code blank or null. trying below fails errors, not sure if need use sub-query , how. for sale in sales item in sale.items filter item.code == "" remove item in sale.items another attempt for sale in sales let invalid = ( item in sale.items filter item.code == "" return item ) remove invalid in sale.items let removed = old return removed the following query rebuild items each document in sales . keep item code not null , not empty string: for doc in sales let newitems = ( item in doc.items filter item.code != null && item.code != '' return item ) update doc { items: newitems } in sales here test data used: db.sales.insert({ items: [ { code: null, what: "delete-me" }, { code: ...

javascript - Pass variable to .txt file -

i trying pass variable html form .php script , .php script .txt file variable value stored. problem is, when test scripts instead of posting variable number posts variable name "numbervariable". html/javascript <form id="payment-form" action="chargecard.php" method="post" name="payment-form"> <input onkeypress="return isnumberkey(event)" type="text" name="amount" id="amount" /> <input type="hidden" id="numbervariable" name="numbervariable" value="numbervariable"/> <!--this try pass variable .php script--> <input type="image" src="button1.png" id="custombutton" value="pay" alt="button"/> </form> <script type="text/javascript"> ...

ruby - How do I make sure that gems get installed in the correct location? -

setup fresh ubuntu 14.04.2 lts install (in hyperv snapshot first reboot) sudo apt-get update official rvm install both single , multi-user rvm install [ruby] 2.1 , 2.2 separately (on fresh installs) gem_home: /home/me/.rvm/gems/ruby-2.2.1 (for 2.2 install) pre gem update gem location example: /home/me/.rvm/rubies/ruby-2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.8.4 post gem update gem location example: /home/me/.rvm/gems/ruby-2.2.1/gems/bundler-1.9.2 after first gem update --system , gem update attempt gem clean always ends errors updated gems' previous versions not installed in gem_home. everything else i've tested rvm/ruby setup functioning (single or multiuser installs).

regex - How to find which group is matched in NSRegularExpression -

i have regex statement multiple capture groups separated | operator. how can find out capture group matched? way can think of -for example- counting number of characters if matched. var string = "1234567897" var pattern = "(^\\d{9}$)|(^\\d{10}$)|(^\\d{13}$)|(^[a-za-z]{2}\\d{9}[a-za-z]{2}$)" var myregex = nsregularexpression(pattern: pattern, options: nil, error: nil)! if let mymatch = myregex.firstmatchinstring(string, options: nil, range: nsrange(location: 0, length: string.utf16count)) { println((string nsstring).substringwithrange(mymatch.rangeatindex(0))) } i wrote code worked example. sure can written better way works now. swift 2.3 var string = "123456789" var pattern = "(^\\d{9}$)|(^\\d{10}$)|(^\\d{13}$)|(^[a-za-z]{2}\\d{9}[ww]{2}$)" var myregex = try! nsregularexpression(pattern: pattern, options: []) if let mymatch = myregex.firstmatchinstring(string, options: nsmatchingoptions.init(rawvalue: 0), range...

jsf - All tabs of tabpanel refreshed, when event happens in any one of the tab (Richface 3.3.4) -

we have tabpanel has multiple tabs. when event performed in of tabs (e.g. click 'ajaxsubmit' button in tab1) tabs refreshed causing performance issues (e.g. getter of 'table' value invoked tab3). we tried wrap content of each tab in <a4j:region> , getters of components in tab3 still invoked. please find sample code snippet below: <r:tabpanel id="tabworkingpanel" styleclass="ottmcontainer" selectedtab="#{tabhandlerbean.activetab}"> <rich:tab id="tab1"> <h:commandbutton value="ajaxsubmit"/> </rich:tab> <rich:tab id="tab2" /> <rich:tab id="tab3"> <rich:datatable id="table" value="#{bean.somevalue}">...</rich:datatable> </rich:tab> </r:tabpanel> i think should using rerender relevant tabs refreshed. think should wrap contents of each tab in form not submitted on ea...