Posts

Showing posts from February, 2010

vert.x - Read large file using vertx -

i new using vertx , using vertx filesystem api read file of large size. vertx.filesystem().readfile("target/classes/readme.txt", result -> { if (result.succeeded()) { system.out.println(result.result()); } else { system.err.println("oh oh ..." + result.cause()); } }); but ram consumed while reading , resource not flushed after use. vertx filesystem api suggest do not use method read large files or risk running out of available ram. is there alternative this? the reason internally .readfile calls files.readallbytes . what should instead create stream out of file, , pass vertx handler: try (inputstream steam = new fileinputstream("target/classes/readme.txt")) { // handling here }

pagination - VueJS: changing number of paginate values? -

my problem is: i'm trying pagination function datatable, works fine when change limit of items in table, total of pages doesn't update. how can proceed? have filter: filters: { paginate: function(list) { this.resultcount = this.movimientos.length; if (this.currentpage >= this.totalpages) { this.currentpage = math.max(0, this.totalpages - 1); } var index = this.currentpage * this.upperlimit; return this.movimientos.slice(index, index + this.upperlimit); } } and here i'm calculating number of pages computed: { totalpages: function() { return math.ceil(this.resultcount / this.itemsperpage); } }, methods: { setpage: function(pagenumber) { this.currentpage = pagenumber; }, <div v-for="pagenumber in totalpages" class="c-paginacao__select"> <a href="#" v-on:click.prevent="setpage(pagenumber)...

android - Analogue of LD_DEBUG for zygote-spawned process -

i'm wondering if android has option user enable ld_debug -style logs zygote-spawned processes. can not start app_process zygote customized environment without being root user. maybe there system property or maybe kind of linker api allow dynamic linker logs debuggable android package may contain native libraries. aiui there isn't way on un-rooted device until o. starting o, can add wrap.sh (debuggable) apk things this. don't think have docs published yet, it's sort of described here: https://github.com/android-ndk/ndk/issues/380#issuecomment-314223774

android - SQLite CursorWindow limit - How to avoid crash -

i have execute query , store result in list, function use follow : list<spoolindb> getspoolinrecords(string label, boolean getlastinserted) { list<spoolindb> spoolinlist = new arraylist<>(); try { if (mdb == null) mdb = mdbhelper.getwritabledatabase(); sqlitequerybuilder qb = new sqlitequerybuilder(); qb.settables(table_spoolin); cursor c = qb.query(mdb, null, " label='" + label + "'", null, null, null, " dateins " + (getlastinserted ? "desc" : "asc")); if (c != null) { c.movetofirst(); if (c.getcount() > 0) { int ndxid = c.getcolumnindex("id"); int ndxserverid = c.getcolumnindex("serverid"); int ndxlabel = c.getcolumnindex("label"); int ndxvalue = c.getcolumnindex("value"); int ndxpriority = c.getco...

javascript - Get Transcrypt to output readable files -

i'm trying translate following test code transcrypt: class a(object): def __init__(self): self.a = 5 the output 2447 line file: $ transcrypt test.py -fb -e 6 $ wc -l __javascript__/test.js 2447 __javascript__/test.js how can transcrypt generate sane output input? thanks file test.js has got whole runtime lib in it. @ module file instead, it's called test.mod.js , has code 1 module. can reduce size further using -xc compiler switch. if e.g. take at: http://www.transcrypt.org/live/turtle_site/turtle_site.html and change program, e.g. change 'red' 'pink' , , press [compile , run] , module file thing that's reloaded. that's why response fast.

amazon web services - AWS Lambda Java how to read properties file -

i try load properties properties class file. expect solution work: how load property file classpath in aws lambda java i have class few static methods , want use config holder. inside there line final inputstream inputstream = config.class.getclass().getresourceasstream("/application-main.properties"); and returns null. downloaded zip package lambda using , file inside in root. not work nevertheless. anyone had similar issue? edit: config file here: project └───src │ └───main │ └───resources │ application-main.properties edit: "temporary" workaround looks that: // load props classpath... try (inputstream = config.class.getresourceasstream(filename)) { props.load(is); } catch (ioexception|nullpointerexception exc) { // ...or filesystem file file = new file(filename); try (inputstream = new fileinputstream(file)) { props.load(is); } catch (ioexception exc2) { thr...

Http get request on kerberos cluster in scala -

i using following code connect livy server running on kerberized cluster using scala. $scala -cp scalaj-http_2.11-2.3.0.jar -djava.security.auth.login.config=jaas.conf scala>import scalaj.http.http scala> system.setproperty("java.security.krb5.conf", "jaas.conf"); res0: string = null scala> http("http://ipaddress:8998/sessions").asstring throws access denied response server. is there way in scala connect kerberized cluster http requests.

openstreetmap - Build interactive map from python -

i trying build webpage showing interactive map (taking 100% of page) present points or lines information. plotly seems perfect , visualization not have support maps such open street map built in, uses mapbox this. don't have against mapbox, can find free of charge numbers of views (while uses osm). simply said: there easy (as open source , free use) way using python build such webpage map shows information?

ruby on rails - How do I test with Rspec an initialize method that invokes find_or_initialize_by? -

how write test check find_or_initialize_by block in initialize method? def initialize(document, user) @document = document @api = @document.api_version @template = @document.template @user = user @brand = @user.brand @vars = master_var_hash.extend hashie::extensions::deepfind template_variables.each |t| @document.template_variables.find_or_initialize_by(name: t.name) |d| d.name = t.name d.tag = t.tag d.box_name = t.box_name d.designator = t.designator d.order_index = t.order_index d.master_id = t.id d.editable = t.editable d.editable_title = t.editable_title d.html_box = t.box.stack.html_box if @api == :v3 d.text = t.name == 'title' ? default_title : user_value(t) end end end i want able test right values have been assigned @document 's templatevariables class' templatevariable s. in coverage report can't hit inside find_...

Android ListView don't smooth scroll using ViewHolder -

hello , sorry list view scroll issue, i'm implementing list view on android doesn't scrolls smoothly. have added viewholder pattern , have tried set textview row still doesn't work. , don't think i'm doing work on ui threat cause container activity have 3 static buttons. here adapter getview function: public view getview(int position, view convertview, @nonnull viewgroup parent) { viewholder holder; if (convertview == null) { // if it's not recycled, initialize attributes layoutinflater inflater = (layoutinflater) mcontext .getsystemservice(context.layout_inflater_service); // layout reference convertview = inflater.inflate(r.layout.row_search, parent, false); holder = new viewholder(); // reference layout holder.ivcolorsearch = convertview.findviewbyid(r.id.vi_color_search); holder.tvcolordesc = (textview) convertview.findviewbyid(r.id.tv_color_desc); h...

jspdf Checking pdf file size -

i want check pdf file size jspdf.js script. need display on screen before downloading file. there possibilities? function demofromhtml(x = false) { var pdf = new jspdf('p', 'pt', 'letter'); source = $('#print')[0]; specialelementhandlers = { '#bypassme': function (element, renderer) { return true } }; margins = { top: 80, bottom: 60, left: 40, width: 522 }; pdf.fromhtml( source, margins.left, margins.top, { 'width': margins.width, 'elementhandlers': specialelementhandlers ...

javascript - Highcharts not "graphing" in Firefox or Safari -

i'm having odd problem highcharts graph "graphing" on chrome. graph frame shows fine (the axis' names, labels, white background, etc), actual columns not animated, nor show on graph represent actual data. appears empty graph. the data being called via ajax. on end fine. code simple, not sure causing this. here code, appreciated: highcharts.chart('modal-graph-wrapper', { chart: { type: 'column' }, title: { text: 'build time vs. step' }, yaxis: { title: { text: 'length of time (seconds)' }, categories: timearray }, xaxis: { categories: namearray }, plotoptions: { series: { pointstart: 0 } }, series: [{ name: 'buil...

machine learning - which model is h2o.predict(aml@leader, test_df) using? -

after using automl generate aml leaderboard, ran h2o.predict(aml@leader, test_df) but how can know model on leaderboard using? , if want access structure or hyperparameter of model on leaderboard how can so? besides result on test set not 1 on validation set, common - did use wrongly or has tendency overfit? also want understand infrastructure better, after h2o.init data transmit server in h2o.ai's clusters or happen on local laptop? thanks. it's using "leader" model, #1 model on leaderboard, ranked default metric ml task (binary classification, multiclass classification, regression). leader model id here: aml@leader@model_id . the leader model, stored @ aml@leader , regular h2o model, if want @ parameters used, @ aml@leader@parameters parameters set, or aml@leader@allparameters parameter values (including ones did not set manually). the validation_frame used tune individual models via stopping, validation error overly-optimistic compa...

java - getApplicationContext() method getting error -

i android beginner, making simple service example. but in single code getapplicationcontext() method behaves differently, please check comment of mainactivity . mainactivity.java package com.avisingh.servicetest; import android.content.dialoginterface; import android.content.intent; import android.support.v7.app.alertdialog; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.view.view; import android.widget.button; public class mainactivity extends appcompatactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); final button alertbutton = (button)findviewbyid(r.id.alert_btn); alertbutton.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { alertdialog.builder builder = new alertdialog.builder(mainactivity.this); //if placing here getapplicationcontext() method ...

Oracle Home not recognized in Jupyter Notebook -

i using pyspark 3 notebook, , testing out functionality of cx_oracle . after installing package, oracle instant client, , point ld_library_path oracle libraries, import cx_oracle cleanly on local machine. once in notebook, added ld_library_path , oracle_home variables jupyter environment found new errors: databaseerror: dpi-1005: unable acquire oracle environment handle is there best practice setting oracle_home in jupyter notebook? thank you!

swift - Are there any relevant methods for finding the results of the find panel on NSTextView? -

in nstextview control, press command+f open find panel. after enter search content , click next, i'll find relevant text. have special requirement, is, after user finds result, want location of string found in nstextview . is there relevant method me?. i tried rewriting following method, nothing answered. func selectionrange(forproposedrange: nsrange, granularity: nsselectiongranularity) func setselectedrange(nsrange) func setselectedrange(nsrange, affinity: nsselectionaffinity, stillselecting: bool) func setselectedranges([nsvalue], affinity: nsselectionaffinity, stillselecting: bool)

javascript - How to redirect a page with header? -

i want redirect page modify post header. saw redirection header technically impossible. if send request node server header redirect page posting modify page, there's no way redirect page header without using multiple router (because router function rendering pug file, can't done @ same time)

javascript - Implement correlation id that is a 64 bit hex stiring -

i need implement random correlation id our http requests in our angular js 4 project. requirement should 64 bit hex string. currently, i'm using npm package https://www.npmjs.com/package/angular2-uuid implement uuid via let uuid = uuid.uuid(); how can ensure/convert uuid 64 bit hex string?

javascript - How to get textOperations and Get Result? -

i need "post" textoperations , use received value "get" , return results. i'm doing "post" not in console.log (), how "id" received , use in "get" return results? the api name is: microsoft face api my code: function handwriteentextapi(){ // chave de inscriÇÃo da api. var api_key = ""; // deve-se utilizar mesma região em que chave de escrição da api está // nota: chaves de inscrições de testes são geradas na região "westcentralus". var uribase = "https://westcentralus.api.cognitive.microsoft.com/vision/v1.0/recognizetext?"; // solicitar parâmetros de retorno json. var params = { "handwriting": "true" }; // mostra imagem recebida da url var sourceimageurl = document.getelementbyid("inputurlimage").value; document.queryselector("#imagereceived").src = sourceimageurl; // executa chamada da api restfull via a...

node.js - Passing data from one page to another using Node, Express & EJS -

i've got following routes set up: router.get('/', function(req, res) { res.render('index', {}); }); router.post('/application', function(req, res) { res.render('application', {twitchlink : req.query.twitchlink}); }); i've got 2 views set properly. this i've got in 'index' view: <form class="form-horizontal" action="/application", method="post", role="form"> <input type="url" name="twitchlink" required> <button class="btn btn-success">submit</button> </form> submitting form take me application view. <script>var twitchlink = <%- json.stringify(twitchlink) %></script> <script>console.log(twitchlink)</script> this should log out link submitted, right? however, these 2 lines: uncaught syntaxerror: unexpected end of input uncaught referenceerror: twitchlink not defined ...

java 8 - TestNG data provider with folder contents using lambda -

i want give list of file names through testng data provider, test can load each file. object[][] result = files.list(paths.get("tst/resources/json")) .filter(files::isregularfile) .map(filename -> new object[] { filename }) .toarray(object[][]::new); i've got point can build object[][] folder contents, testng throws exception: org.testng.internal.reflect.methodmatcherexception: data provider mismatch method: testfbtinka11interpretjson([parameter{index=0, type=java.lang.string, declaredannotations=[]}]) arguments: [(sun.nio.fs.windowspath$windowspathwithattributes)tst\resources\json\admin.json] @ org.testng.internal.reflect.dataprovidermethodmatcher.getconformingarguments(dataprovidermethodmatcher.java:52) ... it looks me @test method using data provider accepting file names string data provider providing file object , breaking. you have 2 options: you change @test method accept file object instead of...

pandas - Create a dictionary by grouping by values from a dataframe column in python -

i have dataframe 7 columns, follows: bank_acct firstname | bank_acct lastname | bank_acctnumber | firstname | lastname | id | date1 | date2 b1 | last1 | 123 | abc | efg | 12 | somedate | somedate b2 | last2 | 245 | abc | efg | 12 | somedate | somedate b1 | last1 | 123 | def | efg | 12 | somedate | somedate b3 | last3 | 356 | abc | ghi | 13 | somedate | somedate b4 | last4 | 478 | xyz | fhj | 13 | somedate | somedate b5 | last5 | 599 | xyz | dfi | 13 | somedate | somedate i want create dictionary with: {id1: (count of bank_acct firstname, count of distinct bank_acct lastname, {bank_acctnumber1 : itscount, bank_...

Bash - saving string to separate variable after custom delimiter -

i'm new bash please forgive me, i'm building bash script can accept user input command can have lot of switches. need write function pulls specific data user provided command. i can't seem find way pull each word after "-mode" , push array or list of sort. here example of user input command might like: /home/custom/function/that/accepts/a/billion/switches random_info random_info2 -worker vendor_schmo -switch_one -anotherone -more_switches -optiontwo -mode foo -mode bar -mode baz -mode bag -mode dat -mode rar i've tried fiddling awk -f "-mode" '{ print $1 }' , didn't work. advice appreciated!! here snippet script pulls info: manualrunmain(){ local command manualrunheaderprint echo echo echo echo linebreakprint read -p "enter command here: " command sleep .25 manualrun "$command" } manualrun(){ manualrunheaderprint jobrunsubheaderprint pullmodenames "$1" } ...

java - My Kafka sink connector for Neo4j fails to load -

introduction: let me start apologizing vagueness in question try provide information on topic can (hopefully not much), , please let me know if should provide more. well, quite new kafka , stumble on terminology. so, understanding on how sink , source work, can use filestreamsourceconnector provided kafka quickstart guide write data(neo4j commands) topic held in kafka cluster. can write own neo4j sink connector , task read commands , send them 1 or more neo4j servers. keep project simple possible, now, based sink connector , task off of kafka quickstart guide's filestreamsinkconnector , filestreamsinktask. kafka's filestream: filestreamsourceconnector filestreamsourcetask filestreamsinkconnector filestreamsinktask my neo4j sink connector: package neo4k.sink; import org.apache.kafka.common.config.configdef; import org.apache.kafka.common.config.configdef.importance; import org.apache.kafka.common.config.configdef.type; import org.apache.kafka.common.utils....

c# - How call Dialog from FormFlow -

how call dialog in middle of form? call location dialog https://github.com/microsoft/botbuilder-location address. thanks. [serializable] public class issueshares { [prompt("please enter holder name:")] public string holdername; [prompt("please enter holder address:")] **[call(typeof(addressdialog))]** public address address; [prompt("enter shares class:")] public string sharesclass { get; set; } [prompt("how many shares issue?")] [describe("number of shares")] public int numberofshares { get; set; } } [serializable] public class addressdialog : idialog<address> { public task startasync(idialogcontext context) { context.wait(messagereceived); return task.completedtask; } private async task messagereceived(idialogcontext context, iawaitable<object> result) { // logic context.done(address); } } are expecting solutio...

Angular 4, browser refresh page restarts everything -

working on angular 4 web app using json web token authenticate pages. jwt token saved in auth service variable. if token null redirect login page. when login successes, save token in auth service variable. problem is, when browser refresh page button clicked, whole app reloaded, ngoninit() of appcomponent called , restarted, result current page lost , login page shows up. want is, refresh component being displayed without restart appcomponent. how can this? browser refresh action under control?

django - Generic Views attributes? -

lately i've been learning gcbvs , definetly handy. big problem is, have book attributes can set. how can figure out attributes have set or can set without book (they spread among lot of pages , not cover attributes? there concentions template_names, context etc.? source code cryptic because there lot of multiple inheritance etc. how guys keep track of gcbvs?

if statement - 1. java ')' expected error + 2. 'else' without 'if' error -

the error ')' expected encountered on line 8; , error 'else' without 'if' found on line 9. part of method. beginning declares needed variable (name1, name2, count), , states possible exceptions when reading file. @ point, program should reading file in order compare names written in file. while ( ! textio.eof() ) { name1.compareto(name2); if (name1.equals(name2)); count++; } while ( ! textio.eof() ); if (count >= 0){ system.out.println("you encountered" + count "identical names."); else system.out.println("there no name encountered more once."); } remove ; @ end of if statement. ; ends if statement. if (name1.equals(name2)) count++; and add braces if , else separately. if (count >= 0) { system.out.println("you encountered" + count + "identical names."); } else { sy...

Why pass an interface as an argument to a function in android? -

while learning event handling in android came across below code here few questions have 1) why instance of anonymous class implementing view.onclicklistener() interface passed argument setonclicklistener()? 2) benefit of passing instance argument? button button = (button) findviewbyid(r.id.button_send); button.setonclicklistener(new view.onclicklistener() // explain { public void onclick(view v) { // in response button click }}); the goal: want when user clicks on button. what need: need know when user clicks on button. how know: using view.onclicklistener interface. this source code of view.onclicklistener : /** * interface definition callback invoked when view clicked. */ public interface onclicklistener { /** * called when view has been clicked. * * @param v view clicked. */ void onclick(view v); } this pass method method b, , method b invokes method when...

Nginx/PHP-FPM use more than one webroot -

i'm faced problem nginx. i'd distinct 2 cases: first if request url matches /api/(*.) want return api/index.php otherwise if url doesn't match it, public/index.php must returned. i've tried several solutions, including: nginx + php-fpm. redirect php-script nginx configuration multiple location blocks someone explain me how achieve ? thx :) my files organised this: /var/www/html | _ api | | | _ index.php | |_ public | _ index.php | _ js | _ index.js here server configuration: server { listen 80; server_name _; index index.php; rewrite_log on; location / { root /var/www/html/public; try_files $uri $uri/ /index.php$is_args$args; location ~ \.php { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.1-fpm.sock; ...

android - Firebase Updating realtime database on successful upload of media causes stack overflow -

i trying save image download url particular user after has been uploaded cloud storage. when try update db getting stack overflow error. proper way handle ? public void uploadartistcoverimagetocloudstorage(){ try { if (muploadedprofileimageuri != null) { storagereference riversref = mstorageref.child("images/" + muploadedprofileimageuri.getlastpathsegment()); uploadtask uploadtask = riversref.putfile(muploadedprofileimageuri); uploadtask.addonfailurelistener(exception -> { // handle unsuccessful uploads }).addonsuccesslistener(tasksnapshot -> { // tasksnapshot.getmetadata() contains file metadata such size, content-type, , download url. uri downloadurl = tasksnapshot.getdownloadurl(); string uid = firebaseauth.getinstance().getcurrentuser().getuid(); databasereference user = firebasedatabase.getinstance().getreference().c...

looking for a Lua-based solution for splitting a string into two or more components -

this first posting site, please bear me. consider following, representative string: fld u.a. ldfjal \verb*u.a.* dlf \lstinline$u.a.$ u.a. dfla \url{u.a.}rrr for background: \verb*....* , \lstline$...$ latex macros arguments aren't delimited matching curly braces but, instead, common character: * in case of \verb , , $ in case of \lstinline . important point delimiter characters can printable ascii character except { , } ; 1 should not assume * or $ used delimiters in (or any) cases. separately, \url{...} latex macro argument delimited curly braces. full string should assume contain utf8-encoded characters; simplicity, let's assume they're pure ascii characters. i'm looking create (hopefully reasonably efficient...) lua-based way split full string 2 sets of substrings: (a) parts consist of latex macros , associated arguments , (b) other parts. eventual goal feed "other parts" string.gsub function call. turning preceding example, how might...

asp.net MVC published project start page -

i have created asp.net mvc web application through iis manager. when run project locally have set start-page login when go project through website starts in different project page. need change start-page somewhere else after published? can help.

kerberos - OSS options for securing Elasticsearch -

i trying implement kerberos based authentication elasticsearch cluster. found out shield elasticsearch not free. there other options out there not require shield , yet allows me add kerberos integration? initially, spent time looking @ plugin shield turns out pre-requisite. https://github.com/codecentric/elasticsearch-shield-kerberos-realm

python - ValueError: Error when checking input: expected dense_6_input to have 3 dimensions, but got array with shape -

i'm receiving error keras: valueerror: error when checking input: expected dense_6_input have 3 dimensions, got array shape (55, 72) on model.fit(x.values, y.values, nb_epoch=1000, batch_size=16,verbose=0) this code: keras.models import sequential keras.layers import dense, activation model = sequential([ dense(32, input_shape=x.values.shape), activation('relu'), dense(10), activation('softmax'), ]) model.compile(loss='mse', optimizer='rmsprop') model.fit(x.values, y.values, nb_epoch=1000, batch_size=16,verbose=0) x has shape of (55, 72) how can fix , dense_6_input? the problem here: dense(32, input_shape=x.values.shape) don't set input_shape shape of input values array, input_shape not contain samples dimension. want should be: dense(32, input_shape=(72,)), then should able call fit without issues.

php - json decode file names when uploading multiple images and loop through them -

i using plugin ( have checked manual if there 1 this) json_encodes() file names when uploading multiple images. have far works 1 image only. $response = array(); $message = ""; $files = $_post['files']; foreach (json_decode($files) $key => $value) { $image = $value->file_name; } if($_post['files'] == "[]") { $message .= "at least 1 image required"; } if($message) { $response['success'] = false; $response['message'] = $message; } else { $response['success'] = true; $response['message'] = $image; } echo json_encode($response); this jquery/ajax var uploader = $('.picker-uploader').uploader({ upload_url: 'upload.php', file_picker_url: 'files.php', input_name: 'file', maximum_total_files: 5, maxim...

python - PyQt: Creating QT Widgets Programmatically -

there times when there need create many widgets (such qtgui.qlineedit() ) there values in list (we don't know how many values stored in list variable). create loop function run many times there values stored in list... such as: for each in mylist: mylineedit = qtgui.qlineedit("mylineedit") the problem approach every loop same variable name declared. there no way access mylineedit variable later. i've heard have success using eval()? or exec()? function. interesting see example. if there other way please post up. here example code start (if to): from pyqt4 import qtcore, qtgui app = qtgui.qapplication(sys.argv) class mainwindow(qtgui.qmainwindow): def __init__(self): super(mainwindow, self).__init__() mainqwidget = qtgui.qwidget() mainlayout=qtgui.qvboxlayout() in range(5): exec( 'mygroupbox'+str(i)+'= qtgui.qgroupbox() ' ) exec( 'mylayout'+str(i)+' = qtgui.qhboxl...

Automate script to run linear regression R -

i looking run linear regression on below data frame. test<-data.frame(abc=c(2.4,3.2,8.9,9.8,10.0,3.2,5.4), city1_0=c(5.3,2.6,3,5.4,7.8,4.4,5.5), city1_1=c(2.3,5.6,3,2.4,3.6,2.4,6.5), city1_2=c(4.2,1.4,2.6,2,6,3.6,2.4), city1_3=c(2.4,2.6,9.4,4.6,2.5,1.2,7.5), city1_4=c(8.2,4.2,7.6,3.4,1.7,5.2,9.7), city2_0=c(4.3,8.6,6,3.7,7.8,4.7,5.8), city2_1=c(5.3,2.6,3,5.4,7.8,4.4,5.5)) dataframe "test" sample of data. original data frame contains 100 columns. want create script predicting values using linear regression. in case, want build many models different input variables. for example, in given dataframe, abc y variable. want build 1 model city1_1,city1_2,city1_3,city1_4 (leaving city1_0, city2_0). other model city1_2,city1_3,city1_4 (leaving city1_0,city1_1,city2_0,city2_1) , 3rd model input variable city1_3,city1_4 (leaving city1_0,city1_1,city1_2,city2_0,city2_...

python - Pinging Ip's and returning up/down status AND latency -

i using python , using method this def ping(host): # ping parameters function of os parameters = "-n 1" if system_name().lower()=="windows" else "-c 1" # pinging return system_call("ping " + parameters + " " + host) == 0 to up/down status of list of ip's pinging. there way extract latency well? my output when running code looks along lines of ping statistics x.x.x.x: packets: sent = 1, received = 1, lost = 0 (0% loss), approximate round trip times in milli-seconds: minimum = 50ms, maximum = 50ms, average = 50ms x.x.x.x down i x.x.x.x down, latency = 50ms. there simple way overlooking? you need use subprocess . docs on os.system : changes sys.stdin, etc. not reflected in environment of executed command. if command generates output, sent interpreter standard output stream. subprocess easier.

amazon web services - Is it possible to use AWS CodePipeline with Lightsail? -

i'm working day , couldn't find answer. i'm asking guys: possible use aws pipeline aws lightsail? my objective store code inside codecommit , use codebuild, codedeploy, codepipeline , s3 create continuous deployment inside lightsail instance. those steps think have follow accomplish task: [x] setup lightsail instance [x] create iam user , set permissions [x] transfer repository codecommit [x] create s3 bucket hold build artifacts [x] create codebuild project build artifacts [x] create buildspec.yml file build steps [ ] create codedeploy project deploy application [ ] create codepipeline project trigger build when commit branch as can see, i'm there. couldn't find way use lightsail instance codedeploy. so, question is: possible? there limitation? did miss basic? there other way make cd lighsail? sorry, i'm getting little crazy right here ahhaha. today, 08/16/2017, it's not possible integrate them. i asked same question on aws forums , ...

Loop through multiple columns in R -

i have following code i'd run multiple columns in data frame called ccc. ccc %>% group_by(la) %>% summarise(def = sum(defaultoct05 == 'def'), ndef = sum(defaultoct05 != 'def'), drate = mean(defaultoct05 == 'def')) la name of 1 of columns. how set loop run through number of different columns? i've tried following. for (i in 26:ncol(ccc)) { ccc %>% group_by(i) %>% summarise(def = sum(defaultoct05 == 'def'), ndef = sum(defaultoct05 != 'def'), drate = mean(defaultoct05 == 'def')) } but following error message. error in resolve_vars(new_groups, tbl_vars(.data)) : unknown variable group : i what people miss in question reproducible data set. without it, hard reproduce problem , solve it. if got right, data-set looks 1 above: set.seed(1) ccc=data.frame(default=sample(c(0,1),100,replace = true),la=sample(c(...

cuda - How does warp divergence manifest in SASS? -

when different threads in warp execute divergent code, divergent branches serialized, , inactive warps "disabled." if divergent paths contain small number of instructions, such branch predication used, it's pretty clear "disabled" means (threads turned on/off predicate), , it's visible in sass dump. if divergent execution paths contain larger numbers of instructions (exact number dependent on some compiler heuristics ) branch instructions inserted potentially skip 1 execution path or other. makes sense: if 1 long branch seldom taken, or not taken threads in warp, it's advantageous allow warp skip instructions (rather being forced execute both paths in cases predication). my question is: how inactive threads "disabled" in case of divergence branches? slide on page 2, lower left of this presentation seems indicate branches taken based on condition , threads not participate switched off via predicates attached instructions @ bra...

java - ClassNotFoundException: org.jooq.util.CatalogVersionProvider -

well, i'm trying link jooq in h2. but throws exception: exception in thread "main" java.lang.noclassdeffounderror: org/jooq/util/catalogversionprovider @ java.lang.class.getdeclaredmethods0(native method) @ java.lang.class.privategetdeclaredmethods(class.java:2701) @ java.lang.class.privategetmethodrecursive(class.java:3048) @ java.lang.class.getmethod0(class.java:3018) @ java.lang.class.getmethod(class.java:1784) @ sun.launcher.launcherhelper.validatemainclass(launcherhelper.java:544) @ sun.launcher.launcherhelper.checkandloadmain(launcherhelper.java:526) caused by: java.lang.classnotfoundexception: org.jooq.util.catalogversionprovider @ java.net.urlclassloader.findclass(urlclassloader.java:381) @ java.lang.classloader.loadclass(classloader.java:424) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:331) @ java.lang.classloader.loadclass(classloader.java:357) ... 7 more i'm testing 1 entity: impor...

java - How to configure Connection to RabbitMQ broker -

i have been trying connect rabbitmq when broker in shutdown state. far have: com.rabbitmq.client.connectionfactory factory = new com.rabbitmq.client.connectionfactory(); factory.sethost("localhost"); factory.setport(5672); factory.setautomaticrecoveryenabled(true); factory.setnetworkrecoveryinterval(100000); factory.setconnectiontimeout(100000); factory.sethandshaketimeout(100000); return factory.newconnection(); however when factory.newconnection() executed when application startup. here stacktrace: caused by: java.io.ioexception @ com.rabbitmq.client.impl.amqchannel.wrap(amqchannel.java:124) @ com.rabbitmq.client.impl.amqchannel.wrap(amqchannel.java:120) @ com.rabbitmq.client.impl.amqconnection.start(amqconnection.java:362) @ com.rabbitmq.client.impl.recovery.recoveryawareamqconnectionfactory.newconnection(recoveryawareamqconnectionfactory.java:63) @ com.rabbitmq.client.impl.recovery.autorecoveringconnection.init(autorecoveri...

jquery - Replacing a text value in a table cell with Javascript -

i struggling mask data value javascript. work @ school, , doing away "traditional" grading. such, don't want gradebook display percentages, instead show words based on percentages (yeah know). replace % value word string. js, correctly alerts me values, return value never replaces % value in cell. missing? extremely new js may simple mistake. $('.percentage').each(function() { var corrected = $(this).html(); corrected = parsefloat(corrected); alert(corrected); switch (true) { case (corrected < 48.75): return 'unsatisfactory'; break; case (corrected < 61.25): return 'approaching '; break; case (corrected < 73.75): return 'approaching+ '; break; case (corrected < 86.25): return 'meeting '; break; case (corrected < 94.9): return 'meeting+ '; break; case (corrected <= 100): return ...