Posts

Showing posts from April, 2014

web crawler - use htmlunit how to get modal dialog element -

i want go website https://console.mobra.in htmlunit tool, login input in modal box, how username input element or login form? use queryselector method in htmlunit. usernamebox = currentpage.queryselector("[placeholder='username or email address']"); passwordbox = currentpage.queryselector("[data-ng-model='user.password']"); to above css selector, may install chrome extension 'css selector' of using selectorgadget . if works, please tick answer, or otherwise please leave comment below.

java - c3p0 reconnect after network outage -

the application connects ms sql server. uses c3p0 combopooleddatasource in tomcat , spring environment. when application loses database connection , gets few seconds later, application recovers connection , can continue querying db (as network back). network outage longer, application needs more 10 minutes recover db connection after network came back. i see these logs when db connection after 10 minutes: [warning] exception on close of inner statement.java.sql.sqlexception: invalid state, connection object closed. @ net.sourceforge.jtds.jdbc.tdscore.checkopen(tdscore.java:481) [warning] [c3p0] pooledconnection has signalled connection error still in use! [warning] [c3p0] error has occurred [ java.sql.sqlexception: invalid state, connection object closed. ] not reported listeners!java.sql.sqlexception: invalid state, connection object closed. here spring-config.xml configuration: <bean id="commondatasource" abstract="true" class="com.mcha...

xilinx - Does aborting a partial FPGA reconfiguration possibly result in an undefined state? -

i'm working on reconfiguration controller reconfigurable cpu. 1 of features tried implement handle crc errors properly, , allow aborts during reconfiguration. using virtex7 board , described in ug702.pdf (page 98) reloading bitstream after crc error isn't problem, abort can performed shown in ug470_7series_config.pdf (page 48) . at first glance seems work described in documentation, on crc error reconfiguration controller notifies cpu , cpu gives controller fresh bitstream. also, cpu can send controller abort command , controller abort described in docs. hovewer, seems work sporadically, whole system freezes, nonsensical exceptions, , unconditional jumps not taken seems. i not sure whether messed somewhere or expected, since containers partial bitstreams go interconnected pipeline , bus. remember have read in xilinx pdf bitstream not configured until desynch command @ end of bitstream encountered. mean fabric not affected until full partial bitstream loaded onto fab...

python/numpy versatile max function -

