Posts

Showing posts from January, 2013

Swagger error: additionalProperty: 3XX, 4XX, 5XX -

i have added added few error code in swagger responses section: 201, 3xx, 400, 401, 4xx, 5xx. also, per swagger2.0 doc can have: "the following range definitions allowed: 1xx, 2xx, 3xx, 4xx, , 5xx. if response range defined using explicit code, explicit code definition takes precedence on range definition code." but still error: "should not have additional properties. additionalproperty: 3xx, 4xx, 5xx" any clue? that quote openapi 3.0 specification, not 2.0. the 2.0 spec not support wildcard response codes. need use specific codes, such 200 , 400 , 404 , etc., , can use default response match http codes not covered individually spec.

jquery - Adding extra input stops javascript from working -

i trying edit javascript code, have no experience javascript. i have html form, , trying add input it: <form method="post" action="php/subscribe.php" name="subscribeform" id="subscribeform"> <input type="text" name="email" placeholder="enter email address notified" id="subemail" /> <input type="text" name="personname" placeholder="enter name" id="personname" /> <input type="submit" name="send" value="notify me" id="subsubmit" class="btn2" /> </form> <!-- subscribe message --> <div id="mesaj"></div> <!-- subscribe message --> </div> the form subsequently pushes data php file. however, theme using features following javascript file: jquery(document).ready(function(){ $('#subscribeform').submit(f

HTML link to create a bookmark does not work on first click but works on second click -

Image
i have following html document - <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>document</title> </head> <body> <p><a href="#c20">jump chapter20</a></p> <h2>chapter1</h2> <p>this chapter explains bla bla bla</p> <h2>chapter2</h2> <p>this chapter explains bla bla bla</p> <h2>chapter3</h2> <p>this chapter explains bla bla bla</p> <h2>chapter4</h2> <p>this chapter explains bla bla bla</p> <h2>chapter5</h2> <p>this chapter explains bla bla bla</p> <h2>chapter6</h2> <p>this chapter explains bla bla bla</p> <h2>chapter7</h2> <p>this chapter explains bla bla bla</p> <h2>chapter8

c# - Convert image to byte array using MemoryStream.GetBuffer via ASP.NET -

i have method below convert png image file (known file size: under 1mb) byte array, response class returns byte array web request image download. the problem toarray(), creates copy in memory. getbuffer() returns underlying buffer, provides better performance. public byte[] imagetobytearray(system.drawing.image imagein) { using(memorystream ms = new memorystream()) { imagein.save(ms,system.drawing.imaging.imageformat.png); return ms.toarray(); } } can provide code using getbuffer()? .net 4.5, asp.net, creating byte array stream fastest way convert image byte array you should save file directly output steam of asp.net public actionresult downloadfile() { image imagein = getimage(); imagein.save(response.outputstream, imageformat.png); return new httpstatuscoderesult(httpstatuscode.ok); }

python - PyQt QFileInfo error -

i working on app in pyqt , when trying qfileinfo user-selected file error typeerror: arguments did not match overloaded call: qfileinfo(): many arguments qfileinfo(str): argument 1 has unexpected type 'tuple' qfileinfo(qfile): argument 1 has unexpected type 'tuple' qfileinfo(qdir, str): argument 1 has unexpected type 'tuple' qfileinfo(qfileinfo): argument 1 has unexpected type 'tuple' abort trap: 6 i have followed every tutorial tee, yet error keeps on happening. code below, , passing string module. don't know need do. def __init__(self, r, c): super().__init__(r, c) self.check_change = true self.path = qtwidgets.qfiledialog.getopenfilename(self,'open file',os.getenv('home'), 'csv(*.csv)') file_info = qfileinfo(self.path) file_name = file_info.filename() #print(file_name) self.init_ui() it looks qtwidgets.qfiledialog.getopenfilename return

jestjs - are there issues with generating a new wrapper for each test in Enzyme? -

i'm doing tests react project using jest + enzyme. currently generate new wrapper each test in suite. example: it('should render title', () => { let wrapper = shallow(<component />); expect(wrapper.find('#title')).tohavelength(1); }); it('should call closemodal function when clicked', () => { let wrapper = shallow(<component />); wrapper.instance().closemodal = jest.fn(); let targetfunction = wrapper.instance().closemodal; expect(targetfunction).tohavebeencalled(); }); i know whether standard or should generating wrapper in beforeall , referencing one. i'm interested in potential improvement in speed time. right have 190 tests , done in 21.38s. the problem beforeall use same instance in of test. if change internal state or props of component in 1 of test can influent result of other test. normally use beforeall test different parts of component without having generic test 'renders correct' mult

c - OpenGL GL_POINTS result differs from input -

Image
i want draw gl_points after ~totalpoint/3 result starts differ input 1 pixel i tried different glortho , glviewport arguments nothing changed my test program: int w = atoi(argv[1]); int h = atoi(argv[2]); glmatrixmode(gl_projection); glloadidentity(); glortho(0, w, h, 0, 1.0, -1.0); glmatrixmode(gl_modelview); glenable(gl_texture_2d); glloadidentity(); unsigned int wf,hf; unsigned char rgb[3]; while(!glfwwindowshouldclose(window)){ glclear(gl_color_buffer_bit); glpointsize(1); glbegin(gl_points); for(hf=0;hf<h;hf++){ for(wf=0;wf<w;wf++){ memset(rgb,0,3); rgb[wf%3]=0xff; glcolor3ub(rgb[0],rgb[1],rgb[2]); glvertex2f(wf,hf); } } glend(); glfwswapbuffers(window); glfwpollevents(); } results: not colored colored michael roy's way solved problem changed line glfwwindow* wmain = glfwcreatewindow(atoi(argv[1]), atoi(argv[2]), "test", 0, 0); to

excel formula - reference date in cell for file name in vlookup -

i have vlookup references prior month end file on shared drive. these files saved date in file name mmddyyyy. =vlookup([@[dealercode]],'\\mypath\[performance_07312017.xlsm]sheetname'!$b:$k,10,false) the formula must manually changed @ beginning of each month. want have formula previous months file referencing current date in c1. i've tried following, #value. =vlookup([@[dealer code]],concatenate("'\\mypath\[performance_",text(eomonth($c$1,-1),"mmddyyyy"),".xlsm]sheetname'!$b:$k"),10,false) i want leave month end files closed, don't think indirect option. it seems should simple, i'm stumped. in advance guidance y'all can give. the solution short of vba indirect, mentioned, not work closed files. there free add-in called morefunc.dll , has function called indirectext, works closed workbooks.

java - How to find date values which are more than 10 days old -

this question has answer here: how compare dates in java? 11 answers i using java , iterating on d.b. column in return gives me date , time string shown below: string datetime = resultset.getseries().get(0).getvalues().get(0).get(0); if iterate on resultset getting datetime values in format shown below. 2017-07-20t19:21:37.987792408z 2017-04-24t22:04:26.808753375z 2017-08-14t22:22:40.340772396z 2017-06-24t22:24:32.422544491z 2017-07-31t22:27:05.893368615z out of these records, how can compare date string "current" date object , discard values more 10 days old? i tried date date = new simpledateformat("yyyy-mm-dd't'hh:mm:ssz").parse(s); that didn't work. other idea? edit: using java7 , using influxdb not provide sysdate column while querying. have come solution using java. java.time retrieve date-time values

javascript - How can I get a value on a button click inside a WebView? -

i have native android app goes webview checkout process. implementing appsflyer track revenue through app. how can detect button clicked on page, , item price revenue? import android.app.activity; import android.app.progressdialog; import android.content.intent; import android.graphics.bitmap; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.util.log; import android.view.motionevent; import android.view.view; import android.webkit.webchromeclient; import android.webkit.webview; import android.webkit.webviewclient; import android.widget.textview; import com.appsflyer.afinappeventparametername; import com.appsflyer.afinappeventtype; import com.appsflyer.appsflyerlib; import org.json.jsonexception; import org.json.jsonobject; import java.text.simpledateformat; import java.util.date; import java.util.hashmap; import java.util.map; public class eventactivity extends appcompatactivity { progressdialog pdialog; boolean redirecting =

Javascript: using the replace method on hex or dec character using the hex or dec value itself -

i have html table sorting function sort in ascending or descending order column. show using down- , up- pointing small triangles hex code x25be; , x25b4; respectively. the problem cannot replace these hex characters using replace method. can using character follows: mystring.replace('▴',''); not possible because javascript code generated , ▴ character cannot used in generating code. it ok me use decimal codes #9662; , #9652; , if helps. see code sorttable function expressions tried, including suggestions post: javascript replaceing special characters <html> <meta charset="utf-8"> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <head> <script type="text/javascript"> function sorttable(id,n) { table = document.getelementbyid(id); //i skipping sorting here. //the question is: how replace hex or dec characters? var ths = table.getelementsbytagna

javascript - How to use sparkpost without a CC and/or BCC recepient? -

here's transmission object: if(req.body.bcc === ''){ req.body.bcc = ''; } if (req.body.cc === '') { req.body.cc = ''; } if (req.body.subject === '') { req.body.subject = 'no subject'; } if (req.body.source === '') { req.body.source = '<email omitted>'; } if (req.body.messagebody === '') { req.body.messagebody = 'no body text has been entered'; } var transmission = { recipients: [ { address: { email: req.body.to, name: 'to recipient' }, substitution_data: { recipient_type: 'original' } } ], cc: [ { address: { email: req.body.cc, }, substitution_data: { recipient_type: 'cc' } } ], bcc: [ { address: { emai

io redirection - How to pipe output to a rotating log file in shell, like log4j does? -

i'm using io redirection log output log file. want able move log different file whenever current day changes, such 2017-08-18.log . my attempts included use >xxx.log redirection clear log file, content reappeared within new log? how set log redirection? thanks. if ok perl run little script: use posix qw(strftime); $fbase = "tmp-%y-%m-%d-%h-%m.log"; while(<>) { $fnamenew = strftime $fbase, localtime; if ($fnamenew ne $fname) { print "logging to: $fnamenew\n"; $fname = $fnamenew; close out; open out, ">$fname"; } print out $_; } use like: $mycomputation | perl script.pl . append input filename built given time pattern, here tmp-yyyy-mm-dd-hh-mi.log . on each new line of input, pattern rebuilt , checked against old one. should differ input piped new file , old 1 closed.

Python: get index of each item in list with duplicates -

this question has answer here: loop through list both content , index [duplicate] 6 answers accessing index in python 'for' loops 13 answers how index of each item in list, including duplicates? far know python list.index give me first index of duplicated item, this. registros = ["celda", "celda", "test", "celda", "celda", "celda"] item in registros: index_found = registros.index(item) print(str(index_found) + " " + dato) outputs: 0 celda 0 celda 2 test 0 celda 0 celda 0 celda so how do (as simple possible) desired output?: 0 celda 1 celda 2 test 3 celda 4 celda 5 celda

android - Fragment inside fragment not working -

i have made fragment inside fragment , when click on list item in list , works because toast method shows message new fragment not adding... shows remains same.... @override public void onitemclick(adapterview<?> parent, view view, int position, long id) { textview t_profile_name = (textview) view.findviewbyid(r.id.profile_name); textview t_profile_hometown = (textview) view.findviewbyid(r.id.profile_hometown); string user_name = t_profile_name.gettext().tostring(); string user_hometown = t_profile_hometown.gettext().tostring(); string getid = user_id[position]; sharedpreferences sharedpreferences = getactivity().getsharedpreferences("comm_data", getcontext().mode_private); string getid = sharedpreferences.getstring("user_id", ""); toast.maketext(getcontext(), user_name+" "+user_hometown+" "+getid+""+

triggers - Copied value disappears when row that contained source value is deleted in Google spreadsheets -

i wrote script used trigger onedit in sheet. idea pick value worksheet, copy worksheet based on logic, , delete source row contained original value. when run, times, copy take place, on delete, copied value disappear. 1 way noticed fixes problem if delete trigger, save, , create again... how can avoid behavior? function onedit(e) { var range = e.range; var entry = range.getsheet(); var sss = entry.getparent(); if (sss.getname() != "weight tracker") return; if (entry.getname() != "entry") return; logger.log("copydata running...."+range.getcell(1,2).getvalue()); var weight = range.getcell(1,2).getvalue(); logger.log("weight = "+weight); var details = sss.getsheetbyname('details'); var trange = details.getrange(3, 1, 200); var data = trange.getvalues(); var today = new date().sethours(0,0,0,0); for(var n=0;n<data.length;n++) { var date = new date(data[n]).sethours(0,0,0,0); log

ruby on rails - How can I change the color of the progress bar of a task in Redmine or where is the code located? -

Image
i want change color of progress bar of task. i've located .erb source file gantt chart page , .rb source code computation of % done progress seems it's not right file edit. you should edit image located at: your_redmine_root/public/images/task_late.png where your_redmine_root place redmine physically installed, , depends upon underlaying operating system, etc... so gannt combination of html code generated underlaying ror application which's view can edit in app/views/gantts/show.html.erb . javascript code public/javascripts/gantt.js , css style (theme), might differ if using custom theme or plugin, @ default install it's in public/stylesheet/application.css the particular codes might different due redmine version, looking for .task_late { background:#f66 url(../images/task_late.png); border: 1px solid #f66; } on redmine 3.0 it's @ line 986. .task_late ordinary div, , can set it's css style way want... don't forget restart redm

ruby on rails - What does 'require' do when defining strong parameter? -

i have simple app user model, table: create_table "users", force: :cascade |t| t.string "email" t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false . . . end in users_controller , define private method user_params pass permitted parameter, example: params.require(:user).permit(:email, :password, :password_confirmation, :name) my question require . in rubyonrails' api doc , says: "when passed single key, if exists , associated value either present or singleton false ...... when given array of keys, method tries require each 1 of them in order. if succeeds, array respective return values returned ...... otherwise, method re-raises first exception found..." but in previous example's app/views/users/new.html.erb page, if leave :name column blank, still can submit. tried change line this: params[:user].permit(:email, :password, :password_confirmation,

php - Why AJAX is passing null / empty value? -

hi guys need on issue. managed input value modal form, when try check response show null/empty value. how can solve this, research on other related questions still cannot solved. attached screenshot + code here ajax code : $(function() { $('#tag-form-submit').on('click', function(e) { var d3_ca = $('#mymodal').find("textarea[name='d3_ca']").val(); console.log(d3_ca); e.preventdefault(); $.ajax({ type: "post", url: "d3handler.php", data: {d3_ca:d3_ca}, success: function(response) { $('#mymodal').find("textarea[name='d3_ca']").val(''); $('#test').html(response); $(".modal").modal('hide'); }, error: function() { alert('error');} }); return false; }); }); here php code : if(isset($_post['d3_ca'])) { $t = $_post[&

python - How to make this graph in plolty -

Image
is graph several lines using colorbar. unable using plotly. want make hydrograph, each line represents 1 year. import matplotlib mpl import matplotlib.pyplot plt min, max = (-40, 30) step = 10 # setting colormap that's simple transtion mymap = mpl.colors.linearsegmentedcolormap.from_list('mycolors',['blue','red']) # using contourf provide colorbar info, clearing figure z = [[0,0],[0,0]] levels = range(min,max+step,step) cs3 = plt.contourf(z, levels, cmap=mymap) plt.clf() # plotting want x=[[1,2],[1,2],[1,2],[1,2]] y=[[1,2],[1,3],[1,4],[1,5]] z=[-40,-20,0,30] x,y,z in zip(x,y,z): # setting rgb color based on z normalized range r = (float(z)-min)/(max-min) g = 0 b = 1-r plt.plot(x,y,color=(r,g,b)) plt.colorbar(cs3) # using colorbar info got contourf plt.show()

sql - Update xml tag in Oracle - joining another table -

i found following link useful, ask further it update xml tag in clob column in oracle using same data in previous post: create table tmp_tab_noemail_test (sce_msg clob); insert tmp_tab_noemail_test values ( '<energy xmlns="http://euroconsumers.org/notifications/2009/01/notification"> <gender>m</gender> <firstname>mar</firstname> <name>van hall</name> <email/><telephone>000000000</telephone> <insertdate>2013-10-09</insertdate> </energy>'); update tmp_tab_noemail_test p1 set p1.sce_msg = updatexml(xmltype(p1.sce_msg), '/energy/insertdate/text()','not valid', 'xmlns="http://euroconsumers.org/notifications/2009/01/notification"').getclobval(); now, if wanna table account. has column: acct_num , name , date_of_birth how can update insertdate tag value = account.date_of_birth name tag value = account.name ? is possible

active directory - Integrated Window Authentication for Websphere with remote webserver in front -

Image
i able perform sso cluster environment when web server , application server present in same system below following ibm link. https://www.ibm.com/support/knowledgecenter/en/ssaw57_8.5.5/com.ibm.websphere.nd.doc/ae/tsec_spnego_overview.html but not getting configuration needed done when webserver hosted remotely websphere described in below picture. things have performed till : configured entire setup web-server host-name, way done application server , removing application server setup. 1.1 create userid , keytab file(with mapuser in ktpass command) web-server in active directory. http/webserver1.robo.home.ca 1.2 created new krb5 file , map websphere. 1.3 kinnt command working fine configuration. 1.4 updated browser configuration browser treating request normal basic authentication request instead of negotiate , asking user credential.

mysql - phpMyAdmin affects zero rows but simulation affects 399 -

i running simulation of sql query: update wp_posts set post_content = ( replace (post_content, 'src="http://', 'src="//') ) instr(post_content, 'jpeg') > 0 or instr(post_content, 'jpg') > 0 or instr(post_content, 'gif') > 0 or instr(post_content, 'png') > 0; matched rows: 399 which matched 399 rows, when execute it, affects zero. is there error don't see ?? kindly refer mysql manual update statement - tells... if set column value has, mysql notices , not update it. so, if run query, mysql understand value you're trying apply same current 1 specified column, , won't write database. reason getting 0 rows affected...

android - How to disable older GCM token after app update? -

i upgrade notification module gcm fcm , release 'appstore' , 'playstore'. issue updated app old version device receiving duplicated message. delete app , reinstall it's ok receive 1 message. i found reason older gcm token still activated app updated. 1 app has 2 activated token(one gcm,another fcm) older gcm token d3-b3lp9_mu:apa91bhmjknzwjdt8r1beky5b4t.... newer fcm token d3-b3lp9_mu:apa91bedc5y4gqp3v9xyu....... how can disable older gcm token???

database design - Should I store trailing zeros in a key/value storage -

in our application read , write hbase table. in hbase table store strings, no integers/doubles/bigdecimals data read multiple sources have column value in it, have 2 decimal precision, have 9. after of our calculation of values might end more 2 decimals. when writing our own hbase table write decimals 9 decimal precision. when converting our (big)decimals string before writing them, should add trailing zeroes, make our out have 9 decimals indicate precision of column. just date formats shouldn't stored in equal format regardless of format received them as. (either unix timestamps, or without timezones etc etc)

TFS Java SDK - shelving file that already exists on the repository -

i have application uploading translations tfvc repository. have added 2 modes of update - check in , shelve. shelving supposed create file on shelveset, have discovered, once same file exists on repository(it checked in before), shelvesets not being created. it caused "gated-build", blocking check-in of *resx files exists. looks shelvesets blocked, if file exists in repo. potential reason? there way avoid problem using java sdk or perhaps changing configuration on repository. on local-testing tfs repo works well. want create shelvesets everytime on client server well. regards, sebastian

android - Should I program iOS apps using Xcode or Unity? -

i started programming in xcode realised use unity , potentially app google play store well. there advantages sticking xcode? please keep in mind i'm using mac. via xcode enables accessing native libraries , directly operating system. unity uses opengl linux based op systems powerful , effective graphics , game apps

angular - Angualr Material2 - autocomplete lazy load with http promise -

i have problem http autocomplete, can't find example anywhere angualr-material2. in try time error like: error error: cannot find differ supporting object '[object object]' of type 'object'. ngfor supports binding iterables such arrays. error typeerror: cannot read property 'activeitem' of undefined or sometime: [object promise] https://plnkr.co/edit/z3sbzqrjpattnkk3mrwf?p=preview someone have example autocomplete?

java - How to Parse Complete XML into a string using DOM PARSER? -

for example: if pass tagvalue=1 should return complete xml1 string me string input in function. string input = "<1><xml1></xml1></1><2><xml2></xml2><2>.......<10000><xml10000></xml10000></10000‌​>"; string output = "<xml1></xml1>"; // tagvalue=1; if xml has root element doable 1. parse xml using dom parser. 2. iterate through each node 3. find desired node. 4. write node in different xml using transform sample code step 1: used xml string, can read file. documentbuilder dbuilder = documentbuilderfactory.newinstance() .newdocumentbuilder(); inputsource = new inputsource(new stringreader(uri)); document doc = dbuilder.parse(is); iterate through each node if (doc.haschildnodes()) { printnote(doc.getchildnodes(), doc); } please put in logic iterate thorugh nodes , find right child node want

build a .exe for Windows from a python 3 script importing theano with pyinstaller -

edit september, 2, 2017, 1pm i managed build .exe pyinstaller after many episodes. unfortunately failed deal ‘theano’ module (that required in case ‘pymc3’ module) , had modify .py files , give part of application. description below has 2 aims: first may help; second could me building .exe windows 7+, ‘theano’ module ? reminder: python 3 script opens simple gui made qt designer in ‘.ui’ file , imports pyqtgraph (with pyqt5), pymc3 (and theano required pymc3), scipy, numpy, os, sys. distributed on machines windows 7+. tried build ‘.exe’ py2exe, cx_freeze, pynsist , pyinstaller (i opened , updated several posts, 1 still opened: build .exe windows python 3 script importing pyqtgraph , opening gui ) failed. best result (with pyinstaller) described below after had give theano. the command line ended is: pyinstaller —noupx —onefile —add-data “toto.ui;.” toto.py . strangely: 1 qt designer file ‘toto.ui’ not included , must distributed .exe. otherwise there error message when r

python - File upload chokes with 100-continue sometimes -

i call web service using curl upload image server. works , @ other times, haults @ point shown below. dehavior inconsistent - manage image uploaded , response, while @ other times sit there shown below. missing/doing wrong? code snippet: filename = str(id) + '.' + str(int(time.time())) + '.' + secure_filename(file.filename) filename_absolute = os.path.join(app.config['upload_folder'], picture_type, filename) file.save(filename_absolute) sample call [success]: curl -v -f "id=1" -f 'file=@/tmp/2.png' -f 'picture_type=user' http://host:5000/api/v1/upload-picture * trying 45.76.12.43... * connected host (host) port 5000 (#0) > post /api/v1/upload-picture http/1.1 > host: host:5000 > user-agent: curl/7.47.0 > accept: */* > content-length: 154309 > expect: 100-continue > content-type: multipart/form-data; boundary=------------------------7cc65a2371111afb > < http/1.1 100 continue * http 1.0, assume c

virtualenv - How to get the newly added package into python virtual environment -

i have virtual environment python , hence activate this #source myname/bin/activate in host machine, have installed package #sudo pip install scikit-image in virtual environment, m unable access scikit-image. how can newly added package existing virtual environment? use pip without sudo in order install in environment. when use sudo become root , packages installed root .

apache spark sql - SparkSQL : same query returns different result -

i encountered weird problem. wanted data dataframe , insert permanent hive table , index elasticsearch.query simple select * result* , loop through each row , insert es. , simple insert <hive_table> select * result , got different result. check created 3 different temprorary table this spark.sql("select * qtycontribution").join(getrevenuecontribution(spark,table2), "item").join(finaluniqueitem(spark), "item").registertemptable("hola"); spark.sql("select * qtycontribution").join(getrevenuecontribution(spark,table2), "item").join(finaluniqueitem(spark), "item").registertemptable("hola1"); spark.sql("select * qtycontribution").join(getrevenuecontribution(spark,table2), "item").join(finaluniqueitem(spark), "item").registertemptable("hola2"); each query same tables different. , dataset<row> dframe1 = spark.sql("select * hola"); row[

Get error while debugging a C++ remote application as a different remote user using TCF/TE launcher from Eclipse Neon -

i think in eclipse tcf/te launcher has option debug remote c/c++ application user other login user. when try launch debugger following errors. error when specify user "launch remote user" field. have no idea problem is. failed create script commands before launch in '/home/ocp/workspace/.metadata/.plugins/org.eclipse.tcf.te.tcf.launch.cdt/prerun_temp_scripts/09-40-14-445_myapp_test_d.sh'. possibly caused by: failed read commands before launch script template 'null'. failed read commands before launch script template 'null'. failed read commands before launch script template 'null'. failed read commands before launch script template 'null'.

jasmine - How to fail test if observable will not work -

i have case expect place subscribe .test work.but if subscribe not work test success. it('test', async(() => { testservice.subscribe(response => { expect(response.length).tobe(7); }); })); how fail test if observable not work?

javascript - pass dragable v-for option to function when drag is over -

i want drag element list 1 list 2 , call method when leave drag, accomplish it, problem here can put @end(responsable detecting end of dragging) in draggable tag, , div has v-for child it, can't element list pas function in draggable. this code: <draggable v-model="sectionlist" class="dragarea" @end="changeview(section.component)" :options="{group:{ name:'sections', pull:'clone', put:false }}"> <transition-group name="list-complete"> <div v-for="(section, index) in sectionlist" @click="changeview(section.component)" :key="section.text" class="card card-color list-complete-item"> <div class="card-block"> <h4 class="card-title text-center">{{section.text}}</h4> </div> </div> </transition-group> </draggable> the @end=changevie

How to set JVM heap size at run time when running jmeter in distributed testing using docker -

i have below test infrastructure: 3 instances (master + 2 slaves), dockerized run command jmeter master (default 512m used in 3 machines) sudo docker exec -i master /bin/bash -c "/jmeter/apache-jmeter-3.1/bin/jmeter -n -t /home/librarian_journey_req.jmx -djava.rmi.server.hostname=yy.yy.yy.yy -dclient.rmi.localport=60000 -r1xx.xx.xx.xx -j jmeter.log -l result.csv" the above command works fine , getting results also. wanted increase heap size 3gb @ run time. i had tried using below command: sudo docker exec -i master /bin/bash -c "jvm_args="-xms1024m -xmx1024m" /jmeter/apache-jmeter-3.1/bin/jmeter -n -t /home/librarian_journey_req.jmx -djava.rmi.server.hostname=10.135.104.138 -dclient.rmi.localport=60000 -r10.135.104.135,10.135.104.139 -j jmeter.log -l result.csv" after running above command nothing happens. please guide how can increased. you can override environment variables when running containers. also, don't need use sudo

Convert a string into a byte array in c# -

i have string, string var="11001100" i want convert byte array. barray[0]=0x00; barray[1]=0x00; barray[2]=0x01; barray[3]=0x01; barray[4]=0x00; barray[5]=0x00; barray[6]=0x01; barray[7]=0x01; can guide me in this? tried following code, data in ascii. not want that. barray = encoding.default.getbytes(var); i suggest using linq : using system.linq; ... string var = "11001100"; byte[] barray = var .select(item => (byte) (item == '0' ? 1 : 0)) .toarray(); test: console.writeline(string.join(environment.newline, barray .select((value, index) => $"barray[{index}]=0x{value:x2};"))); outcome: barray[0]=0x00; barray[1]=0x00; barray[2]=0x01; barray[3]=0x01; barray[4]=0x00; barray[5]=0x00; barray[6]=0x01; barray[7]=0x01;

authentication - "Invalid JWT Signature." with meteor-google-oauth-jwt -

i trying submit sitemap.xml programmatically, following instructions here: https://developers.google.com/webmaster-tools/search-console-api-original/v3/sitemaps/submit#auth i do: // call once set jwt httpjwt.setjwtoptions({ email : "[ client id first dot ]@developer.gserviceaccount.com", key : assets.gettext("key.pem"), // key file assets scopes : [ "https://www.googleapis.com/auth/webmasters" ], }); var submiturl = "https://www.googleapis.com/webmasters/v3/sites/https%3a%2f%2fwww.spoticle.com/sitemaps/https%3a%2f%2fwww.spoticle.com%2fsitemap.xml"; var result = httpjwt.get(submiturl); ... , here result: error: failed [400] { "error" : "invalid_grant", "error_description" : "invalid jwt signature." } i can, however, generate jwt doing: var jwt = googleoauthjwt.encodejwt({ email : "[ client id first dot ]@developer.gserviceaccount.com", key : assets.g

multithreading - not understanding a part of code -

hi not understanding part of code in threads program , code int niza[1000]; pthread_t threads[6]; void *popolni(void* n) { int counter=*(int *)n; for(int i=0;i<n;i++) niza[i]=rand()%counter; pthread_exit(null); } void *promeni(void* id) { int threadid=*(int *)id,dolzina=strlen(niza); int del=round(dolzina/4); for(int i=(id-1)*del;i<id*del;i++) niza[i]+=niza[i]/2; pthread_exit(null); } void *pecati(void* n) { int counter=*(int *)n; for(int i=0;i<counter;i++) printf("%d ",niza[i]); pthread_exit(null); } int main(int argc, char* argv[]) { srand(time(null)); int n; scanf("%d",&n); pthread_create(&threads[0],null,popolni,(void *)&n); pthread_join(threads[0],&status); for(int i=1;i<5;i++) pthread_create(&threads[i],null,promeni,(void *)&i); for(int i=1;i<5;i++) pthread_join(threads[i],&status); pthread_create(

javascript - how to insert array as json format into database using php my sqli -

guy's need help. have array , populate array json.stringify , want insert array database. have try make code wont work. don't know why.. hope can me out of problem this code $(document).ready(function(){ $("#submit-file").click(function(){ var myfile = $("#files")[0].files[0]; var json = papa.parse(myfile, { skipemptylines: true, complete: function(results) { var serialize = json.stringify(results); $.ajax({ type: "post", url: "../php/tagihan/save_data.php", data: serialize, cache: false, success: function(data) { } }); } }); }); }); <?php include('../../connections/koneksi.php'); // reading json file $array = json_decode( $_post['array'] ); //converting json object php associative ar

c# - Asp.net web api : redirect unauthorized requst to forbidden page -

im trying redirect unauthorized request forbidden page instead i'm getting forbidden page in response body , how can fix ? here's startup class : app.createperowincontext(storecontext.create); app.createperowincontext<applicationusermanager>(applicationusermanager.create); app.createperowincontext<applicationsigninmanager>(applicationsigninmanager.create); app.usecookieauthentication(new cookieauthenticationoptions { authenticationtype = defaultauthenticationtypes.applicationcookie, expiretimespan = timespan.fromdays(30), }); app.useexternalsignincookie(defaultauthenticationtypes.externalcookie); app.usetwofactorsignincookie(defaultauthenticationtypes.twofactorcookie, timespan.fromminutes(5)); app.usetwofactorrememberbrowsercookie(defaultauthenticationtypes.twofactorrememberbrowsercookie); the method im trying reach : [httpget] [authorize(roles = "admin")] public string getcurrentusername() { return userman

swift - Communicate data between WatchOS & Today Extension widget -

standard set watch os > 2. wcsessiondelegate used coordinte data between main application , watch. an app group "group.***********.todayextensionwidget" used coordinate data between main application , today extension widget via userdefaults(suitename: "group.***********.todayextensionwidget") when make change watch communicates change main application. main application (once launched) communicates on today extension. communicate change in watch app today extension without needing launch main app first. is there best practice communicate between watch app , today extension widget? at moment there no way achieve using built-in frameworks. since introduction of watchos2 , watchkit apps considered independent apps , not extension of ios app, hence cannot use appgroups share data between 2 , cannot use share data between watchkit app , ios extension. as experienced, watchconnectivity cannot used in today extension , out of picture well.

Maven creates an empty Pom.xml -

Image
i'm trying create maven project. file - new project - maven. archetype not indicate. then standard: groupid , artifactid. project created empty pom.xml java installed: java -version java version "1.8.0_144" java(tm) se runtime environment (build 1.8.0_144-b01) java hotspot(tm) 64-bit server vm (build 25.144-b01, mixed mode) maven installed: mvn -version apache maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04- 04t01:39:06+06:00) maven home: d:\apache_maven\bin\.. java version: 1.8.0_144, vendor: oracle corporation java home: c:\program files\java\jdk1.8.0_144\jre default locale: ru_ru, platform encoding: cp1251 os name: "windows 10", version: "10.0", arch: "amd64", family: "windows" i don't know why you're seeing empty pom.xml . i can offer alternate solution: use maven quickstart archetype (maybe command line) import resulting pom.xml project / create new project genera

powershell - How to prevent TeamCity publishing a successful build when Angular AOT compilation fails -

we have angular application deployed through teamcity. final build step (before web deploy), powershell script, follows. $branch = "%teamcity.build.branch%" if($branch.contains("release")) { npm run-script publish-qa } elseif($branch.contains("develop")) { npm run-script publish-dev } elseif($branch.contains("master")) { npm run-script publish } the npm scripts "publish": "ng build --prod --bh /hubs/", "publish-qa": "ng build --env=qa --bh /hubs/", "publish-dev": "ng build --env=dev" when deploy master, angular app compiles using aot compilation. when there build fail, logged in build logs npm error build still exits code 0, tries publish empty folder. this end of build log [step 5/5] error in cannot determine module class datesvalidityvalidatordirective in d:/teamcity/buildagent/work/a880d6f55c430ab6/src/app/hubs/offer-picker/card-dates-validator.directive.t

java - Project not compiling using Kotlin in Project -

i have problem compiling program when add class in kotlin in it. when clean of project, , start running it, next error prompt: error:execution failed task ':app:compileretrolambdamyproject'. process 'command '/applications/android studio.app/contents/jre/jdk/contents/home/bin/java'' finished non-zero exit value 1 the thing if execute again project works perfectly. have build project twice in order execute project. i need fixed because build final version in jenkins , giving me problems. any clues on how fix it? edit: this unique warnings gives me, said, warnings, not errors, , if run again project works : warning:(31, 57) parameter 'buttonview' never used, renamed _ warning:(40, 46) parameter 'v' never used, renamed _ warning:(56, 48) parameter 'v' never used, renamed _ error:execution failed task ':app:compileretrolambdamyproject'. > process 'command '/applications/android studio.app/contents/jr

ecmascript 6 - ES6 transpile the "species pattern" for old browsers -

i reading species pattern having following code class myarray1 extends array { static [symbol.species]() { return array; } } we can make methods slice return instance of array. so if validate (new myarray1).slice() instanceof myarray1 false . all till now. but if want transpile code, let's babeljs ; far know not work older browsers not have new implementation of slice method states let arrayspeciescreate(o, count). if true, can not transpile new feature, question is: are there other solutions(polyfills, etc)? or feature can not used on older browsers if transpile code?

condition does not work on blade laravel 5.2 -

i want load panel if user logged in and if client master but both files loaded @ runtime. it not run bet! @if(auth::check()) @extends('panel') @else @extends('master') @endif what want? have different layouts logged user , not logged one? @extends(auth::check() ? 'panel' : 'master') you can't use 2 extends. two extends generate compiled views code <?php if(auth::check()): ?> <?php else: ?> <?php endif; ?> you can see, extends not here. in end of - <?php echo $__env->make('panel')... ->render(); <?php echo $__env->make('master')... ->render(); that's why use see them both.

Kendo UI Angular 2+ Chart - Series Tooltip Template - Access to Category Value and Other Data -

i'm using kendo chart component series items of type "line". according documentation here it's possible use current value placeholder within series tooltip template. is there possibility access current category within template well? , in case i'm binding objects instead of primitive values possible access current data item not value? thanks there way. documentation provided not straightforward , found confusing well. current category can accessed declaring variable , setting category . if using object set data of kendo-chart-series-item, other properties of object can used tooltip. use dataitem property here access other properties of data have set. <kendo-chart-series-item-tooltip> <ng-template let-value="value" let-category="category" let-dataitem="dataitem"> number of children: {{ dataitem.number }} </ng-template> </kendo-chart-series-item-tooltip>

html - How to save php form data for use it later -

i have simple html form along php codes in index.php file, , question is: how can save form data , use them in diffrent page? php code looks this: if(isset($_post['submit'])){ //collect form data $name = $_post['name']; $email = $_post['email']; } html code looks this: <form action='' method='post'> <p><label>name</label><br><input type='text' name='name' value=''></p> <p><label>email</label><br><input type='text' name='email' value=''></p> <p><input type='submit' name='submit' value='submit'></p> </form> simplest solution save data in session have limitation browser close time , it's assigned current browser session: <?php session_start(); if(isset($_post['submit'])){ //collect form data $_session['

linux - How to get the expiration date of ssl certificate using python -

import socket import ssl def ssl_expiry_datetime(hostname): ssl_date_fmt = r'%b %d %h:%m:%s %y %z' context = ssl.create_default_context() conn = context.wrap_socket( socket.socket(socket.af_inet), server_hostname=hostname, ) conn.settimeout(3.0) conn.connect((hostname, 443)) ssl_info = conn.getpeercert() return datetime.datetime.strptime(ssl_info['notafter'], ssl_date_fmt) def ssl_valid_time_remaining(hostname): expires = ssl_expiry_datetime(hostname) logger.debug( hostname, expires.isoformat() ) return expires - datetime.datetime.utcnow() def ssl_expires_in(hostname, buffer_days=14): remaining = ssl_valid_time_remaining(hostname) if remaining < datetime.timedelta(days=0): raise alreadyexpired("cert expired %s days ago" % remaining.days) elif remaining < datetime.timedelta(days=buffer_days): return true else: return false`` i want if

Ionic add platform ios showing phonegap-plugin-push error on mac OS Sierra -

hi when tried platform add ios showing following error, adding ios project... creating cordova project ios platform: path: platforms/ios package: com.leniko.fuel-buddy name: fuel buddy ios project created cordova-ios@4.4.0 installing "cordova-plugin-app-version" ios installing "cordova-plugin-apprate" ios plugin dependency "cordova-plugin-dialogs@1.3.0" fetched, using version. installing "cordova-plugin-dialogs" ios plugin dependency "cordova-plugin-globalization@1.0.4" fetched, using version. installing "cordova-plugin-globalization" ios cross-platform apprate plugin cordova / phonegap installing "cordova-plugin-camera" ios plugin dependency "cordova-plugin-compat@1.1.0" fetched, using version. installing "cordova-plugin-compat" ios plugin "cordova-plugin-compat" installed on ios. making top-level. installing "cordova-plugin-console" ios installing "cor

facebook submit app for review app -

i have website, have added ( addthis plugin : http://www.addthis.com/ ) allow site visitors share site pages on social media. then have added facebook opengraph meta tags webpages control how page should appear when shares it. then checked how facebook sees pages using facebook developers debug tool: https://developers.facebook.com/tools/debug/sharing/ showed me warning have add app_id meta tag. so created new app in facebook developer tools website , added meta tag. now questions: 1- may gain adding app_id meta tag ? tested functionality before adding , working fine, don't see new addition till now. 2- in facebook app management page, find tab named ( app review), below see : "some facebook integrations require approval before public usage" so, have publish app review because site uses share facebook ( addthis plugin)? or don't have because share process done via app ( addthis app) ?

php - How to save multiple records in cakephp 3.4.12 -

i trying save multiple records in single table. facing problem while saving form data. problem might form elements. please me on issue controller save method $data = $this->request->data(); $stockin = tableregistry::get('stockin'); $entities= $stockin->newentities($data); $stockin->savemany($entities); form echo $this->form->input("stockin.$i.date", [ 'value' => $stockindate]); echo $this->form->input("stockin.$i.product_id", [ 'value' => $prod->id]); echo $this->form->input("stockin.$i.quantity", ['label' => false] ); echo $this->form->input("stockin.$i.harvested", ['options' => $harvested,'label' => false]); echo $this->form->input("stockin.$i.price", [ 'label' => false]); post array value [ 'stockin' => [ (int) 0 => [ 'date' =>

c# - Using TransactionScope with Parallel.Foreach Loop -

i trying use transaction parallel.foreach code snippet : list<int> ilist = new list<int>(); // having int random numbers /// check final collection count concurrentqueue<int> q= new concurrentqueue<in>(); using(var scope = new transactionscope()) { transaction roottr = transaction.current; parallel.foreach(ilist, item => { dependenttransaction dt = roottr.dependentclone(dependentcloneoption.rollbackifnotcomplete); if(item == 7) throw new argumentexception("7 occurred"); // throwing exception q.enqueue(item); thread.sleep(5000); dt.complete(); }); ts.complete(); } but getting exception see value in queue(q). i want rollback parallel processing item queue(q) empty in case of failure.

angularjs - How to check with checkbox ng-if? -

if use ng-if in check box , have test.check = "y" value, want check check box when search. case? <input type="checkbox" ng -if=" test.check == 'y' chekced" value="{{test.roomnum}}" check-list="checkedmodel.roomnum">{{assign.roomnum}} you dont need use ngif in case, can use [checked] . change html following: <input type="checkbox" [checked]="test.check === 'y'" value="{{test.roomnum}}" check-list="checkedmodel.roomnum">{{assign.roomnum}}

c# - Copy database tables from one database to another DB EF code first -

i have database 2 tables : employee salary ======== ================ id name id empid salary and of course there class each table implement code first migration. is there way copy database tables source database database , change names of tables using ef code-first? ps: target method create default database default structure , when new client register create own tables in existing database new name in case entity framework layer code differ client client? since have more table on 1 client one. can change name modelbuilder.entity().totable("mytesttablename"); fluent api or table attribute [table("mytesttablename")] public class test { } etc

angular - How to only load Zone.js when it is needed -

i'm creating angular 2 application can dynamically injected running website. point of app able modify website content visually. everything works expected when website in question not run using angular 2. in particular, when original website uses angular 2 , zone.js, application tries load zone.js crashes on error: zone loaded . i'm using webpack build system , tried solve problem splitting build 3 parts: manifest , polyfill , , app . manifest contains webpack manifest, polyfill contains core-js , zone.js , , rest in app . there's fourth chunk called index . 1 placed website , first checks if window.zone defined. if is, manifest , app added. otherwise polyfill . the problem when polyfill chunk not loaded, modules in chunk missing webpack. when code reaches import app chunk requires either core-js or zone.js (that's think happening), error: typeerror: cannot read property 'call' of undefined @ __webpack_require__ (manifest.js:55) @ objec