Posts

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...

c# - WPF Binding One TextBox to two Properties -

perhaps simple question, but... so, have bound text box property in viewmodel: <textbox x:name="ololo" text="{binding vm.ololotext, mode=twoway, updatesourcetrigger=propertychanged}"> and there textblock near , change text property value due trigger logic have implemented beforehand: <style targettype="textblock"> <style.triggers> <datatrigger binding="{binding elementname=typegallery, path=selectedvalue}" value="firsttype"> <setter property="text" value="aaa" /> </datatrigger> <datatrigger binding="{binding elementname=typegallery, path=selectedvalue}" value="second type"> <setter property="text" value="bbb" /> </datatrigger> ... so, textblock has values aaa or bbb . wo...

pbs - default queue for interactive job with torque -

as torque administrator, how can force interactive jobs part of given queue (let 'interactive_queue') while keeping default queue non-interactive jobs. in other words, i'd command: qsub -i to equivalent (by default) to: qsub -i -q interactive_queue while keeping set server default_queue = another_queue you have set queue options correctly: qmgr -c "set queue another_queue disallowed_types = interactive" qmgr -c "set queue interactive_queue disallowed_types = batch"

symfony - Can I make a rule in security.yml that redirect me from login form to defined URI/patch only if I came from other defined URI/patch? -

can make rule in security.yml redirect me login form defined uri/patch if came other defined uri/patch ? "if come login form uri/path named x after authorization redirected uri/path named y " in standard symfony edition, can not configure feature, can create custom success handler ( symfony\component\security\http\authentication\authenticationsuccesshandlerinterface ) called after complete authorization via form or adapter , inject handler configuration ( firewalls.form_login.success_handler ). in own handler can return redirectresponse redirect user page.

Index of the community from iGraph community algorithms -

does index of community of igraph community algorithms have meaning? e.g., if use fc <- fastgreedy.community(g) , communities 1,2,3: community 1 mean strongest community because merged first in algorithm or labels? there no ordering; community ids igraph uses arbitrary numbers.

mysql - SQL > Select multiple rows for single result -

Image
i have above table, need is, example based off image, have single row returned show: ticket id | created | assigned | time difference 2 | 2015-05-31 09:18:44 | 2015-06-03 10:05:00 | $math_result this image shows 1 example i'd have return each ticket has both 'assigned' time , 'created' time. i'm not dba , bit beyond limited knowledge. can me on how can accomplish this? you can use join find row state "assigned" row in state "created": select c.ticket_id , c.timestamp , a.timestamp , datediff(a.timestamp, c.timestamp) ticket c join ticket on c.ticket_id = a.ticket_id c.state = 'created' , a.state = 'assigned'

Java Collection Sort: Issue while sorting list -

