Posts

Showing posts from February, 2012

java - Selenium with chrome return exception when handling alert -

i’ve been trying handle alert in selenium using chrome 54.0.2840.87 (currently latest chrome version) , chromedriver 2.25 (currently latest chromedriver) without success. i’ve made sure alert , not popup (there’s no inspect element option). also i’ve made sure there’s no timing issue, placing breakpoint before code handle alert, gives exception: org.openqa.selenium.noalertpresentexception: no alert open this code i’ve been trying use, without success: driver.switchto().alert().accept(); also tried wait alert present using code, without success: wait.until(expectedconditions.alertispresent()); also tried use javascript executescript accept alert without success: ((javascriptexecutor)m_driver).executescript("window.confirm = function(msg){return true;};"); link alert i’ve received: https://i.stack.imgur.com/n8fce.png thanks help. this not alert box. won't able handle in traditional way. workaround, can disable protocol handler box chrome local sta

linux - How to Check if a WebDAV/Dropbox folder is correctly mounted on centos FS? -

i have procedure runs on remote server (centos). procedure reads , elaborates lot of pdf files webdav owncloud folder mounted on file system runs (by mount davfs2). days ago i've noticed procedure used mount folder fails when server restarts reasons , , can't see (remotely) if folder mounted correctly. reasons i've decided create monitoring procedure test hourly if folder correctly mounted. want start linux command line tool check if webdav folder in path correctly mounted. give me hints common used command line /bash tools/procedures use stuff ? p.s. older versions of procedure uses dropbox folder mounted on file system ( use owncloud webdav folder). how can check if dropobx client in sync ?

javascript - Multiple Datatables with Multiselect -

after 2 days of searching , trying fix problem, don't know how continue. i use datatables numerous plugins, extensions , custom code intern webapplication. have problem select-extension datatables ( https://datatables.net/extensions/select/ ). use extension custom-code found online enable user multiselect rows out of table , use ids of rows after submiting form table within. works charm. for new module need use multiple tables in 1 form , need value of every selected row every table. rows first table picked up, each table after ignored. i wrote light-version of script in jsfiddle. can't find reason why doesn't work on jsfiddle, code same use on our module works: https://jsfiddle.net/wgeh64vp/ var table = $('.table_select').datatable( { 'initcomplete': function(){ var api = this.api(); api .rows() .every(function(){ var data = this.data(); if(data[1] === '1'){ api.cells(t

git - Configure dependent teamcity build configuration to build only tags -

