Posts

Featured post

javascript - Bootstrap Popover: iOS Safari strange behaviour -

i looking through twitter bootstrap documentation, , i'm interested in implementing dismissible popover when button clicked. here example bootstrap's docs: http://getbootstrap.com/javascript/#dismiss-on-next-click when press "dismissible popover" button os x safari browser works fine. when access same link above ios safari, button not work. is, popover not dismissed on click. why button not working ios safari? the example linked using data-trigger="focus" attribute. try changing data-trigger="click" . <a tabindex="0" class="btn btn-lg btn-danger" role="button" data-toggle="popover" data-trigger="click" title="dismissible popover" data-content="and here's amazing content. it's engaging. right?">dismissible popover</a>

ruby - Rails link_to existing route -

i'm trying link action in controller view. when rake routes, see document_version_file_index /document_versions/:document_version_id/file(.:format) file#index i think that's route want hit. controller called document_versions_controller , includes action called download want call. when try <%= link_to linktext, :document_version_file %> i routing error: no route matches {:action=>"show", :controller=>"files"} there no files controller. i'm trying hit document_version controller. doing wrong? edit: how building route: resources :document_versions resources :files member 'download', :action => :download resources :document_version end end edit 2: can step , pretend don't have route in existence already? have view , controller. controller has def download , named document_versions_controller.rb , has class documentversionscontroller < applicationcontroller . how c

xpath - Shorten expression for Python exceptions handling -

i'm using try / except check xpath alternative sources input variables website. it have many times, i'm looking way shorten expression. perhaps context manager can used somehow? in example, checking 2 alternative xpath sources variables issuer , name . try: xpath_issuer = ".//*[@id='dv_pre88f496c28ad6488895f1ffc383fae8bd_list_list']/div/div[3]/table/tbody/tr[2]/td[2]" find_issuer = driver.find_element_by_xpath(xpath_issuer) issuer = re.search(r"(.+)", find_issuer.text).group() except nosuchelementexception: pass try: xpath_issuer = ".//*[@id='dv_pre00e883469a264528b20fbbc31b0da4a2_list_list']/div/div[3]/table/tbody/tr[1]/td[2]/a" find_issuer = driver.find_element_by_xpath(xpath_issuer) issuer = re.search(r"(.+)", find_issuer.text).group() except nosuchelementexception: pass try: xpath_name = ".//*[@id='cols']/div[1]/div[1]/h1" find_name = driver.find_el

android - Can't kill SystemUI with activityManager.killBackgroundProcesses -

first question here , pretty knew android development excuse me. part of app add button can restart systemui, doing following code. @override public void onclick(view v) { activitymanager activitymanager = (activitymanager)getapplicationcontext().getsystemservice(context.activity_service); activitymanager.killbackgroundprocesses("com.android.systemui"); } i have gave application su permission following code public process p; { try { p = runtime.getruntime().exec("su"); } catch (ioexception e) { e.printstacktrace(); } } many in advance. you should have permission kill_background_processes able call method. su doesn't play role here, because using android's framework operation. if use busybox kill process, need su. generally, not idea kill systemui, though.

javascript - Restricting panning to one globe in Google Maps API -

i have map created using google maps api, , i'd restrict panning 1 globe; default can pan continuously east/west, map repeats endlessly. i'm trying use henningj's solution posted this question var allowedbounds = new google.maps.latlngbounds( new google.maps.latlng(85, -180), new google.maps.latlng(-85, 180) ); lastvalidcenter = map.getcenter(); google.maps.event.addlistener(map, "center_changed", function() { if (allowedbounds.contains(map.getcenter())) { lastvalidcenter = map.getcenter(); return; } map.panto(lastvalidcenter); }); what have allows no panning whatsoever, call 'contains' fails. if log map.getcenter() looks sensible enough, think(?!): object { a: 54.683366, f: 25.31663500000002 } can see i'm doing wrong? you have allowedbounds defined incorrectly. should (from the documentation ): latlngbounds(sw?:latlng, ne?:latlng) constructs rectangle points @ south-west , north-east

javascript - jquery form validation not working after rule added -

i have added rule control. still error not showing after form validation. after click have validate input box , check empty string. if empty string show error otherwise call ajax method. error never showing. edit: @sparky suggested. updating post. loading input box , anchor tag after dom loaded. added validation rule companyname control. , checking validation in <a> click , false. still error text not showing. html <form action="/address/addaddress" id="frmaddress" method="post" name="frmaddress" novalidate="novalidate"> <div id="addeditaddressplaceholder> <input name="companyname" class="spe-formcontrol" id="companyname" type="text" value=""> <a href="#" class="btn btn-success" onclick="javascript: submitcompanyfind();">find company</a> javascript $.ajax({

ruby - How to specify multiple column by xpath -

i want multiple table data html this: html = <<eof <table> <tr> <td>1</td> <td>2</td> <td>3</td> </tr> <tr> <td>4</td> <td>5</td> <td>6</td> </tr> </table> eof i want 2 data like: noko = nokogiri::html(html) noko.xpath("//tr[1]/td[2]").text #=> "2" noko.xpath("//tr[1]/td[3]").text #=> "3" what expect code "23", return "123". how can "23" using xpath? noko.xpath("//tr[1]/td[2 , 3]").text there multiple ways of solving problem. 1 : require 'nokogiri' html = <<eof <table> <tr> <td>1</td> <td>2</td> <td>3</td> </tr> <tr> <td>4</td> <td>5</td> <td>6</td> </tr> </table> eof noko = nokog