this question has been asked many times understood should return 0 1 , -1 still getting exception java.lang.illegalargumentexception: comparison method violates general contract! @ java.util.timsort.mergehi(timsort.java:895) @ java.util.timsort.mergeat(timsort.java:512) @ java.util.timsort.mergeforcecollapse(timsort.java:453) @ java.util.timsort.sort(timsort.java:250) @ java.util.arrays.sort(arrays.java:1512) @ java.util.arraylist.sort(arraylist.java:1454) @ java.util.collections.sort(collections.java:175) code snippet collections.sort(list, new comparator < employee > () { public int compare(employee emp1, employee emp2) { int compareval = 0; int returnval = 0; try { if (emp1 == emp2) { returnval = 0; } else { if (empname.equalsignorecase(constant.emp_id)) { if (emp1.getempcode() != null &&...

java - Get plots from CombinedDomainXYPlot (and remove them) -

is there way plot list added combineddomainxyplot if don't keep references them? i'd there plots, work them , possibly remove them compined plot. this example code adding plots combineddomainxyplot: // axis dateaxis domainaxis = new dateaxis("date"); // plot container combineddomainxyplot plotcombined = new combineddomainxyplot(domainaxis); // plot 1 xyplot plot1 = new xyplot(); plot1.setdomainaxis(domainaxis); plotcombined.add(plot1); // plot 2 xyplot plot2 = new xyplot(); plot2.setdomainaxis(domainaxis); plotcombined.add(plot2); update 1: i've tried code doesn't return plots. it's not reliable. for (object sp : plotcombined.getsubplots()) { plotcombined.remove((xyplot)sp); } it method of removing plots correct? full example code: import javax.swing.jframe; import org.jfree.chart.axis.dateaxis; import org.jfree.chart.plot.combineddomainxyplot; import org.jfree.chart.plot.xyplot; public class sample27 extends jframe { p...

python - Embed Python2 and Python3 interpreters, choose which one to use at runtime -

is there way embed both python2 , python3 interpreter c program , running either 1 or other decision occurring @ runtime? here's example attempt: makefile: all: main main: main.c librun_in_py2.so librun_in_py3.so g++ main.c -lrun_in_py2 -lrun_in_py3 -l. -wl,-rpath -wl,$$origin -o main librun_in_py2.so: run_in_py2.c g++ $$(python2.7-config --cflags --ldflags) -shared -fpic $< -o $@ librun_in_py3.so: run_in_py3.c g++ $$(python3.4-config --cflags --ldflags) -shared -fpic $< -o $@ clean: @-rm main *.so main.c void run_in_py2(const char* const str); void run_in_py3(const char* const str); static const char str2[] = "from time import time,ctime\n" "import sys\n" "print sys.version_info\n" "print 'today is',ctime(time())\n"; static const char str3[] = "from time import time,ctime\n" ...

sql server - join table and where column similar to other column, while changing column value SQL -

i have issue code. sql issue. i need combine 2 tables. @ present have code: select calldate,clid, '44'+dst [numberdialed],dstchannel,billsec,disposition,accountcode,uniqueid,cnam, callrateimport.description, callrateimport.code, callrateimport.day calllogimport left join callrateimport on calllogimport.dst callrateimport.code + '%' callrateimport.code(select code callrateimport calllogimport.dst code + '%' , len(code) = (select max(len(code)) callrateimport calllogimport.dst callrateimport.code + '%') ) this combining fine. need match altered result depending on original result is. i have code: if substring (dst,1,2)=00 begin end wrapping current code. sql throwing errors - incorrect syntax. have else if block of 3 components. to modify values based on current value, should @ case statements. for example: use adventureworks2012; go select productnumber, category = case productline when 'r' 'r...

apache - Passenger doesn't seem to know the VirtualHost is a rails app -

i've configured apache 2.2 virtualhost ruby on rails (2.3.14) application. however, when visit url website i'm presented directory listing. i've checked passenger (5.0.9) loaded apache (it is) , i've got loglevel set 4 can see passenger doing. starts , indicates listening requests. however, appear passenger not being invoked when website visited. how passenger know needs handle virtualhost? thanks solution: the rails application did not have config.ru file. after pinching 1 off web rails 2.3 application appears instead of directory listing. it appears passenger documentation this file used rack fire instances of application.

windows installer - Is it possible to get GUID of application from InstallShiel 2009 install package without installing application? -

i have file, setup.exe contains application's single file installer created installshield 2009. there way extract application's guid without actual installing of application? extract setup first using setup.exe /a . answer dialogs appropriately, need set extract location. check answer more details on extracting setup.exe : extract msi exe when extract done, locate , open msi file , check upgrade code , product code s in property table . need installshield , orca or other tool capable of opening msi file. the package code can find right clicking msi file , selecting properties. some links: setup.exe pdf reference sheet setup.exe , update.exe command-line parameters uninstalling msi file command line without using msiexec how can find product guid of installed msi setup?

oracle11g - Oracle managed driver ODP.NET with NHibernate 4.0 FLOAT (126) to C# DECIMAL/Double -

i trying create mapping using fluent nhibernate oracle 11g. mapping creating:- public class abc : classmap<abc> { public abc() { table("abc"); dynamicupdate(); id(x => x.id, "idcolumn").generatedby.guidcomb(); map(x => x.decimalcolumn, "decimalcolumn").formula("trunc(decimalcolumn, 28)"); } } now when data using criteria query:- var criteria = session.queryover<abc>().where(x => x.id == id); criteria.future(); it throws nhibernate.exceptions.genericadoexception innerexception (invalidcastexception) columns decimal points more 28 requires truncation. but if remove column mapping such (note column name string missing decimalcolumn), works. public class abc : classmap<abc> { public abc() { table("abc"); dynamicupdate(); id(x => x.id, "idcolumn").generatedby.guidcomb(); m...

jquery - Disabled options of one chosen dropdown which is selected in another chosen dropdown -

example fiddle description: i have 2 multiselect dropdowns (with chosen plugin ) loaded. i have add mitigator link add dropdown. currently, if select option a dropdown 1 , option a gets disabled dropdown 2 . requirement: but on loadtime(loading before) if option a selected in dropdown 1 option a not disabled in dropdown 2 . once select dropdown, gets disabled. i want selected options of 1 dropdown disabled other dropdowns loading time