i have 2 build configurations, lets call them build , deploy . build triggered via webhook each commit/tag , build artifacts. what want achieve is: each time tag built, deploy build triggered, takes artifacts , deploys somehow (how — doesn't matter in scope of question). what have already: deploy depends on build via snapshot dependency. deploy has branch specification looking this: +:refs/tags/* deploy has finished build trigger branch filter looking this: +:* -:<default> both configurations have flag use tags branches enabled but doesn't work. specifications/filters based on this answer . , way master branch not triggered, feature branches (which not desired, since want see tags there) i tried putting +:refs/tags/* branch filter finished build trigger. in case nothing triggered @ all. teamcity version 9.1.4

javascript - Why does my images jump a few pixels when executing this parallax script? -

i not javascript guy dont understand why code this: when first loading page , scrolling, image targeted jumps down 30px var parallax = document.queryselectorall(".headerphotosmall, .headerphoto"), speed = 0.9; window.onscroll = function(){ [].slice.call(parallax).foreach(function(el,i){ var windowyoffset = window.pageyoffset, elbackgrounpos = "50%" + (windowyoffset * speed) + "px"; el.style.backgroundposition = elbackgrounpos; }); }; video showing problem: https://i.gyazo.com/040f328ac78a5d5243e37352e19e0cf6.mp4 i think @beyelerstudios's comment explains problem... initial position of images aren't related initial scroll position. i don't know parallax, though... since don't know css, tried auto-update position of parallax images when script runs, array#foreach loop. if you're declaring these background images later, need wait page load. var parallax, speed; var updat

python - Selected joining of lines -

i new python , need solve following (by hand or python): dataset, each file consists of undefined-groups of lines of varying number of numbers, followed 1 line of text incl. dates , numbers (sorry if sentence doesn't make sence): 2, 4, 6, 1, 2, 02-sep-2016, blah blah, blah, 83838338 3, 0, 0, 03-aug-2000, blah, 300033 i need highest number above line of text in front of text , rest deleted: 6,02-sep-2016, blah blah, blah, 83838338 3,03-aug-2000, blah, 300033 i know max() function, how specify general rule files numbers include, , how can selectively turn numbers int() without including sentence? tried if statement len(line)<=3 , not working. you can read input file using for line in my_file: ... . if lines want use max on follow format described (a number followed comma , carriage return), can store them in set integers discarding comma , \n using slice , transtyping result (i.e. using int(line[:-2]) ). max gives largest element of set, can

osx - mac os x authorization plugin through bluetooth -

is possible create authorization plugin login screen ble support? (not lock screen) can ble start in prelogin mode ? for example add ble example https://github.com/skycocker/nameandpassword thanks

javascript - AngularJS seems to be cached in a symfony/angular stack -

from yesterday i'm blocked. i'm working on symfony/angular project last year , can't understand why js of angular seems cached. when modifiy style or html of views that's work fine, when i'm playing js there no change. i tried clear symfony cache, , browser cache, disable browser cache, change browser, modify/comment/delete angular controller no way interact js. thank in advance help.

android - Showing an interstitial with Firebase Dynamic Links -

on official page firebase dynamic links ( https://firebase.google.com/docs/dynamic-links/ ) there mention of showing interstitial if app not installed: https://youtu.be/lvy1jmcrpf8?list=pll-k7zzesylmof_07iayrtntevxtbuxdl&t=87 dynamic links work seamlessly across ios, android, , desktop , mobile web. dynamic links can configured provide best possible user experience, whether that's personalized app launch, fast interstitial, or opening mobile website. how can that? this not feature firebase provides out-of-the-box. here steps need implement it: generate dynamic link , set ifl link param url on website. build custom interstitial , host @ url used in ifl param. within interstitial, insert second dynamic link ifl param pointed app store this step should not necessary because firebase docs state users without app should automatically forwarded app store default, have never seen happen — users without app taken url in link param in testing). if set

java - Trigger GWT class' method from inside other class -

i have gwt page contains lot of different fields, user needs fill out. when user done filling out form, can click on button on page, opens popuppanel summary of have input. if user decides data they've entered correct, have option of clicking on "ok" button on popuppanel. achieve when user clicks on ok, popuppanel closes , method in initial class (and using initial class' variables) triggered. unable use eventbus because of restraints. in initial class have click handler: buttonanle.addclickhandler(new clickhandler() { @override public void onclick(clickevent event) { if ( validatetimespan(subs) && validatesubumfeldtimespan(subs) ) { summary(); } } }); the method summary() shows popuppanel: private void summary() { int subumfeldernr = subs.getrowcount(); int werbeformennr = kats.getrowcount(); int days = (int) (datumbis.getvalue().gettime(

node.js - How to change handler function before request complete in Hapi.js? -

i want change handler function before request complete in hapi.js example: server.route({ method: 'get', path: '/error', handler: function(req, reply) { reply('hello !'); } }); how change handler function , reply other string 'hello change' before request complete.

python - Django KeyError when trying to format foreignkey -

i'm getting following error when trying create filepath filepath = '{comp}/utils/locndb/{vehdir}.{filename}'.format(comp,vehdir, filename) keyerror: 'comp' i don't know how extract string one-to-many foreignkey field extra.py def get_file_path(vehicle, filename): filepath = '' vehdir = vehicle.vehid print vehdir comp = getattr(vehicle.company, 'user', none) print comp filepath = 'optiload/{comp}/utils/locndb/{vehdir}.{filename}'.format(comp,vehdir, filename) print filepath return filepath views.py @login_required def loadlocndb(request): if request.method == "post" , request.files['locndb']: pks = request.post.getlist("update") selected_objects = vehicle.objects.filter(pk__in=pks) vlist = [] in selected_objects: vlist.append(i) locnfile = request.files['locndb'] fs = filesystemstorage() filename = fs.save(locnfile.name, locnf

regex - Validating a mathematical expression in java -

i trying validate if string "expression" in code below formula. string expression = request.getparameter(formula); if(!pattern.matches("[a-za-z0-9+-*/()]", expression)){return new ajaxmessage(ajaxmessage.responsestatusenum.failure, getjsonstring(, "manager.invalid.formula" , null)); } examples of value expression {a+b/2, (a+b)*2,(john-max),etc} context (the variable names in formula might vary , arithmetic expression contains [+-/()*] special characters. can see tried validate using regex (new regex), think it's not possible don't know length of variable names. is there way achieve validation using regex or other library in java? thanks in advance. the reason using characters special meaning in regex. need escape characters. have modified yor regex make work. code: list<string> expressions = new arraylist<string>(); expressions.add("a+b/2"); expressions.add("(a+b)*2"); expre