in python (possibly including numpy) there various maximum , max , amax functions, extent covered in stackoverflow questions, none of them seems solve rather obvious need of computing the maximum of mixed arguments , i.e. matching following requirements: any argument iterable (tuple, list, numpy array) or number ... , recursively, i.e. iterable in turn contain numbers , iterables iterables turning out empty, , none items, should not affect max only if arguments empty output should given default if arguments contain nan, should propagated (i think automatic) i seeking solution versatile, compact , proper pythonic point of view. nb. tried code myself little success. not attach many attempts because ugly, , don't work either, , above all, believe misleading , time waste of possibly can help. question long. anyway, here 1 of attempts, doesn't work: <!-- language: python --> def flexmax1(aa): ''' works on 1 argument, breaks into: ...

jquery - Svg animation doesn't play in Mozilla properly -

i have page loads svg file loading image , goes home screen. svg animation plays in chrome , opera not in mozilla. i typed keyframes didnt worked.any suggestions? mozilla latest update. here code of svg <svg version="1.1" id="layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewbox="0 0 1224 260.429" style="enable-background:new 0 0 1224 260.429;" xml:space="preserve"> <defs> <style type="text/css"> <![cdata[ .st0{fill:#ffffff;stroke:#000000;stroke-miterlimit:5;} .st1{fill:#ffffff;stroke:#000000;stroke-width:2;stroke-miterlimit:5;} .st2{fill:none;} ]]> .st0{ stroke-dasharray: 2000; stroke-dashoffest: 0; -webkit-animation:dash 7s linear forwards; -o-animation:dash 7s linear forwards; -moz-animation:dash 7s linear forwards; animation:dash 7s linear forwards; } .st1 { stroke-dasharray: 2000...

Cant import product image in magento 1.9 -

when importing product images getting error invalid image file type using .png , .jpg( /2811292016_05_26_12_10_13pm.jpg ). please me solve issue csv file

javascript - not able to load java script files and bower_components/angular/angular.js -

when run localhost:3000 server , i'm getting these errors in console: http://localhost:3000/bower_components/angular/angular.js failed load resource: server responded status of 404 (not found) http://localhost:3000/controller.js failed load resource: server responded status of 404 (not found) it working if put angular.js script in index.html instead of putting seperately in controller.js , don't know why i'm getting error when use script tags. the directory diagram this -files -bower_components -angular -index.html -controller.js -server.js this index.html file <!doctype html> <html ng-app="app"> <head> <style> #list { margin-left:320px; font-size: 40px; font-family:verdana; } button { color:yellow;background-color:red;text-align:center;cursor:pointer; -webkit-transition-duration: 0.4s; transition-duration: 0.4s; font-size:40px; padding: 14px 32px; } button:hover { background-color:peachpu...

c++ - Windows 10 tray menu behind taskbar -

Image
i have application icon in system tray. when right click tray icon shows menu user can select action. have found if have full screen application running , use alt + esc tray icon. when right click icon menu show behind(under) windows taskbar. in cases, menu low not possible select lowest menu item in context menu. when not full screen application in front menu correctly shown on top of taskbar. have testes on windows 7 works fine full screen application. have tried different full screen application internet explorer, notepad++ same thing happens. can see there lots of other application “skype business” , “radeon settings” same thing. skype business menu behind taskbar: build-in windows 10 applications works better. windows time , language parts of system tray show menus on top of taskbar new windows 10 layout (black) windows sound , network icons hide taskbar while showing regular right click menu, keeping start menu open. (this looks bit strange) have tried notificatio...

angular - Angular2 typescript how to get object properties to display in template -

Image
i learning angular2 , typescript , wondering why can not access property values of object in template. my component: export class farm{ data:json; id: any; constructor(private nextservice: nextservice, navparams: navparams){ this.id = navparams.get("param1"); } getfarmdetails(){ this.data = this.nextservice.fetchdata(this.id) console.log(this.data) } } where console.log(this.data) gives me object {id: 1, name: "leanne graham", username: "bret", email: "sincere@april.biz", address: object…} in template have <div> {{data}} </div> which outputs on screen [object object] how can instead output properties email or username? update: if {{data.email}} following error: you can access properties in javascript. for example: {{data.email}} if data retrieved asynchronously can use elvis operator ?. avoid errors while data null. {{data?.email}}

magento2 - Magento 2 custom payment method is not showing in front end -

i have tried create new payment method in magento2, when tried configure coming in backend, not in front end. if fixed issue please let me know fixes, not sure exact reason. my block form quickpay.php <?php /** * copyright © 2016 magento. rights reserved. * see copying.txt license details. */ namespace magento\quickpay\block\form; /** * block quickpay payment method form */ class quickpay extends \magento\quickpay\block\form\abstractinstruction { /** * cash on delivery template * * @var string */ protected $_template = 'form/quickpay.phtml'; } abstractinstuction.php <?php /** * copyright © 2016 magento. rights reserved. * see copying.txt license details. */ namespace magento\quickpay\block\form; /** * abstract class quickpay payment method form */ abstract class abstractinstruction extends \magento\payment\block\form { /** * instructions text * * @var string */ protected $_instructions; /...

python - Merging dataframes using a table -

i have matrix of similarity (which built dataframe): mat = pd.dataframe(index = df.a.values,columns = df.a.values) mat[:] = [[1,0.2,0.3],[0.7,1,0.6],[0,0.4,1]] id1 id2 id3 id1 1.0 0.2 0.3 id2 0.7 1.0 0.6 id3 0.0 0.4 1.0 and create dataframe contains same index single column containing closest id : id closest 0 id1 id3 1 id2 id1 2 id3 id2 the idea every row in similarity matrix second highest value (the first 1 on diagonal), , retrieve name of corresponding column. i know set diagonal zero, , use this: def closest(x): return np.where(x == x.max()) temp = mat.apply(lambda x: closest(x)) df['closest'] = df.index[[w[0][0] w in temp.values]].tolist() but can't find how filter diagonal without reassigning it.. note: values in matrix between 0 , 1, , 1 on diagonal subtract identity matrix, use dataframe.idxmax() find index of largest value in each row. import numpy np import pandas ...

c++ - std::next with n > std::distance(it, c.end()) -

i not want use std::distance because calculate whole distance iterator end. need sure have n or more elements iterator end. i'm using next code: if (std::next(it, n) != c.end()) // c std::multimap { /// logic } everything great , working compiler ( g++ (gcc) 4.8.3 20140911 (red hat 4.8.3-9) ) have doubts. in documentation (cpprefenece.com && cplusplus.com) can not find information case when n > std::distance(it , c.end()) or other exceptional cases. so. code safe? or should write own nextifpossible ? according standard §24.4.4/p3 & p6 iterator operations [iterator.operations] ( emphasis mine ): template <class inputiterator, class distance> constexpr void advance(inputiterator& i, distance n); 2 requires: n shall negative bidirectional , random access iterators. 3 effects: increments (or decrements negative n) iterator reference n. template <class inputiterator> constexpr inputiterator next(inputiterator ...

mongodb - How to retrieve array value index wise -

how retrieve array value index-wise in mongodb? in below query, want computers answer: > db.customers.find({}, { likes : { $slice: 1}}).pretty() { "_id" : objectid("57709662a93160be074de74a"), "name" : "john", "age" : "40", "likes" : [ "computers" ] } is looking for db.customers.aggregate([{$project:{_id:0,selected:{$slice:["$likes", 1]}}},{$unwind:"$selected"}]);

c# - show recent data in data grid view -

i working on windows application. in application, saving data in database. and retrieving data in data grid view. for using following code : var expenselist = db.sp_todaysexpense().where(a => a.date <= datetime.now.date).tolist(); dgvtodaysexpense.datasource = expenselist; above code shows data in database. but, want show data added after opening application. so how can ? thank in advance. you need save datetime value in app settings (right click project => propeties => settings ): note : use scope => user in order able update value. then in program.cs main method add: properties.settings.default.lastopenedtime = datetime.now; properties.settings.default.save(); and change query to: datetime querytime = properties.settings.default.lastopenedtime ; var expenselist = db.sp_todaysexpense().where(a => a.date >= querytime ).tolist(); dgvtodaysexpense.datasource = expenselist; for more on app settings : read here

c++ - How to verify (programmatically) if an exe has been tampered or not? -

context : third party exe tries communicate application. application should ensure third party exe not tampered or modified other owner. both external pe , application runs on same machine , external pe relies on com interface fetch data needs application. i extent aware sole purpose of signing executable ca certificate ensure authenticity , integrity. have validate certificate of external pe confirm identity. still have following doubts. 1) win-api provides winverifytrust , certverifycertificatechainpolicy functions. both of these functions can used trust verification of executable. difference? in case should function? 2) if use these function verify certificates, possible malicious app can spoof certificates(pose valid exe) or fool other means , connect application? thanks in advance help.

javascript - Node File System Create Directory and files on post route -

i have dashboard generates json data , saves .json file. written in php various reasons have re-written application in node. code below takes post data , should check see if file exists if update if not should create file , directory. however seems create first file , cannot fathom why doesn't create subsequent files post route called once each post. the post method looks this $.ajax({ type : "post", url : '/save/', datatype : 'json', data : { category : settings.category_id, name : settings.campaignid, json : json.stringify(settings) } }); i have debugged , when called correct file paths passed if file isn't being written data. during debugging using node-inspector , nodemon code loops through requested new file names , gives me error code enoent, should follow create file path. if know node , file system module , feel helping me out amazing if it's pointing me in direction of more tutorials, ... g...

jquery - POST HTTP://localhost:53122/albumlist.aspx/www 404 (Not Found) -

i using vb.net .i need call function written in albumlist.aspx using jquery below: var l = window.location; var base_url = l.protocol + "//" + l.host; $(".pagen ").click(function() { var num = $(this).attr('id'); $.ajax({ type: "post", url: base_url + '/albumlist.aspx/www', data: { id: num }, datatype: 'json', encode: true, async: false, cache: false, success: function(response) { console.log(response); }, error: function(jqxhr, textstatus, errorthrown) {} }); }); function is: public function wwww(byval id integer) string return "jhgfjhf" end function using code, getting 'post http://localhost:53122/albumlist.aspx/www 404 (not found)'. should do, new vb. there other problems, can spot @ least two. first, have mark method <webmethod> attribute. second, methods inside of .aspx page must marked shared in order visible web...

swagger - Host Swashbuckle documentation on other Web site -

i have web-api enabled application hosted under iis. i've added swashbuckle , seems work well. i'm able access swashbuckle documentation api.cooldomain.com/swagger/ui/index is possible host swashbuckle documentation on web site? (api running on api.cooldomain.com , have swashbuckle documentation on docs.cooldomain.com? swashbuckle hosts swagger api manifest json document at: [your url root]/swagger/docs/[version e.g. v1] the swashbuckle index.html hosted @ /swagger downloads json document , uses populate page. you can not enable swagger ui on api project (but still enable swagger), , host index.html file swashbuckle anywhere (it's in repo here: swagger-ui . you can have point swagger manifest on api site rendering.

node.js - How to use AWS.CloudFront.Signer in Lambda function -

i'm trying use lambda generate , return signed cookie ios app can use cookie access restricted files via cloudfront. i think should possible using signer class: http://docs.aws.amazon.com/awsjavascriptsdk/latest/aws/cloudfront/signer.html on basis have written following lambda function: var aws = require('aws-sdk'); var keypairid = 'apk...'; var privatekey = 'miie...'; var signer = new aws.cloudfront.signer(keypairid, privatekey); exports.handler = function(event, context) { var options = {url: "https://xxxxxx.cloudfront.net", expires: 1357100000}; signer.getsignedcookie(options, function(err, data) { if (err) { context.fail(err); } else { context.succeed('success'); } }); }; however, not work. keep getting error 'process exited before completing request'. have tried many permutations format of 'options' parameter, none of make difference. any apprec...

c# - TypeInitializationException on a struct with no constructor -

Image
i typeinitializationexception . inner exception dividebyzeroexception . looking @ stack trace inner exception, this: à system.decimal.fcalldivide(decimal& d1, decimal& d2) à system.decimal.op_division(decimal d1, decimal d2) à dimensionneljdp.incertitudeobject..cctor() dans \incertitudeobject.cs:ligne 108 the code triggers exception this: incertitudeobject io = new incertitudeobject(); io.compute_e( config, ( (empilementobject)row[ "empilement" ] ).pile ); //exception here my investigations on issue lead me see that, when inside io , there bunch of question marks instead of bunch of variables. the same exception happens regardless of function call (including when calling io.tostring() ), , io full of question marks. i figured incertitudeobject doesn't initialized correctly, though how beyond me. doesn't have constructor, i'm assuming uses default implicit parameterless constructor of language. really, don't know happening here. it w...

swift sprite kit game when I shoot on a enemy sometimes the bullet goes trough the enemy, how can I fix this? -

i'm making game in sprite kit (2d) . i have code: meteor.physicsbody = skphysicsbody(rectangleofsize: enemy.size) and have meteor image need destroy when shoot on device meteor bullet goes through meteor bug or did wrong? , how can fix issue? thanks reading problem, hope can me! if don't understand question plz comment don't understand. func firebullet() { let bullet = skspritenode(imagenamed: "bullet") bullet.name = "bullet" bullet.setscale(2.9) bullet.position = player.position bullet.zposition = 1 bullet.physicsbody = skphysicsbody(rectangleofsize: bullet.size) bullet.physicsbody!.affectedbygravity = false bullet.physicsbody!.categorybitmask = physicscategories.bullet bullet.physicsbody!.collisionbitmask = physicscategories.none bullet.physicsbody!.contacttestbitmask = physicscategories.meteor self.addchild(bullet) let movebullet = skaction.movetoy(self.size.height + bullet.size.height, d...

smarty - Override Prestashop setMedia function to put js and css files at the bottom -

i have known frontcontroller override class frontcontroller extends frontcontrollercore { public function setmedia() { parent::setmedia(); $this->addjs(array( _theme_js_dir_.'adds.js' )); } } this wokrks expected 1 issue -> adds new js/css files @ top of included files list, here: <script type="text/javascript" src="/js/adds.js"></script> <script type="text/javascript" src="/js/jquery/jquery-1.11.0.min.js"></script> <script type="text/javascript" src="/js/jquery/jquery-migrate-1.2.1.min.js"></script> <script type="text/javascript" src="/js/jquery/plugins/jquery.easing.js"></script> <script type="text/javascript" src="/js/tools.js"></script> <script type="text/javascript" src="/themes/default-bootstrap/js/global.js"></script> and...

c# - ASP .Net: Linq check if string array contains string subarray -

is there way check if 1 string array contains 1 string subarray? elements in array doesn't have identical elements in subarray, if it's not same strings can contain subarray's element part of string in bigger array. for example: array["ax", "by", "cz", "dw", "eg"] contains subarray["a", "by", "e"] array["ax"] contains subarray["x"] array["ax", "by"] contains subarray["ax", "by"] i need write in linq syntax, i'm getting subarray input "text" via form, , i'm splitting char(' '), on other hand i'm getting bigger array string split char(' ') database field. what want do "search" on client, check if partially can filter database result. i'm getting subarray client browser via input text field , that's ok, creating array each result got database: var auctions = o in d...

installation - Unable to install Visual Studio for Win7 (Unresponsive) -

Image
this might stupid question, can't solve hours , killing me. i'm trying install visual studio in lab computer, runs win7. problem is, when execute visual studio installer, not after showing visual studio logo , utterly unresponsive (only black square pops up). @ first, thought might loading long time, after leaving few hours , still nothing. i've tried install using iso images, or tried previous versions(2013 , 2012) failed. formatting simple answer, practically impossible since used multiple members in our lab, can't occupy long format , installing other existing software. how can solve problem? thank reading question. appreciate more if can answer! you should install windows updates , update gpu driver. setup based on windows presentation foundation (wpf) uses gpu accelerate ui date drivers recommend.

jquery - Filtering through Javascript 2d array -

i have 2d array var items = [['alex',2],['alex',4],['alex',6],['jhon',11],['jhon',13]]; but in html want render array like **names** **numbers** alex => 2,4,6 jhon => 11,13 you can use reduce() return object , object.keys() , foreach loop add html var items = [['alex',2],['alex',4],['alex',6],['jhon',11],['jhon',13]]; var result = items.reduce(function(r, e) { r[e[0]] = (r[e[0]] || []).concat(e[1]); return r; }, {}); var rows = ''; object.keys(result).foreach(function(e) { rows += '<tr><td>' + e + '</td><td>' + result[e].join(',') + '</td></tr>'; }); document.queryselector('table tbody').innerhtml += rows; <table> <tbody> <tr><td>names</td><td>numbers</td></tr> </tbody> </table> ...

c# - Entity Framework Core + Npgsql driver: Incorrect default GUID inserts if a complex alternate key exists -

i'm using npgsql.entityframeworkcore.postgresql vesrion 1.0.0 , microsoft.entityframeworkcore version 1.0.0. i have following in onmodelcreating : builder.haspostgresextension("uuid-ossp"); builder.entity<questionnairelogic>().property(l => l.evaluatedanswer).hasdefaultvalue(guid.empty); builder.entity<questionnairelogic>().property(l => l.questiontojump).hasdefaultvalue(guid.empty); builder.entity<questionnairelogic>().hasalternatekey(l => new { l.actionwhen, l.questionid, l.evaluatedanswer, l.evaluatedvalue, l.operation }); evaluatedanswer , questiontojump both have empty guid default, evaluatedanswer included in alternate key. database created correctly. if write explicitly: questionnairelogic logic = new questionnairelogic(); logic.evaluatedanswer = guid.empty; logic.questiontojump= guid.empty; then after _context.logic.add(logic); logic.evaluatedanswer have new guid. in previous version (rc-1 @ l...

I want the pattern printing using Javascript -

for given number n, print grid shown below using javascript, n positive integer greater 2. example output n=3 1 1 1 1 0 1 1 1 1 example output n=4 1 1 1 1 1 0 0 1 1 0 0 1 1 1 1 1 function printmatrix(n) { (var = 0; i<n; i++) { var x = ""; for (var j = 0; j <n; j++) { if (i == 0 || == (n-1)) { x += "1"; } else { if (j == 0 || j == (n-1) ) { x +="1"; } else { x += "0"; } } } $("#result").append(x + "<br>"); } } $("#btn").click(function() { $("#result").empty(); printmatrix($("#index").val()); }) <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <input type='number' id='index'> <input type='button' value='print' id='btn'> ...

How to debug generic React Native error messages on iOS? -

unless enable debugging (esc > cmd+d > debug js remotely) see error: module appregistry not registered callable module this means i'm unable view bundled app on device. if try view app on device, still use dev server (remembering use ip address in appdelegate.m instead of localhost ) instead error: websocket connection failed error error domain=nsposixerrordomain code=61 "connection refused" even though i've verified can open dev server url in browser on device. i'm not ios developer, maybe obvious, how go debugging why these errors happening, or not having these errors in first place? one reason app transport security added in ios 9. please see https://facebook.github.io/react-native/docs/running-on-device-ios.html#app-transport-security reference. have add nsallowsarbitraryloads entry info.plist if didn't use react native cli generate project.

html - ul/li Drop Down not aligning to the left? -

Image
i'm trying create drop down settings page tab, works fine no issues when opened on desktop when opened on mobile/tablet or shrinking browser size tabs menu "crushed" in sense. looks it's dropping down right when maybe if dropping down left might fix it. no idea anyway, wondered if knows how fix issue? current desktop example current mobile example the way want look html <body> <div id="header"> <div id="headertitle"> <p>project archive</p> </div> <div id="nav"> <ul> <li class="navon"><a class="active" href="home.php">home</a></li> <li><a href="home.php">all</a></li> <li><a href="home.php">categories</a></li> <li><a href="home.p...