Posts

Showing posts from May, 2010

C# Check if object exists before referencing -

this question has answer here: what nullreferenceexception, , how fix it? 29 answers i wondering if there's way check if object exists before referencing @ all. not check if null because isn't working either. using epplus package read excel files , when gets index not have value data in it, sends exception. private datatable worksheettodatatable(string tablename) { excelsheet = excelworkbook.worksheets[tablename]; datatable dt = new datatable(); try { int totalrows = excelsheet.dimension.end.row; int totalcols = excelsheet.dimension.end.column; (int j = 1; j <= totalcols; j++) { dt.columns.add(); (int = 1; <= totalrows; i++) { if (j == 1) { dt.rows.add(); } try {

angular - Ionic 3 - Cannot navigate to any page that calls HTTP in its constructor -

i working on ionic 3 project, , have been trying use ionic native's http ( https://ionicframework.com/docs/native/http/ ). started out creating separate provider used http, page imported provider wouldn't load / navigated to. didn't understand this, tried use directly on page itself, instead of creating provider. after troubleshooting, realized issue occurred whenever http called in constructor. there no error being thrown when run console logs. here code: import { component } '@angular/core'; import { ionicpage, navcontroller, navparams } 'ionic-angular'; import { locationtracking } '../../providers/location-tracking'; import firebase from'firebase'; import { http } '@ionic-native/http'; @ionicpage() @component({ selector: 'page-ad', templateurl: 'ad.html', }) export class adpage { postid = 0; imgurl: any; testtobesent: any; childref: any; zipcode: any; constructor(public navctrl: navcontrol

c# - Monogame collision bug -

Image
i began create platformer monogame , c# , got strange bug ground collision. made block , player, both use bounding collisions this: public rectangle collision { => new rectangle((int)_pos.x, (int)_pos.y, _w, _h); } //only player entity public rectangle groundcollision { => new rectangle((int)_pos.x, (int)_pos.y+_w, _w, 1); } it works good, though space appears space ply , ground so: . both block , player textures white, distance in 1 pix visible. after jumps (sometimes movement) may fix it, though after began hover again. here player update code: public void update() { if (_movable) { vector2 oldpos = _pos; _pos += new vector2(_vel, -_acc); if(_pos.y >= 96) { bool c = collides; } if (grounded) { _pos += new vector2(0, _acc); _acc = 0; } /*if (collides) { _pos = oldpos; }*/ } } //entity methods protected void

colors - How can i customize the CSS of a Bootstrap Theme template without adding an extra stylesheet? -

i’m trying customize blog bootstrap template. doesn’t seem work. have done couple of changes far worked great. changing bg, adding logo nav bar, adding hidden/visible classes etc: <nav class="navbar navbar-default navbar-custom navbar-fixed-top"> <div class="container-fluid"> <!-- brand , toggle grouped better mobile display --> <div class="navbar-header page-scroll"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">toggle navigation</span> menu <i class="fa fa-bars"></i> </button> <a class="navbar-brand visible-xs visible-sm" href="#" font-fa>randomood </a> <a class="navbar-brand" href="index.html

android - Unable to setprop - avc denied? -

i trying setup firebase debug mode app on samsung s7 , couldn't adb shell setprop firebase.analytics.debug-mode com.roostertech.net.app avc: denied { set } property=firebase.analytics.debug-mode pid=19845 uid=2000 gid=2000 scontext=u:r:shell:s0 tcontext=u:object_r:default_prop:s0 tclass=property_service permissive=0 randomly tried set other property , denied well avc: denied { set } property=log.wtf pid=21107 uid=2000 gid=2000 scontext=u:r:shell:s0 tcontext=u:object_r:log_prop:s0 tclass=property_service permissive=0 avc: denied { set } property=firebase pid=21086 uid=2000 gid=2000 scontext=u:r:shell:s0 tcontext=u:object_r:default_prop:s0 tclass=property_service permissive=0 but property log.tag.fa can set fine adb shell setprop log.tag.fa verbose i couldn't find documentation on allowed properties can set?

c# - Passing parameters to a listener through a delegate inside a loop doesn't seem to work -

this question has answer here: captured variable in loop in c# 6 answers unrolled loop works, loop not work [duplicate] 1 answer i'm trying add listener bunch of buttons have in array. function i'd call receives gameobject , original onclick listener doesn't, pass gameobject function playerbuttonclickedhandler wrapping call in delegate: for (int = 0; < characterbuttons.length; ++i) { characterbuttons [i].onclick.addlistener (delegate() { playerbuttonclickedhandler (characters [i]); }); } that's advice got here: https://forum.unity3d.com/threads/how-to-addlistener-featuring-an-argument.266934/ but doesn't work, i've been debugging , i'm initializing listeners passing characters[8]. and following working, ugly hell:

javascript - Get sound frequency with web Audio API -

i real time frequency of sound not work. here code: navigator.getusermedia({audio:true,video:false}, function (stream) { document.queryselector("#music").src = window.url.createobjecturl(stream) document.queryselector("#music").play() var contexteaudio = new (window.audiocontext || window.webkitaudiocontext)(); var analyseur = contexteaudio.createanalyser(); source = contexteaudio.createmediastreamsource(stream); source.connect(analyseur); var tab = new float32array(); (var i=0;i<=100;i++) { var datas = analyseur.getfloatfrequencydata(tab); document.queryselector("#datas").innerhtml = tab[i]; } }, function(error) { console.log(error) }) you can test here: https://jsfiddle.net/2tzduxak/1/ why can't float value of real time frequency microphone based ? value undefined....

sql - Are there any suggestions for replacing specific characters in MariaDB tables, and table columns? -

i'm having difficulty replacing " ". understand mariadb's sql syntax allows replacing characters (via string); i've attempted so, continues giving me same error of not recognizing structure of syntax. on side note, aware of functions, triggers, , or modules allow autonomous alteration of table, columns, enable/permit/allow name changing, when table's created? (from comment) alter table xover_sao modify column 'abell object' 'xover_sao_object' varchar(255); -: alter table xover_sao modify 'abell object' 'xover_sao_object' varchar(255); -: alter table xover_sao modify 'abell object' replace('abell object', ' ', '' ); -: alter table xover_sao modify 'abell object' replace('abell object', ' ', '' ); modify not allow changing name. no expressions allowed col_

Patch .NET app to run hidden (splash screen/main window) using Reflector/Reflexil -

im trying modify program run hidden, no splash screen , no window (it's free app canon cameras receive images on wifi). i use live slideshow, every time camera reconnects, program launched , splash screen , app windows put in front of slideshow. programs needs no interaction, run in background. (it's program receive images, needs running) i'm bit familiar basic patching ollydbg, .net app, it's way on head. i tried using apps patch on launch startupinfo make app window hidden, splash screen still shown, , program controlled via 1 detects camera , launch appropriate parameters, needs run hidden "on it's own" reflector/reflexil seems powerful enough able need, don't know enough find function/call/parameter make whole app hidden. if can point me in right direction... in advance! obs: file, in case want take look: http://www111.zippyshare.com/v/gmvozk1h/file.html if trying achieve preventing eos utility automatically launching when

Replace classname into CSS with SASS -

i've got several class names , 99% identical - except background image. classname matches image filename: example (see .icon_hero_rank-19): .brawler .rank.icon_hero_rank-19 { background-image: url("/images/ranks/icon_hero_rank-19.png"); position: absolute; top: 85%; left: 0; width: 40px; height: 45px; line-height: 45px; background-size: contain; display: inline-block; text-align: center; font-weight: normal; vertical-align: middle; font-family: "brawlstarsdeputy"; color: white; font-size: 1.5rem; text-shadow: 0px 3px 2px rgba(0, 0, 0, 0.8); letter-spacing: 1px; z-index: 10; } the question: so there way reuse class name variable in css or recommend? one can use predefined variable names selectors , css properties this: $icon-list: ( icon_hero_rank-00, icon_hero_rank-19 ); @each $icon in $icon-list { .brawler .rank.#{$icon}{ background-image: url(&qu

angular - How to retrieve token as string from storage (string.split error) -

i keep getting string.split error trying issued @ time using jwthelper jwtheler.decodetoken(token).iat . how can retrieve token as string instead of promise? this when log token t {__zone_symbol__state: null, __zone_symbol__value: array(0)} __zone_symbol__state:true __zone_symbol__value:"eyj0exaioijkv1qilcjhbgcioijiuzi1nij9.eyjzdwiioiizmjkilcjpc3mioijodhrwolwvxc9wcm9qzwn0cy5zdgfybgluzxdpbmrvd3muy29txc9yzwzyzxnoiiwiawf0ijoxntaxmty refresh function public schedulerefresh() { let source = this.authhttp.tokenstream.flatmap( token => { console.log("token=", token); let jwtiat = this.jwthelper.decodetoken(token).iat; let jwtexp = this.jwthelper.decodetoken(token).exp; let iat = new date(0); let exp = new date(0); let delay = (exp.setutcseconds(jwtexp) - iat.setutcseconds(jwtiat)); return observable.interval(delay); }); this.refreshsubscription = source.subscribe(() => { th

Is there a C++ equivalent to Rust's `std::mem::drop` in the standard library? -

the function std::mem::drop in rust moves argument , destroys going out of scope. attempt @ writing similar function in c++ looks this: template <typename t, typename = std::enable_if_t<std::is_rvalue_reference<t &&>::value>> void drop(t &&x) { t(std::move(x)); } does such function exist in standard library? edit: function can used invoke destructor of object before going out of scope. consider class closes file handle destroyed, not earlier. sake of argument, suppose ofstream did not have close method. can write: ofstream f("out"); f << "first\n"; drop(move(f)); // f closed now, , flushed disk c++'s standard library has no such function. however, can accomplish same effect idiom: sometype var = ...; //do stuff `var`. {auto _ = std::move(var);} //the contents of `var` have been destroyed. as pointed out in comments, c++ lacks rust's ability prevent further using var . content

javascript - Resizing iFrames based on its contents' height only working to enlarge? -

take @ attached codepen see mean. try reducing width of browser, frame should correctly resize. maximize browser window , note frame doesn't re-adjust height. i have multiple frames stacked ontop of each other quite annoying issue. i've tried using .height(), .outerheight(), .innerheight(), .scrollheight , .clientheight no avail. https://codepen.io/anon/pen/gxalpw var newheight = $('#frame').contents().height(); $('#frame').attr('height', newheight); thanks in advance any/all help! try this function resizeframe() { var newheight = $('#frame').contents().find("body").height(); $('#frame').attr('height', newheight + 20); }

Reliable method for numbering Tmux panes -

i trying create complicated layout. i've found following commands @ shell produce layout want: tmux split-window -t 0 -h tmux resize-pane -t 0 -x $((80*2+1)) tmux split-window -t 0 -v tmux resize-pane -t 1 -y 24

In Rails 5, is setup called each time test is run? -

let's have code below in model test. def setup @object = object.new(name: "test") end test "test 1" @object.age = 25 assert @object.valid? end test "test 1" ... end ... is setup method called before each test done or called once , proceeds run tests? the setup method run before each test case. minitest documentation says: runs before every test. use set before each test run.

elasticsearch - Why there are empty spaces along the edges of the visualization? -

Image
why empty spaces added each visualization created using visual builder? the interval everywhere used 5 minutes. period used display data not important since observed @ period. example

Associate primarycontactid to Case-Dynamics CRM web API -

i trying create case , associate contact in primarycontactid field. using alternate key contact below. post https://xxxxx.crm.dynamics.com/api/data/v8.2/incidents http/1.1 accept: application/json odata-maxversion: 4.0 odata-version: 4.0 content-type: application/json; charset=utf-8 host: xxxxxx.crm.dynamics.com content-length: 161 { "title": "case101", "primarycontactid@odata.bind": "https://xxxxx.crm.dynamics.com/api/data/v8.2/contacts(xxi_xxx='2533274975913147')" } code below using (httpclient httpclient = new httpclient()) { var method2 = new httpmethod("post"); uri requesturi = new uri(string.format("{0}/api/data/v8.2/", url)); httpclient.baseaddress = requesturi; httpclient.timeout = new timespan(0, 0, 4); // 10 minutes httpclient.defaultrequestheaders.accept.clear(); httpclient.defaultreque

c++ - Qt - record from .cvs file causing errors when pushed into vector -

i writing program fills qtableview data cvs file. pushing data vector of objects class. want able catch record file may cause out of bound error , move onto next line without adding record table or vector. here function populates table: qstring filename = "currentstudents.csv"; qfile file(filename); file.open(qiodevice::readonly); int lineindex = 0; qtextstream input(&file); while (!input.atend()) { std::vector<qstring> newrecord; qstring fileline = input.readline(); qstringlist linetoken = fileline.split(",", qstring::skipemptyparts); (int = 0; < linetoken.size(); i++) { qstring value = linetoken.at(i); newrecord.push_back(value); //this line out of bounds error comes qstandarditem *item = new qstandarditem(value); currentstudentsmodel->setitem(lineindex, i, item); } try { //creating student object information parsed file currentstudent student(newre

ubuntu 16.04 - Why can't git post-receive hook find single file in repo? -

i have git post-receive hook #!/bin/sh git --work-tree=/var/www/myproject --git-dir=/home/git/myrepo.git checkout -f -- api.py and local repo contains .git folder , api.py file. when push project following error: $ git push counting objects: 3, done. delta compression using 4 threads. compressing objects: 100% (2/2), done. writing objects: 100% (3/3), 272 bytes | 0 bytes/s, done. total 3 (delta 1), reused 0 (delta 0) remote: error: pathspec 'myrepo/api.py' did not match file(s) known git. i have tried adding full file path myrepo/api.py git hook , gave same error path. what correct way reference file i'm trying move? remote computer ubuntu 16.04. thanks! replace checkout git status see if on right branch. try specify branch: git --work-tree=/var/www/myproject --git-dir=/home/git/myrepo.git checkout master -f -- api.py

libavcodec - FFMPEG decoding too slow (avcodec_send_packet() / avcodec_receive_frame()) -

i'm using ffmpeg libraries decode, scale, , re-encode video within mpeg transport stream. i've recompiled source v3.3.2 , changed old avcodec_decode_video2() api new send/receive api. both old , new apis decode video slowly. 25 fps video = 1 frame every 40ms. however, see 70 120ms per frame decode. file translator need run faster real time. the code outline below. have ideas on how improve decoding speed? there other posts deprecated avcodec_decode_video2() being slow; none of resolved. new api doesn't run faster... gettimeofday(&tv1, null); int rc = av_read_frame(pformatcontext, pespacket); gettimeofday(&tv2, null); int ret = avcodec_send_packet(pdecodercontext, pespacket); if (ret < 0) continue; ret = avcodec_receive_frame(pdecodercontext, pframedec); if (ret != 0) { printf("avcodec_receive_frame error: %d\n", ret); continue; } gettimeofday(&tv3, 0); u_long twominusone = (tv2.tv_sec - tv1.tv_sec) * 1000000 + tv2

vbscript - Get Target Path of Shortcuts to Recycle Bin or Control Panel -

the following code gets target path of regular shortcuts. set objshell = wscript.createobject("wscript.shell") set objshelllink = objshell.createshortcut(wscript.arguments(0)) set objfso = createobject("scripting.filesystemobject") strtargetpath = objshelllink.targetpath if (objfso.fileexists(strtargetpath)) ' link file. set objf = objfso.getfile(strtargetpath) else ' link folder. set objf = objfso.getfolder(strtargetpath) end if strfoldertoopen = """" & objf.parentfolder & """" stritemtoselect = """" & objf.name & """" the objshelllink.targetpath shortcuts (e.g recycle bin.lnk , control panel.lnk ) empty. how can target path of shortcuts?

java - How to access request from ui to database -

if database accept 20 requests @ same time, in ui, have 100 requests @ same time. how resolve in java? your query should this: select * table1 ... fetch first 100 rows only or you can use logic maxactive: maximum number of db connections in pool. set -1 no limit. maxidle: maximum number of idle db connections retain in pool. set -1 no limit. maxwait: maximum milliseconds wait db connection to become available. set -1 wait indefinitely.

linux - Parse json into array in bash -

{ "db_status": { "sysa": { "taskname": "ab", "state": "running", "status": "system attention", "updated": "0727", "version": "5" }, "sysb": { "taskname": "null", "state": "standby", "status": "system ok", "updated": "0727", "version": "6" } } } curl command returns json object. trying both state variables in array i.e. running , standby. far have tried curl -s http://localhost:9099/api | grep state | sed 's/"//g' | awk -f ": " '/state/ {print $2}' | tr '\n' ' ' | sed s'/..$//' you use jq $ curl -s http://localhost:9099/api | jq

c# - MongoDB .NET exception: Unsupported filter -

i using .net wrapper mongodb (refer following excerpt packages.config versions): <package id="mongocsharpdriver" version="2.4.2" targetframework="net461" /> <package id="mongodb.bson" version="2.4.2" targetframework="net461" /> <package id="mongodb.driver" version="2.4.2" targetframework="net461" /> <package id="mongodb.driver.core" version="2.4.2" targetframework="net461" /> i trying build simple filter obtain items of location's latitude , longitude within limits defined latitudedelta , longitudedelta. bool filterall = string.isnullorempty(username) || username == "*"; var filter = builders<models.mapquery>.filter.where(p => (filterall || (username == p.creatorusername)) && math.abs(p.pinlocation.latitude - desiredlatitude) < latitudedelta && math.abs(

html5 - How to change title, description and image in your feed using Facebook instant articles? -

can me on how change title, description , image on feeds using facebook instant article.. tried embed meta tags inside head tags on production articles code(html5) still not working. can me please thank , godbless, way here meta tags inputted inside head tags. <head> <meta charset="utf-8"> <meta property="og:type" content="article"> <link rel="canonical" href="http://test.pagodecaridad.com/"> <link rel="stylesheet" title="pago de caridad" href="#"> <meta property = "fb:article_style" content="pagostyle"> <meta property="og:image" content="http://www.fightersgeneration.com/nz3/game/sf5-ryu-key-artwork.jpg"/> <meta property="og:title" content="pago de caridad"> <meta property="og:description" content="the newest , esiest way donate , registered charities"> <title

express - Mongoose not $setting array.$.booleanValue when I findOneAndUpdate({paramOne: p, paramTwo, array.keyName: valueName}) -

i'm trying update boolean value in object that's in array in mongo document mongoose through app.post("/api/post/:chorecomplete", function(req, res){ parent.findoneandupdate({parentfirstname: req.body.parentfirstname, parentlastname: req.body.parentlastname, "chores.chorename": "firstchore"}, {$set: {"chores.$.complete": "true"}}).exec(function(err, doc){ if (err){ console.log(err); res.send("not ok");} else{ console.log(doc);`enter code here` res.send(ok); } }) }) } my server logs mongoose response, not because i'm telling too. commented out console.log(doc) , tested see if db returning or server logging it. thing is, server responds "ok" meaning mongoose not throwing error, isn't modifying post /api/post/chorecomplete 200 17.378 ms - 2 [1] {

Kernel panic caused by pcre being removed from Redhat -

i did big mistake on server, removed pcre redhat server 5 , after nothing worked, no commands, ssh, kernel panic - nothing. i succeed enter in rescue mode live cd , in chroot. able see logical volume don't have /etc/fstab there. what can bring server, modify /etc/fstab? maybe if install pcre server bring up. i have typed "yum remove pcre" , uninstalled dependencies.. dunnno why.. answer question, cannot install scratch, have lot of data, backups there , loose it.

rest - Is it mandatory to use Drools KIE execution server to fire a rule? -

all, mandatory use drools kie execution server fire rule ? passing required data rules jar standalone approach instead of rest ? there no need @ use kie execution server, no. following drools' user guide can learn how create kie container in java , how kie session it. for example, if have rules in classpath, can try this: kieservices kieservices = kieservices.factory.get(); kiecontainer kcontainer = kieservices.getkieclasspathcontainer(); kiesession ksession = kcontainer.newkiesession(); applicant applicant = new applicant( "mr john smith", 16 ); ksession.insert( applicant ); ksession.fireallrules(); once have session, can start feeding facts , exercising rules. hope helps,

php - I can't access the website project in the folder www on wamp -

i building website using wordpress on local wamp. running perfect when go through server computer. but, when trying access other device connected on network lan, work. but, browser brings text link without border, background, images etc on project. what should do? that's because setting urls http://localhost , try changing links machine's ip address. http://192.168.1.101 example edit the browser shows texts no styles because fails load assets, , that's because setting base url localhost.

tomcat - Error while deploying WAR in Jenkins -

i below error when trying deploy war using jenkins. started user anoop [envinject] - loading node environment variables. building in workspace c:\users\anoop\.jenkins\workspace\automateddeploymenttest deploying c:\users\anoop\.jenkins\workspace\automateddeploymenttest\sample.war container tomcat 7.x remote error: build step failed exception org.codehaus.cargo.container.containerexception: failed redeploy [c:\users\anoop\.jenkins\workspace\automateddeploymenttest\sample.war] @ org.codehaus.cargo.container.tomcat.internal.abstracttomcatmanagerdeployer.redeploy(abstracttomcatmanagerdeployer.java:189) @ hudson.plugins.deploy.cargocontaineradapter.deploy(cargocontaineradapter.java:73) @ build step 'deploy war/ear container' marked build failure finished: failure please me fix issue. in conf/tomcat-user please add following : <user username="anoop" password="yourpassword" roles="manager-script"/> in jenkins please add follo

Must PHPUnit require Composer\Autoload\ClassLoader.php? -

trying integrate phpunit , ide (phpstorm 2017.2). i'm executing phpunit.phar file directly (version 5.7.21) don't use composer , don't have installed. phpunit.xml <phpunit bootstrap="phpunit-bootstrap.php"> <testsuites> <testsuite name="test suite"> <directory>./</directory> </testsuite> </testsuites> </phpunit> phpunit-bootstrap.php spl_autoload_register('my_autoload'); /** * @param string $classname qualified name autoload */ function my_autoload($classname){ require $_server['document_root'] . "\\$classname.php"; } this autoloader works fine when execute project files. when try run phpunit test, see error: fatal error: require(): failed opening required '\composer\autoload\classloader.php' if remove autoload, project classes can no longer found (same error, different class name). does phpunit depend on

meteor - Angular 2 could not load component till an action was triggered -

Image
i have problem when trying create routers app, it's using angular 2 , meteor. let's come point: see, router in fanpages, pre component removed, no new component loaded :| it load fanpages component when move mouse or click on page so, what's fault? or thing went wrong? thanks!

Google Dataflow stalled after BigQuery outage -

i have google dataflow job running. dataflow job reading messages pub/sub, enrich , write enriched data bigquery. dataflow processing approximately 5000 messages per second. using 20 workers run dataflow job. yesterday seems there bigquery outage. writing data in bigquery part failed. after time, dataflow stopped working. see 1000 errors below (7dd47a65ad656a43): exception: java.lang.runtimeexception: com.google.api.client.googleapis.json.googlejsonresponseexception: 400 bad request { "code" : 400, "errors" : [ { "domain" : "global", "message" : "the project xx-xxxxxx-xxxxxx has not enabled bigquery.", "reason" : "invalid" } ], "message" : "the project xx-xxxxxx-xxxxxx has not enabled bigquery.", "status" : "invalid_argument" } com.google.cloud.dataflow.sdk.util.bigquerytableinserter.insertall(bigquerytableinserter.java:285) com.goog

Encountering error: /qt-unified-linux-x86-2.0.5-2-online.run: No such file or directory -

i downloaded @ x86-2.0.5-2 (32 bit) online installer quote website. after downloading changed permission of executable , run quote-unified-linux-x86-2.0.5-2-online. running using terminal. getting error bars: ./qt-unified-linux-x86-2.0.5-2-online. run: no such file or directory. using ubuntu x86_64 machine. cause of error. please me. in advance.

java - Google Storage API: Could not get access token -

i trying migrate google app engine standard environment application google endpoints 2.0 , facing following issue on local development server testing: i using gae sdk version 1.9.54 , endpoint framework version 2.0.7, , endpoint management version 1.0.4. google-cloud-storage 1.2.0 i have set application default credentials: gcloud auth application-default login [info] gcloud: severe: exception occurred while calling backend method **[info] gcloud: com.google.cloud.storage.storageexception: not access token.** [info] gcloud: @ com.google.cloud.storage.spi.v1.httpstoragerpc.translate(httpstoragerpc.java:189) [info] gcloud: @ com.google.cloud.storage.spi.v1.httpstoragerpc.get(httpstoragerpc.java:335) [info] gcloud: @ com.google.cloud.storage.storageimpl$5.call(storageimpl.java:191) [info] gcloud: @ com.google.cloud.storage.storageimpl$5.call(storageimpl.java:188) [info] gcloud: @ com.google.api.gax.retrying.directretryingexecutor.submit(directretryingexecutor.java:93) [in

javascript - How to get top,left,right,bottom value using x and y axis value with react-draggable? -

i new react.js wanna build dragging feature react-draggable giving x , y axis.but need top,left,right,bottom value don't know how that my try handleondrag(e,data,id){ // don't know console.log(e,data) } ... <draggable ondrag={(e,data) => this.handleondrag(e,data,id)} key={i} > <p>i draggable</p> </draggable> ...

sql server - SQL DISTINCT for 2 Columns WHERE 3rd column = value -

i'm trying select count of distinct columns col 1 & col 2 col 3 = "complete". firstly don't know how make distinct apply col 1 & col 2 opposed distinct own columns. secondly how exclude col 3 distinct.. select count(*) count (select distinct dp, rn ecount et = 'complete') rows any thoughts? example col1 col2 col3 dp01 rn01 complete yes dp01 rn02 incomplete dp02 rn03 complete dp02 rn03 incomplete dp01 rn04 complete yes dp02 rn05 complete yes dp03 rn06 incomplete result = 3 i don't think need include column 3 (aka, col et ) in select part, can use in where statement directly. so in example: select count(*) count (select distinct dp, rn ecount et = 'complete' ) rows

jquery - Create alert message on closing popup window (Javascript) -

i have created code open youtube video in popup few seconds. working in code. need give alert user if he/she going close popup window. problem popup window not related parent window, how can close it? here code using $(document).ready(function() { var mywindow; $("#idview").click(function() { var vidurl = 'www.youtube.com'; counter(); mywindow = window.open(vidurl, "popupwindow", "width=600, height=400, scrollbars=yes"); }); function counter() { var n = $('.c').attr('id'); var c = n; $('.c').text(c); setinterval(function() { c++; if (c <= 41) { $('.c').text(c); } if (c == 41) { $('.c').text(n); } }, 1000); } setinterval(function() { mywindow.close(); }, 45000); window.onbeforeunload = closingcod

How to get a list of filenames(without extension) in directory in python? -

assume folder structure +data -abc.jpg -db.jpg -ap.jpg input 'path/to/data' expected output ['abc','db','ap'] i saw many similar questions did not wanted. prefer use os module in python. import os files_no_ext = [".".join(f.split(".")[:-1]) f in os.listdir() if os.path.isfile(f)] print(files_no_ext)

json - Swift 3 - Can not use array made Alamofire request -

hoping can me! working on 1 while now. problem can not use data in uitableviewcontroller received alamofire request. request want put in struct in alamofire request. in end can not use information put in array. looks array keeps empty outside function. tried make closure, receive table in viewdidload request, still can not use outside one. i have structure in swift file called section: struct mijnproducten { var productname : string! var productdesc : string! var expanded : bool! init(productname: string, productdesc: string, expanded: bool) { self.productname = productname self.productdesc = productdesc self.expanded = false } } uitableviewcontroller looks this: array made: var mijnproducten01 = [mijnproducten]() below fund alamofire request: func getuserproperty(completion: @escaping ([mijnproducten]) -> void) { alamofire.request(url_user_property, method: .post, encoding: jsonencoding.default) .responsejso

xpath - Is it possible to use Following and preceding in combination in Selenium? -

Image
on page https://en.wikipedia.org/wiki/trinity_seven#episode_list have: //*[text()='reception']//preceding::th[contains(@id, 'ep')]//following::i but registers following. the default firepath selector is: .//*[@id='mw-content-text']/div/table[5]/tbody/tr/td[1]/i kind of selector known break quite frequently. wondering if there better way of doing , thought might way. thanks! :) - can see it's getting stuff under table not want :s try use below xpath match required elements: //th[contains(@id, 'ep')]/following::i[./following::*[text()='reception']]

VBA Excel Index out of range -

i have written vba code converting csv file array , analysing in excel. code functioning of sudden getting error 1004, says method 'cells' object global failed. , highlighting line "cells(j, 15).value = strrow1(0)" below code. please if help sub lithium() dim mydata string, strdata() string dim pathinit string dim integer dim z long, filecount long ' opening txt file dim mytxt mytxt = application.getopenfilename("csv files (*.csv), *.csv") open mytxt binary #1 mydata = space$(lof(1)) #1, , mydata close #1 strdata() = split(mydata, vbcrlf) dim strrow1() string dim strrow2() string dim strrow3() string dim strrow4() string dim strrow5() string dim strrow6() string dim ncount integer ncount = 1 dim nrowlenth integer nrowlenth = ubound(strdata) - lbound(strdata) ' length of total data array j = 3 = 16 nrowlenth strrow1() = split(strdata(i), ";") cells(j, 15).value = strrow1(0) cell

c# - Implementing ASP.NET Web API Optional Parameters -

i need ability distinguish between key not being supplied , null. an example of json be: # key not specified {} # key specified null {'optionalkey' : null} # key specified , valid {'optionalkey' : 123} to distinguishable between key's absence , null, i've created generic optional class wraps each field, requires writing custom jsonconverter , defaultcontractresolver flatten json / unpack optionaltype (sending nested json each field not option). i've managed create linqpad script can't thinking there must easier way doesn't involve reflection? void main() { //null settings settings = null; jsonconvert.serializeobject(settings, new jsonserializersettings() { contractresolver = new shouldserializecontractresolver() }).dump(); settings = new settings(); // no key {} settings.optionalintegersetting = null; jsonconvert.serializeobject(settings, new jsonserializersettings() { contractresolver = new shouldseria

sql server 2008 - Difference between two (2) dates/times. Returns negative values -

i want minute difference between 2 dates/times my query is select datediff(minute,'2017-06-06 16:01:59','2017-06-06 15:49:25') minutes_difference table1 'show table1 rows select * table1 but getting negative value minute_difference = -12 here screenshot please tell me what's wrong query. thanks! just reverse last 2 arguments.

excel - VBA: Array & countif -

Image
all, i struggling on approach take following case in excel vba: from different sheets created array in vba (4 columns: key, type, date of activity a, date of activity b), e.g.: i decided not use dictionary, because size of array (the # of cars) given. didn't use simple copy-paste macros + countif. first of all, agree array in vba best approach? now want have summarized results per activity in table this: so struggling best approach is: 1) looping on lines in array , paste values 1 one in table 2) looping on cells in table , find corresponding cars 3) copying separate sheet , use countif in table 4) ... could please in advising? problem clear. add helper columns in (you can hide these later if wish) in cell d2 formula =month(c2) , cell e2 =year(c2) , same g , h on column f then in result table i've used formula =countifs($b$2:$b$4,$a8, $d$2:$d$4,month(b$7),$e$2:$e$4,year(b$7)) for activity a, same formula can used activity b (but using

node.js - Can not set headers error - on file content change -

i new node.js , having issues while coding it i using node.js , express following code : var express = require('express'); var app = express(); var fs = require('fs'); var filepath = 'answer2.txt'; var file = fs.readfilesync(filepath); app.get('/', function (req, res) { fs.watch(filepath, function(event, filename) { if(filename){ file = fs.readfilesync(filepath); //console.log('\n' + file); return res.send('\n' + file); } else{ console.log('filename not provided') } }); }); var server = app.listen(8000, function () { console.log("example app listening"); }); purpose of code : content of file answer2.txt changes , saved, should reflect new content on webpage without refreshing page. functionality working console browser, throws following error : _http_outgoing.js:357 throw new error('can\'t set headers after sent.'); ^ error: can't set header

jquery - Javascript Uncaught TypeError: showcreate1 is not a function -

i read before write questions other questions nothing work, check javascript loaded, try use jquery used $ nothing.. my problem ajax isn't working, error title question. i have views, menu.blade.php code: @extends('cms.public.layouts.default') @section('content') <div class="col-md-10"> <h3 style="letter-spacing:40px;text-align:center;color:f15d5e;">proyectos</h3> </div> <div class="col-md-2" style="padding:20px;"> <button type="button" id="buttoncreate" class="btn btn-danger">crear proyecto</button> </div> <div class="col-md-12" id="ajaxwindow"> </div> <script> $(document).ready(function(){ listproject(); $("#buttoncreate").click(function(e){ $("#buttoncreate").remove(); e.preventdefault(); listuploadproject(); }); });