android - Error while running on pre-Lollipop versions -

i'm getting error error:execution failed task ':app:transformclasseswithjarmergingfordebug'. com.android.build.api.transform.transformexception: java.util.zip.zipexception: duplicate entry: android/support/v7/util/sortedlist$batchedcallback.class here build gradle: apply plugin: 'com.android.application' android { compilesdkversion 23 buildtoolsversion "24.0.2" uselibrary 'org.apache.http.legacy' defaultconfig { applicationid "com.cuztomise.services" minsdkversion 11 targetsdkversion 21 multidexenabled =true compileoptions { sourcecompatibility javaversion.version_1_7 targetcompatibility javaversion.version_1_7 } } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.txt' } } } dependencies {

javascript - Ember.JS: Ember-Objects and where they are exported to -

i trying grasp underlying system of ember.js . whereto ember-objects exported , how used? components : export default ember.component.extend({ ... }); controllers : export default ember.controller.extend({ ... }); models : export default ds.model.extend({ ... }); routes : export default ember.route.extend({ ... }); ... follow same structure: extend object , export something. somebody knows more? thanks! i think interpreting export keyword wrong here. it doesn't mean files written somewhere else in different format, but: if module (= file) import ed, things in file export ed available importer. think of making parts available other modules, public api in shorter terms. ember files export 1 thing there strong naming convention making ember engine work way. why if declare /user route, try use routes/user.js , controllers/user.js , , templates/user.hbs files if exist, without having specify anything. in similar way, makes component usa

ios - Removing ViewController in Navigation Stack -

in navigation stack , having 6 view controllers a->b->c->d->e->f at view controller f , want go view controller b , how can this? want remove view controllers 1 one. in advance! use this: for (uiviewcontroller *controller in self.navigationcontroller.viewcontrollers) { if ([controller iskindofclass:[b class]]) { [self.navigationcontroller poptoviewcontroller:controller animated:yes]; break; } }

java - GoogleJsonResponseException: 400 Bad Request "Invalid query parameter type" -

i try programaticaly inject params bigquery query: this code: list<queryparameter> params = new arraylist<>(); queryparameter param = new queryparameter(); param.setname("@country"); param.setparametervalue(new queryparametervalue().setvalue(brandchangedataui.country)); param.setparametertype(new queryparametertype().settype("string")); params.add(param); param = new queryparameter(); param.setname("countryabbr"); param.setparametervalue(new queryparametervalue().setvalue(brandchangedataui.countryabbr)); param.setparametertype(new queryparametertype().settype("string")); params.add(param); list<string> brands = brandchangedataui.brands; list<string> brands2 = new arraylist<>(); (int = 0; < brands.size(); i++) { param = new queryparameter(); param.setname("brand" + i); param.setparametervalue(new queryparametervalue().setvalue(brandchangedataui.brands.get(i))); param.setparam

javascript - Firefox Extension location.href not redirecting -

i'm using rather generic here, want able load new tab @ desired url when selecting extension, when @ tab, redirect new url. (the add on should run code @ first page before redirecting, that's day). the code have @ moment is var buttons = require('sdk/ui/button/action'); var tabs = require("sdk/tabs"); var button = buttons.actionbutton({ id: "redirect", label: "redirect", icon: { "16": "./icon-16.png" }, onclick: handleclick }); function handleclick(state) { tabs.open({ url: "http://www.google.com", onready: loadredirect }); function loadredirect(tab) { tab.attach({ contentscript: "location.href = 'www.youtube.com;'" }); } } when running however, 2nd url appends first, rather replaces, , gets stuck in infinite load/refresh loop until close browser. i assume i'm missing absolutely obvious, wasn't able find while searching ar

javafx - Jafa FX CSS Duplicates -

i new javafx , css styling , after clarification on optimal way following. essentially, have 2 buttons have implemented hover , focus border color changes on both hover (mouse) , focused (key board tab). have following : .normalbutton:hover { -fx-font-size: 11pt; -fx-font-family: "verdana"; -fx-font-weight : normal; -fx-background-color : #545454; -fx-border-color: #ffffff ; -fx-border-radius: 3,3,3,3; -fx-border-width: 1px ; } .normalbutton:focused { -fx-font-size: 11pt; -fx-font-family: "verdana"; -fx-font-weight : normal; -fx-background-color : #545454; -fx-border-color: #ffffff ; -fx-border-radius: 3,3,3,3; -fx-border-width: 1px ; } it works fine wan wondering if there way combine both focused , hover have same properties. multiple selectors can seperated , in css. if 1 of them matches, the style applied. in example this: .normalbutton:hover, .normalbutton:focused {

unit testing - C# How to Moq entityframework DbSet Add method -

i trying create test test entity framework add method. can how mock dbset.add method. have tried below not working. doing wrong? the result getting null after repository.insert ... test.cs: var producttocreate = new product { name = "added", description = "added" }; var result = repository.insertasync(objtocreate, usercontext).result; assert.areequal(result.name, "added"); mock.cs internal static dbset<t> getmockeddataset<t>(ienumerable<t> data) t : class { // create mocked data set contains data var set = new mock<dbset<t>>(); set.as<idbasyncenumerable<t>>() .setup(m => m.getasyncenumerator()) .returns(new testdbasyncenumerator<t>(data.getenumerator())); set.as<iqueryable<t>>() .setup(m => m.provider) .returns(new testdbasyncqueryprovider<t>(data.asqueryable().provider)); set.as<iqueryable<t>>(

Update with Entity Framework C# -

i want update items entity framework, the code correct don't have result in database!! using(checkinentrepriseentities2 context = new checkinentrepriseentities2()) { clients clien = new clients(); clien.date_arrival = datetime.parse(textboxdatein.text); clien.arrival_time = textboxtime.text; clien.aller_a = comboboxpersonnel.selecteditem.tostring(); clien.badge = int.parse(comboboxbadge.selecteditem.tostring()); int badgetiped = int.parse(comboboxbadge.selecteditem.tostring()); context.savechanges(); } this code creating new clients object. if want update results database have select clients object database : clients clien = context.clients.single(x => x.id == yourid); // logic context.savechanges();

changing color of volume high/low in highcharts is not changing color -

i have checked link , changed code change color of column no luck change color of volume columns (high/low) in highcharts i have tried code color not changing in volume column, here code. <div id="container-ndx" style="height: 500px; width:100%;border-top:2px solid lightgray;"></div> <script> (function($) { var volumecolor = \'\'; var data = []; var ohlc = [], volume = [], datalength = data.length, // set allowed units data grouping groupingunits = [[ \'day\', // unit name [1] // allowed multiples ], [ \'week\', [1, 2, 3, 4, 6] ]], = 0; (i; < datalength; += 1) { ohlc.push([ data[i][0], // date data[i][1], // open data[i][2], // high data[i][3], // low data[i][4] // close

mysql - Join Select Statement after on -

is possible join on part of string split up? tried something: select param.par_name, parpat.pp_pattern, kom.kom_name inv.inv_parpat parpat inner join inv.inv_param param on parpat.pp_par_id = param.par_id inner join inv.inv_komponente kom on kom.kom_id = (select substr(parpat.pp_pattern, instr(parpat.pp_pattern, ':') + 1 ) inv.inv_parpat) parpat.pp_pattern '%ata%'; this statement says: single row subquery returns more 1 row you need join parpat based on substring column. if join subquery,the subquery should return 1 value (like max() or min() function do). else can use in clause subquery. remember, there performance considerations while using in. case, try below query: select param.par_name, parpat.pp_pattern, kom.kom_name inv.inv_parpat parpat inner join

javascript - Dynamically Adding images to Bootstrap Carousel in Rails 4 app -

i'm using active admin upload images app, working fine. want uploaded images displayed in bootstrap carrousel. lack of experience using rails , javascript limits me result want. the javascript console throws error : carousel.self-e47323f….js?body=1:148 uncaught typeerror: cannot read property 'offsetwidth' of undefined(…) carousel.slide @ carousel.self-e47323f….js?body=1:148 carousel.next @ carousel.self-e47323f….js?body=1:110 (anonymous function) @ carousel.self-e47323f….js?body=1:186 each @ jquery.self-bd7ddd3….js?body=1:371 each @ jquery.self-bd7ddd3….js?body=1:138 plugin @ carousel.self-e47323f….js?body=1:178 clickhandler @ carousel.self-e47323f….js?body=1:218 dispatch @ jquery.self-bd7ddd3….js?body=1:5227 elemdata.handle @ jquery.self-bd7ddd3….js?body=1:4879 edit looked @ possible duplicate, can see how might possible duplicate, i´m not sure on how integrate ruby loop into javascript . can advise me please. code below edited updated c

javascript - jQuery - Using easeOutBounce in animation Not Work -

i try animate div easeoutbounce effect when page load, not working me. i have referenced jquery ui. <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> my jquery code: $(document).ready(function() { $(".content").animate({margintop: "-=50px"},1000,'easeoutbounce'); }); my html code: <div class="content"> <h3>titulo h3</h3> <p>este texto lleva una animacion lorem ipsum dolor sit amet, consectetur adipiscing elit. curabitur nulla urna, consequat nec erat bibendum, ullamcorper fermentum ligula.</p> <img width="50%" src="images/javascript-movimiento.png" alt="animationjs" /> </div> this works in chrome - see title , para, para slides top pleasing bounce. please confirm works , if check html typos. <!doctype html&

c++ - What is the purpose of & in (a & 1) -

this question has answer here: what bitwise , operator & do? 4 answers ampersand in code, [closed] 2 answers i trying solve problem in codefights, after browsing net, found solution.but not clear how works. * (a & 1) ^ b * !(b & 1) ^ !!(((a ^ b) + 1) & 2) a single & bitwise and, means result bits set on both left , right side of operator. as example 15 & 7 or represented in binary: 1111 & 0111 the bitwise , result in number common bits set: 1111 & 0111 = 0111 when make (a & 1) testing whether least significant bit (lsb) set, since performing test this: a & 00000001 if a had bitwise value: 00000110 result 0, since there no common bits set, if a had bitwise value: 00000111 result 1 since lsb set on a. thi

knppaginator - Symfony remove page parameter -

i'm using knp_paginator on symfony list information. information i'm listing generate lots of pages. problem when filter results. let's i'm on page 3 generated link https://something.com/blabla?page=3 since filter doesn't generate 3 pages 0 results. if change page on url can see filtered results. how can make page parameter disapear when apply filters controller? i think answer question showed in example of official docs: $paginator = $this->get('knp_paginator'); $pagination = $paginator->paginate( $query, /* query not result */ $request->query->getint('page', 1)/*page number*/, 10/*limit per page*/ ); // parameters template return $this->render('acmemainbundle:article:list.html.twig', array('pagination' => $pagination)); in example default parameter first page 10 max per page. if count records less 10 it'll show 1 page 7 records.

html - Get text from website with VBA -

i need create vba macro takes specific website , search id. when id found need take text , copy excel. here source code of webiste: <tr> <td style="width: 10%; color: blue" valign="top"><a name="111" id="111">111</td> <td><pre> text need in excel </pre></a><td> </tr> i need text between "pre" this try in vba: set ie = createobject("internetexplorer.application") ie.visible = true ie.navigate website_url while ie.busy , not ie.readystate = readystate_complete doevents loop set document = ie.document dim searchvalue string set element = document.getelementbyid(searchvalue).getattribute("pre") range("i1").select activecell.formular1c1 = element i tried instead of ".getattribute" other methods , tried use element string didn't work. it awesome if me code :d the text not located in attribute in pre

c++ - analysis of core dump frame using gdb -

i analysing core dump generated application. stack trace can see below lines #0 0x00779eff in raise () /lib/tls/libc.so.6 #1 0x0077b705 in abort () /lib/tls/libc.so.6 #2 0x006554f7 in __cxa_call_unexpected () /usr/lib/libstdc++.so.5 #3 0x00655544 in std::terminate () /usr/lib/libstdc++.so.5 #4 0x006556b6 in __cxa_throw () /usr/lib/libstdc++.so.5 #5 0x006558d2 in operator new () /usr/lib/libstdc++.so.5 #6 0x006559bf in operator new[] () /usr/lib/libstdc++.so.5 #7 0x090c15df in buffer::resize () #8 0x090bd230 in buffer::buffer () the definition of buffer function follows int buffer::resize ( size_t size ) { ……. } now have selected frame 7 (gdb) f 7 #7 0x090c15df in buffer::resize () (gdb) info frame stack level 7, frame @ 0xbfff82f0: eip = 0x90c15df in buffer::resize(unsigned int); saved eip 0x90bd230 called frame @ 0xbfff8310, caller of frame @ 0xbfff8280 arglist @ 0xbfff82e8, args: locals @ 0xbfff82e8, previous frame'

java - RMI Chatprogram push configuration on external network not working -

we're trying make simple chat program using rmi push configuration. program works on internal network, when trying run program server on external network, error: java.rmi.connectexception: connection refused host: 192.168.1.13; caused by: java.net.connectexception: connection timed out: connect the error occurs when client calls method 'broadcast(string s)' on interface 'ichatserver' method located on server , calls other clients subscribed listener on server. our client can connect server. can bindings registry , call methods server. but when server tries call method client, error. on server, port 1099 forwarded, , port 1099 allowed in firewall. is there way make possible (using rmi)? or ports on client side need forwarded? server: try { string theip = serverhostexternalip; system.setproperty("java.rmi.server.hostname", theip); //implemented no random ports used rmisocketfacto

java - Glassfish: Invalid resource -

i have ejb module , want deploy on glassfish. configured jdbc pool , resource , ping successful. have error when deploy module. java db call "bank", glassfih write "bank_pm". persistence.xml <?xml version="1.0" encoding="utf-8"?> <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"> <persistence-unit name="clientmanager" transaction-type="jta"> <jta-data-source>jdbc:derby://localhost:1527/bank</jta-data-source> <exclude-unlisted-classes>false</exclude-unlisted-classes> <properties> <property name="javax.persistence.schema-generation.database.action" value="create"/> </properties> &l

android - PayUMoney Test Credentials for Sucess -

previously using test credentials provided payumoney on official site not functional , resulting in failed transaction (!error-gv00010-missing data typeerror) http://help.payu.co.za/display/developers/test+credentials i tried using card credentials provided in https://www.paypalobjects.com/en_us/vhelp/paypalmanager_help/credit_card_numbers.htm only card no 4111111111111111 worked card no has stopped functioning too. browsed lot couldn't help.

css - NoSuchElementError: no such element: Unable to locate element for protractor -

element(by.xpath(("/html/body/div[2]/div[3]/md-content/md-card/md-card-content/div/div/div/div/md-custom-table/div/md-table-container/table/thead/tr/th[3]/span"))).click(); this code want make work. this isxpath path of want clicked /html/body/div[2]/div[3]/md-content/md-card/md-card-content/div/div/div/div/md-custom-table/div/md-table-container/table/thead/tr/th[3]/span this error message: failed: no element found using locator: by(xpath, /html/body/div[2]/div[3]/md-content/md-card/md-card-content/div/div/div/div/md-custom-table/div/md-table-container/table/thead/tr/th[3]/span) stack: nosuchelementerror: no element found using locator: by(xpath, /html/body/div[2]/div[3]/md-content/md-card/md-card-content/div/div/div/div/md-custom-table/div/md-table-container/table/thead/tr/th[3]/span) @ webdrivererror (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:26:26) @ nosuchelementerror (/usr/lib/