Posts

Showing posts from January, 2011

PHP Sorting An Multidimensional Array -

i new php , unsure why code not outputting. have in place no errors , seems correct. trying output names , dates in ascending order while using print_r() verify order. appreciate guidance matter have no idea going wrong. $win = array('name'=> array('jane doe ', 'nash patel ', 'joe public '), 'date'=> array('7 october 2015 ', '14 october 2014 ', '12 october 2016 ')); foreach($win $element => $namedate) { echo '<strong>' . $element . '</strong><br>'; foreach($namedate $both) { echo $both . '<br/>'; } } foreach($win $c=>$key) { $sort_date[] = $key['date']; $sort_name[] = $key['name']; } array_multisort($sort_name, sort_asc, $sort_date, sort_asc, $win); print_r($win); output\ array ( [date] => array ( [0] => 7 october 2015 [1...

reporting services - SQL Parameters, How to give * (ALL) a default parameter? -

i have query: select job,age,name + + surname fullname now filtering (in ssrs) per full name. how set default value in full name drop down field show candidates default? drop down field looks follows: everyone jon patric kelly steve you can pullback data similiar query below: select * ( select orderby=2,filtervalue=surname, job,age,name + + surname fullname union select orderby=1,filtervalue=null, null,null,null + + '<all>' fullname ) order orderby,fullname then send in filtervalue filter clause similiar to: select * mytable (@filtervalue null) or (surname = @filtervalue)

gdal - how to plot geotiff data in specific area (lat/lon) with python -

Image
i have geotiff raster data sets elevation data init , want plot in specific area, such 60°e - 70° e ,70°s - 80°e. i have bit of code here ,but pcolormesh seem couldn't plot geotif.it's red. picture . picture shown imshow really picture when try make plot code below: path = "f:\\mosaic_h1112v28_ps.tif" dataset = gdal.open(path) data = dataset.readasarray() x0, dx, dxdy, y0, dydx, dy = dataset.getgeotransform() nrows, ncols = data.shape londata = np.linspace(x0, x0+dx*ncols) latdata = np.linspace(y0, y0+dy*nrows) lons, lats = np.meshgrid(lonarray, latarray) fig = plt.figure(figsize=(8, 8)) m = basemap(projection='lcc', lon_0=67.5, lat_0=-68.5, height=950000, width=580000, resolution='h') m.drawcoastlines() x, y = m(lons, lats) then dont know how continue . want use imshow , imshow dont specify area(lat/lon). i appreciate help. it's question, here solution. required packages: georaster dependencies (gdal,...

can't transfer tiff or modi file with PHP -

this snippet should transfer file tiff or modi web server user web header('content-description: file transfer'); header('content-type: ' . $file_mime_type); header('content-disposition: attachment; filename="' . $file_name . '"'); header('content-transfer-encoding: binary'); header('expires: 0'); header('cache-control: must-revalidate'); header('pragma: public'); header('content-length: ' . $file_size); # till moment fine echo file_get_contents("path/to/file.tif"); # script fails on line above, , doesnt reach place when file format not tiff or modi, works fine , client browser start downloading file (docx/xlsx/pdf/etc.) when user try download tiff or modi, script fails without error. have tried print(file_get_contents("path/to/file.tif")); , readfile("path/to/file.tif"); instead of echo, result same

java - AsyncTask freezing both its thread and the UI thrad -

i've made class extending asynctask send post requests server, application. has been working until now. haven't changed anything, of sudden freezing ui thread , own thread when try execute it. i've tried using log.d() find out gets u before freezing, , turns out freezes right after doinbackground() called. i've tried changing this... string result = new asyncpost().execute(params).get(); to this... asynctask task = new asyncpost(); task.execute(); string result = task.get(); it nothing parameters i'm giving it, since freezes no matter parameters passed it. i have tried using postman check server working (and is), not server-side issue either. this asynctask class. sorry excessve amount of code, can't figure out specific part of bad, since working until now. public class asyncpost extends asynctask<object, integer, string> { @override protected string doinbackground(object ... params){ //android.os.process.setthread...

How do I install SQL Server 2016 onto my newly configured virtual machine on Azure? -

how install sql server 2016 onto newly configured virtual machine on azure? i want developer version practice queries etc. vm works fine can't administer it. you can microsoft website https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms

r - Inserting NA rows when missing data -

i have data set missing values in sequence: seq<-c(1,2,3,4,6,7,10,11,12,18,19,20) data<-c(3,4,5,4,3,2,1,2,3,5,4,3) df<-data.frame(seq, data) i'd add rows data set approximating have missing values, , filling in data na. time have gap larger 2, add na row (or multiple rows if gap large). result this: newseq<-c(1,2,3,4,6,7,8.5,10,11,12,14,16,18,19,20) newdata<-c(3,4,5,4,3,2,na,1,2,3,na,na,18,19,20) newdf<-data.frame(newseq,newdata) so ignore when gap < 2, add na row anytime there gap > 2. if there still > 2 gap after adding na row, add until gap filled. not elegant, how it: seq<-c(1,2,3,4,6,7,10,11,12,18,19,20) data<-c(3,4,5,4,3,2,1,2,3,5,4,3) df<-data.frame(seq, data) first <- df$seq second <- df$data for(i in length(first):2) { gap <- first[i] - first[i - 1] if(gap > 2) { steps <- ifelse(gap %% 2 == 1, gap %/% 2, (gap %/% 2) -1) new_values_gap <- gap / (steps + 1) new_values <- vector(...

installation - How to install and set up Neat in Gulp correctly? -

bourbon , normalize working, neat don't. tried different ways , received message 'no mixine named..', not correctly established, although installed of npm , bower var neat = require('node-neat').includepaths; .pipe(sass({ includepaths: [bourbon, normalize, neat], outputstyle: 'compressed'}).on('error', sass.logerror)) got message: error: no mixin named span-columns backtrace: src/style/main.sass:6 on line 6 of src/style/main.sass >> @include span-columns(4); -----------^ when write in sass file +outer-container or +span-columns() but saw how used.. it seems mixing versions of neat. check version many of mixins have changed or renamed. example, main column mixin in 1.x span-columns in 2.x grid-column . you can specify version want use in package.json file. if continue have issues check out https://github.com/thoughtbot/gulp-bourbon-neat-example working gulp project using bo...

css - Bootstrap 4 beta server side validation after fixing error -

i'm using bootstrap 4.0.0.beta, , can add server-side validation adding .is-invalid classes inputs invalid upon submission. however, when user fixes error in input (for example filling input required , left unfilled), input still has .is-invalid class, think can confusing user, because can think input still invalid (even if not). what elegant way address be? i'm thinking either combine client-side validation or listen changes on inputs .is-invalid class via javascript, , whenever filled, remove class. this should achieved using javascript. if keyup event suffice, can : inline javascript <input type="text" class="is-invalid" onkeyup="this.classlist.remove('is-invalid')"> jquery <input type="text" class="is-invalid"> - $('input').keyup(function () { $(this).removeclass('is-invalid'); });

r - If function in dplyr::mutate : the condition has length > 1 -

a lot of people seem have issue not able find satisfying answer. if indulge me, sure understand what's happening i'm having dates of various format in dataframe (also common issue) have built small function handle me: datehandler <- function(inputstring){ if(grepl("-",inputstring)==t){ lubridate::dmy(inputstring, tz="gmt") }else{ as.posixct(as.numeric(inputstring)*60*60*24, origin="1899-12-30", tz="gmt") } } when using on 1 element works fine: myexample <-c("18-mar-11","42433") > datehandler(myexample[1]) [1] "2011-03-18 gmt" > datehandler(myexample[2]) [1] "2016-03-04 gmt" however when using on whole column not work: mydf <- as.data.frame(myexample) > mydf <- mydf %>% + dplyr::mutate(dateclean=datehandler(myexample)) warning messages: 1: in if (grepl("-", inputstring) == t) { : condition has length > 1 , first element used 2: ...

Android cannot pass intent extras to AlarmManager -

i thought this solve problem, doesn't. i have code send alarm: public void triggeralarm() { alarmmanager alarmmanager = (alarmmanager) getcontext().getsystemservice(alarm_service); alarmmanager = (alarmmanager) getcontext().getsystemservice(alarm_service); intent intent = new intent(getcontext(), alarmreceiver.class); intent.putextra("id", nextdue.id.get() + ""); string passed = intent.getstringextra("id"); log.d("debrrug", "the im passing: " + passed); pendingintent pendingintent = pendingintent.getbroadcast(getcontext(), i++, intent, pendingintent.flag_update_current); alarmmanager.set(alarmmanager.rtc_wakeup, soonest.duetime.get(), pendingintent); } my debrrug statement indicates being passed 8. this alarm receiver: @override public void onreceive(context context, intent intent) { string passed = intent.getstringextra("id"); log.d("debrrug", ...

osx - How to avoid getting "unidentified developer" warning while running AppleScript? -

i have created applescript app. removed com.apple.quarantine using xattr command. when share app others through internet , download , run it, warning of "unidentified developer". how can avoid getting such warnings , make app working double-clicking it?

Gatling: How should I transform a binary response to json and then check it? -

i have page returns pretty big response body binary, when decoded plain text response in json format. i want transform response can traversed json , checked. for example: import org.asynchttpclient.util.base64 import io.gatling.http.response._ import java.nio.charset.standardcharsets.utf_8 // .... val read = exec(http("get results") .get("/foo?bar=baz") // response in binary .transformresponse { case response if response.isreceived => new responsewrapper(response) { override val body = new bytearrayresponsebody(base64.decode(response.body.string), utf_8) } } .check( jsonpath("$.alpha.beta").exists.saveas("gamma") ) ) but throws error: 12:54:39.387 [debug] i.g.h.a.asynchandler - request 'get results' failed user 1 java.lang.stringindexoutofboundsexception: string index out of range: 102327 @ java.lang.string.charat(string.java:658) @ org.asynchttpclient.util.base64.decode(base...

c# - How to run the rule analysis to my project. Sonarqube 6.5, MSBuild 3.0.2? -

Image
-i have msbuild in path: d:\sonarqube\bin\msbuild.sonarqube.runner.exe project want analyze in path: d:\syacsoftware\dg token-->syactoken2017:b7af44b5a98ce10e53d916b71f22a668ff93ece4 key:syac-dg -when execute commands, can't execute analysis following message: the file name, directory name or syntax of volume label not correct. this appears in sonar.login tag , in sonar.host -i using following commands in cmd, not results: the analysis worked follows: adding location of msbuild environment path, commands executed:      d: \ sonarqube \ bin \ sonarqube.scanner.msbuild.exe begin / k: "syac-dg" /n:"dg.net-wpf "/v:"2017.08.11-1.0" / d: "sonar. host.url = http: // localhost: 9000 "/d:"sonar.login=b7af44b5a98ce10e53d916b71f22a668ff93ece4"      msbuild.exe / t: rebuild      d: \ syacsoftware \ dg> sonarqube.scanner.msbuild.exe end /d:"sonar.login=b7af44b5a98ce10e53d916b71f22a668ff93ece4 "...

c# - Failing to catch the response from Task.Factory.FromAsync -

i have object public class objectlist { public string idreturn { get; set; } } while running asynchronous requests task.factory.fromasync , i'm failing catch response foreach (var obj in objectlist) { var wreq = (httpwebrequest)webrequest.create(convert.tostring(geturl)); var taskresp = task.factory.fromasync<webresponse>(wreq.begingetresponse, wreq.endgetresponse, null); taskresp.continuewith(tsk => new streamreader(tsk.result.getresponsestream()).readtoend().trim()) .continuewith((task<string> trs) => { obj.idreturn = trs.result.tostring(); }); } return jsonhelper.jsonserializer(objectlist); what missing? you're starting asynchronous operation , moving on , serializing object before asynchronous operation has finished. rather using continuewith should await value returned fromasync results, way rest of code won't continue on until after request has finished. if want reque...

tensorflow - Inference and training versions of TF graphs -

what recommended way generate graphs use @ inference time vs. training time? basically, training, graph require sorts of components data input , augmentation including custom ops, while @ inference time whole subgraph can replaced placeholder. how should typically set things up, if goal minimize size of inference time model? wouldn't want have link in of custom ops used training. my main concern "right" way of doing this. guarantee can use tf.train.saver() restore training graph inference graph without compatibility issues? a starting point ensure inference graph not have compatibility issues use metagraph. there detailed tutorial available https://www.tensorflow.org/programmers_guide/meta_graph . the primary reason recommending clear_devices flag available in tf.train.import_meta_graph can used remove device dependencies checkpoints. other benefits include ability retrieve hyper-parameters used during training , saving interesting operations (input p...

python - Script only runs till certain point in for loop, then stops with no errors:using -

i have dataframe called urlclean in form of: >>> urlclean matches searching url list url status 14 2 green index http://greenindex.timberland.com/ works as derived preliminary dataframe index "14" @ row 1. have written secondary code open url in "url list" , search possible repetitions of phrase under "searching for" (in case, green index) in text of selected url follows: for cindex, row in urlclean.iterrows(): print("starting clea nup") sentence=[] sentence=urlopen(urlclean.loc[cindex,'url list']).read() print("opening urls") soup=[] soup=beautifulsoup(sentence) print("getsoup") rsentence=[] rsentence=(soup.get_text()) print("gettect") indices = (i i,word in enumerate(rsentence) if word== (urlclean.loc[cindex,'searching for'])) print("getting indices") neighbors = [] ind...

html - How to align groups of buttons on single row with Flex only? -

i tried this: <html> <head> <title>left, mid, right action buttons</title> <style> .parent { width: 600px; background-color: yellow; } .itemleft { display: flex; justify-content: flex-start; } .itemcenter { display: flex; justify-content: center; } .itemright { display: flex; justify-content: flex-end; } .bs { background-color: green; color: white; width: 70px; } </style> </head> <body> <div class="parent"> <span class="itemleft"> <button class="bs">edit</button> <button class="bs">delete</button> </span> <span class="itemcenter"> <button class="bs">ok</button> <button class="bs">cancel</button> </span> <span class="itemright"> <button class="bs">help</button> </span>...

python - Python3: How to provide module exports as convenience at the package level? -

hopefully question won't me python hall of shame. anyway, have package poo contains single module moo . in future, there might additional modules inside poo (such poo.moose ). let's assume moo kind of main-use module , users want have things in moo ready @ hand when import poo , package. (and package users) avoid import poo.moo , import poo.moo moo , , (gasp!) import poo.* . know, saving typing thing. so idea (which not off right way) copy "exports" (functions, variables, classes, ...) of module poo.moo package poo , in __init.py__ . don't want overwrite existing definitions in poo though. what correct, good, proper, , efficient way achieve this? (did use "ideal"? nah!) or bad idea @ all? or highly spirited python in sense of "...and different"? ;) oh, packages python3 only. please note in python, how import classes module without keeping imported module's namespace? has answer, did not understand how apply __init__.py ...

wrong output in matching elements of a list of list in python -

i have list of list in python sample data looks this: list_of_list = = [['ab2768', 'new york city', '25.0'], ['ab1789', 'san francisco', '38.0'], ['ab6783', 'chicago', '7.0'], ['ab2897', 'new york city', '30.0']] what have passing 2 parameters function - id , city . in function matching if bot parameters match return third value else return 0 . here code far: def match_records(id, city): list_of_list = [['ab2768', 'new york city', '25.0'], ['ab1789', 'san francisco', '38.0'], ['ab6783', 'chicago', '7.0'],['ab2897', 'new york city', '30.0']] enrollment = '' print("searching id- " + str(id)) print("searching city- " + str(city)) idnum, cityname, val in list_of_list: print(idnum + ', ' + cityname + ', ' + val) ...

selenium - Custom x-path, select dropdown menu using class label -

i'm trying test https://matrix.itasoftware.com/ want write custom xpath using label not using firepath. select s=new select(driver.findelement(by.xpath("id(//label[text() = 'adults']/@for)"))); s.selectbyvalue("4"); please suggest better way. https://matrix.itasoftware.com/ //label[contains(.,'adults')] or //span[contains(.,'18 61 years')] can me how click on drop-menu , select number

css3 - Customize AutoComplete controlFx using Css JavaFx -

im using autocomplete textfields of controlfx api ,i want change background of autocomplete list using css .autocomplete{ -fx-background-color: red } but not give me change ,any 1 has trick customize autocomplete textfields ?

Pointing nginx container to static files in docker -

i'm new docker , nginx , might stupid question how can point nginx box @ files in rails public? basically, have nginx box, , application box. know can put files nginx box can read them. version: "3" services: api: build: "./api" env_file: - .env-dev ports: - "3000:3000" depends_on: - db volumes: - .:/app/api command: rails server -b "0.0.0.0" nginx: build: ./nginx env_file: .env-dev volumes: - .:/app/nginx depends_on: - api links: - api ports: - "80:80" ... api dockerfile: from ruby:2.4.1-slim run apt-get update && apt-get install -qq -y \ build-essential \ libmysqlclient-dev \ nodejs \ --fix-missing \ --no-install-recommends env install_path /api run mkdir -p $install_path workdir $install_path copy gemfile $install_path run bundle install copy . . expose 3000 nginx dockerfile: from ngin...

Tizen TAU is undefined -

i working on tizen wearable app (targeting version 2.3.2) using tau framework. (in fact, started out "basic tau application" template.) every time calling tau.openpopup('process-popup'); i receive typeerror: typeerror: 'undefined' not function (evaluating 'tau.openpopup('process-popup')') i have made sure, corresponding tau file embedded properly: <script type="text/javascript" src="lib/tau/wearable/js/tau.min.js"></script> <script src="app.js"></script> the file present in "lib" directory well. more interestingly, method present, when loading app in generic browser (i.e. chrome) , calling console. did experience issue himself far yet , managed solve it? what tried far: recreating project ground up. moving different version of tau lib folder. an 'import' or 'require' perhaps since trying use object app.js maybe.

python - Count occurance of values within condition between column or rows -

i have data set goes this:- 2017-03-01 31.8 28.0 32.6 2017-04-01 31.6 28.0 32.6 2017-05-01 31.0 27.0 32.6 2017-06-01 31.0 27.0 32.4 2017-07-01 31.0 27.0 31.4 2017-08-01 30.0 27.0 32.6 apart first column, rest of column temperature. compare values of 4th column (last right) other column values find if temperature values not more or less 2 deg (of 4th column). example, count how many times 3 columns (row wise) has value between 30.6 34.6. is there function available under pandas that? values of columns a b less more 2 of c in [726]: (df[['a', 'b']].sub(df['c'], axis=0).abs() < 2).all(1).sum() out[726]: 0 in [727]: (df[['a', 'b']].sub(df['c'], axis=0).abs() < 2) out[727]: b 0 true false 1 true false 2 true false 3 true false 4 true false 5 false false values between 30.6 34.6 in [671]: (df[['a', 'b', 'c']] > 30.6) ...

python - [Any suggestions on how to improve my input commands]-- SOLVED -

i looking suggestions improve, simplify or tidy input commands. have seen repetition not habit. while(char.health > 0): print("_____________________________________") line = input("\n>").lower().split() if len(line) < 1: print ("{} doesn't understand command?".format(char.name)) elif line[0] == "go": commands.movement() elif line[0] == "quit": commands.quit() elif line[0] == "rest": commands.rest() else: print ("{} doesn't understand command?".format(char.name)) i have seen people use dict : cmd = {'go' : commands.movement()} when seems run def without them being called! have figured solution out. cmd = { "go" : (commands.movement)} this new commands dict. realized commands.movement() calling def. while (char.health > 0): print("_________________________________________") ...

posthtml - get POST html code (in JAVA Eclipse) -

i searching way post html code of webpage rendered. in firefox there addon called web developper can return not "normal" sourcecode rendered sourcecode. example: https://bs.chregister.ch/cr-portal/auszug/auszug.xhtml?uid=che-230.467.384# i need html sourcecode of website includes content adress (in case "c/o nora stähelin" , "kraftstr. 1"). code looks this: import org.openqa.selenium.webdriver; import org.openqa.selenium.chrome.chromedriver; public class automation { public static void main(string[] args) { string exepath = "src\\seleniumautomation\\resources\\chromedriver.exe"; system.setproperty("webdriver.chrome.driver", exepath); webdriver driver = new chromedriver(); string url = "https://bs.chregister.ch/cr-portal/auszug/auszug.xhtml?uid=che-230.467.384#"; driver.get(url); // pre sourcecode string pagesource = driver.getpagesource(); sys...

xcode - How can I create an imageview rotate 360° infinity and smoothly in Swift? -

after spending @ least hour searching solution, have been unsuccessful. new xcode , swift struggling understand of more experienced people meaning along fact lot of answers outdated. how can create imageview rotate 360° infinity , smoothly in swift? i assume referring ios, every view layer-backed. makes easier add visual effects. to start animation: let rotation = cabasicanimation(keypath: "transform.rotation.z") rotation.byvalue = 2 * cgfloat.pi // measured in radians. positive = clockwise, negative = counter-clockwise rotation.duration = 2 rotation.repeatcount = float.greatestfinitemagnitude // forever imageview.layer.add(rotation, forkey: "myanimation") to end animation: imageview.layer.removeanimation(forkey: "myanimation") // or: imageview.layer.removeallanimations() adjust taste!

SQL to check list of value against a table column -

Image
i have table items in column logically grouped. need check list of item exists on table or not. need check exact amount of list. this table structure , if search against list ("rick" , "max), should have group id 2. but, if search "rick" shouldn't result back. you can use subquery fetch groups , names, using group by on groupid , group names comma separated( ordered ) , check input against it. for example, in mysql. select * (select groupid, group_concat(name order name) "concnames" my_table group groupid) subquerytable subquerytable.concnames= 'max,rick'; will give you: ------------------ groupid concnames 2 max,rick then check parameter against concnames column(your input names should ordered well) sql fiddle

equivalent of getbuffer for BytesIO in Python 2 -

in python 3, can size of byteio object via object.getbuffer().nbytes (where object = byteio() ), best equivalent getbuffer() in python 2? doing exploring, found out can use len(object.getvalue()) or sys.getsizeof(object) , don't know if python 2 accept them.

html - Lock a column with CSS -

edit: tried solution recommended in topic post may have been duplicate of. copy , pasted solution jsfiddle.net/djqpf/7/ john.nichel.net/test2.html (i don't have enough rep post 2 links can't give http) , doesn't scroll @ all. i'm looking lock 1 or 2 columns of data in table or div using css, meaning other columns scroll locked ones not. i've tried few jquery plugins , many of css/div examples i've found but, whatever reason, can't make unlocked columns start after locked one. i've tried positions absolute, fixed, relative, etc., can't seem these examples work. how can achieve this? the code below @ http://john.nichel.net/test.html can see how locked column displayed on other columns. i'm going keep working on this, code on site different i've posted below. .table { display: table; } .header { display: table-header-group; font-weight: bold; } .rowgroup { display: table-row-group; } .row { display:...

javascript - Jsp Alert If else statement -

for following want run script see if string equal when button clicked. <wts:input label="chemical name todo" inputid="synname" path="chemicalname" maxlength="100" size="100"></wts:input> <div class="form-group"> <div class="col-md-offset-2 col-md-2"> <input type="submit" value="search" id="searchbutton" class="btn btn-primary" onclick="unknownalert()" /> <c:if test="${techview}"> <input type="hidden" name="techview" value="${techview}"> </c:if> <input type="reset" value="reset" id="resetbutton" class="btn btn-default"/> </div> </div> <script> function unknownalert() { if($(...

haskell - What is the nicest way to make a function that takes Float or Double as input? -

say want implement fermi function (the simplest example of logistic curve) if it's passed float returns float , if it's passed double returns double . here's i've got: e = 2.7182845904523536 fermifunc :: (floating a) => -> fermifunc x = let 1 = fromintegral 1 in one/(one + e^(-x)) the problem ghc says e double . defining variable one kinda gross. other solution i've thought of define function doubles: e = 2.7182845904523536 fermifuncdouble :: double -> double fermifuncdouble x = 1.0/(1.0 + e^(-x)) then using either : fermifunc :: (floating a) => either float double -> fermifunc right x = double2float (fermifuncdouble (float2double x)) fermifunc left x = fermifuncdouble x this isn't exciting though because might have written separate function float case handles casting , calls fermifuncdouble . there nice way write function both types? don't write e^x , ever, in language. not exponential function, it's power...

javascript - How to get the Response Code Error from $ajax? -

i code number, example 1 below: (500). and go through error able show "code", "requestid" , "message". here examples of code , possible error may appear user. code example: <script type="text/javascript"> $(function() { var params = { // request parameters "visualfeatures": "categories", "details": "{string}", "language": "en", }; $.ajax({ url: "https://westus.api.cognitive.microsoft.com/vision/v1.0/analyze?" + $.param(params), beforesend: function(xhrobj){ // request headers xhrobj.setrequestheader("content-type","application/json"); xhrobj.setrequestheader("ocp-apim-subscription-key","{subscription key}"); }, type: "post", ...

c# - How to pass a Dependency from a Test Project to a Concrete Implementation in DryIoc -

i'm sorry don't have code share because i'm not sure how work. i have test project called api.tests , i'm writing tests newscontroller within api project. i'm not sure how pass dependency tests api since it's one-way reference. newscontroller private igetnews _getnews; private iaddnews _addnews; private iloggingservice _log; public newscontroller() { _getnews = registerdependencies.container.resolve<igetnews>(); _addnews = registerdependencies.container.resolve<iaddnews>(); _log = registerdependencies.container.resolve<iloggingservice>(); } your current code using service locator anti-pattern. makes controller tightly coupled dependencies , difficult test in isolation. need invert dependencies. (ie: dependency inversion) refactor controller use explicit dependencies via constructor injection. public class newscontroller { private readonly igetnews getnews; private r...

Bad checksum error with Ansible win_template -

i've made first playbook targets windows hosts , i'm having trouble creating config file jinja2 template. the playbook split multiple roles. this particular task, creates config file, in 1 of roles (app-framework). the templating of config file has worked in role reason failing now, , can't figure out changed break it. win_template throws error "copied file not match checksum.". $ ansible-playbook main.yml --step -vvvv ... ... ... task [app-framework : create config file] ************************************************************************************************************* task path: /opt/oll/ansible/playbooks/win_imx/roles/app-framework/tasks/main.yml:101 using module file /usr/lib/python2.7/site-packages/ansible/modules/windows/win_stat.ps1 exec (via pipeline wrapper) exec (via pipeline wrapper) exec (via pipeline wrapper) using module file /usr/lib/python2.7/site-packages/ansible/modules/windows/win_stat.ps1 exec (via pipeline wrapper) ...

winforms - C# Create, check, loop through objects -

such weird situation appears in front of me. here thing. if in php or other programming language easy in c# dont know how can achieve this. brief description of problem: i have userform in c# combobox. in combobox have many items there in database -> dynamically filled on start of application each item should represent single userform. here problem, if user choses item , clicks on button check should fired if userform has been created, if not, new (object ?) userform must created. delete , recreate new form everytime user choses new option want keep userforms , create them once , hide them or show them, textinputs etc. remain filled while application run (but dont thing creating 15-20 userforms @ start of app okay in terms of performance). so thinking of doing , tried: i wanted use name of chosen item combobox , use object (userform) name. (also perform check if exists before creating) -> apparently not possible in c# use string variable object name i googled dic...

Move the checkboxes to the left in phpmyadmin -

Image
i have simple issue unable resolve. in phpmyadmin, i'd checkboxes "delete, copy, edit" column on left instead of right. example of have checkboxes on right: example of need the checkboxes on right: i looked through options , tried drag column didn't work. idea? the configuration directive $cfg['rowactionlinks'] 1 need set 'left' : https://docs.phpmyadmin.net/en/latest/config.html#cfg_rowactionlinks

python - How to stop PyCharm from closing networked folders -

i've been testing out pycharm ran crazy little feature , or bug , cannot figure out how solve it. i've created project on network, , created project locally , added network folder project both resulting in same bizarre behavior. i can open files, navigate project tree , fine inside of pycharm. once switch focus window , come pycharm, automatically close entire project tree root , close files have had open. this making pycharm unusable. i've been searching of morning find out how stop haven't come across other similar problems. to test, made sample python directory on network, filled few folders simulate modules , added init .py files them all. created pycharm project in folder. exhibit behavior , can't figure out how stop closing everything. what's going on? this windows community pycharm 2017.2.1 version. picture open , closed , tree view, since closes when regains focus. i'm not sure how i'd best take picture of that.

javascript - how to access properties of json string -

i have json string coming database table has empty root element name {"": [ {"id":18,"menuname":"dsadasdasd","isactive":"inactive"}, {"id":17,"menuname":"karachi","isactive":"active"}, {"id":2,"menuname":"user management","isactive":"active"}, {"id":1,"menuname":"home","isactive":"active"} ]} i trying access json below jquery ajax call method function get_datatable() { $.ajax({ url: "gridview_jqueryfunctionality.aspx/calldatatable_emptyrootname", type: "post", data: '{}', contenttype: "application/json; charset=utf-8", datatype: "json", success: function (data) { alert(data.d) // showing json fine var mydata = $.parsejson(data.d); ...

python - What are the default values set to in a slice? -

i have had @ top answers on why-does-list-1-not-equal-listlenlist-1 , what-are-the-default-slice-indices-in-python-really learn default values set in slice. both of top answers refer following documentation: given s[i:j:k] , if or j omitted or none, become “end” values (which end depends on sign of k). note, k cannot zero. if k none, treated 1. suppose have following code: s = "hello" forward_s = s[::1] print(forward_s) # => "hello" backward_s = s[::-1] print(backward_s) # => "olleh" i know if indices omitted python treats if value of none used in places. according documentation indices of i , j in [i:j:k] set "end" values depending on sign of k . positive k , i'm assuming i set 0 , j set length of string. values set negative k though? for instance, following reverses string: reversed_str = s[-1:-6:-1] so maybe default value i set -1 , j set -len(s) - 1 when k = -1 ? the default values ...

sql server - Single SQL Query to Get Task Status -

i appreciate community can offer helping me write sql query achieve following, or, if not possible, offer method so. objective: return result below: subtaskid | subtaskqueueid | subtaskname | timecomplete | jobid | approver --------- | -------------- | ----------- | ------------------- | ------| -------- 23 | 2 | review #1 | 2017-08-14 00:00:00 | 840 | bill 24 | 2 | review #2 | 2017-08-14 01:00:00 | 840 | john 25 | 2 | review #3 | null | 840 | null 26 | 2 | review #4 | null | 840 | null the source tables: job_subtasks_status jobid | subtaskid | timecomplete | approver ----- | ------------ | ------------------- | -------- 840 | 23 | 2017-08-14 00:00:00 | bill 840 | 24 | 2017-08-14 01:00:00 | john job_subtasks subtaskid | subtaskqueueid | subtaskname --------- | -------------- | ----------- 23 | 2 ...

java - Sending data from FragmentController's onActivityResult to Fragment -

hello have problem sending string fragmentcontroller fragment because onactivityresult in fragmentcontroller done later creating of fragments theirs ui's. want pass string fragmentcontroller , show textview in fragment. my fragmentcontroller: public class fragmentcontroller extends appcompatactivity implements home.onfragmentinteractionlistener, certificate.onfragmentinteractionlistener, challenges.onfragmentinteractionlistener, googleapiclient.onconnectionfailedlistener{ private googleapiclient googleapiclient; private static final int req_code = 9001; private string name = null; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_fragment_controller); googlesigninoptions signinoptions = new googlesigninoptions.builder(googlesigninoptions.default_sign_in).requestemail().build(); googleapiclient = new googleapiclient.builder(this).en...

matlab - Creating 3D model from cross-sectional images and normal vectors -

i'm trying map series of binary images 3d space based on pixel position q,p , image's location , normal vector. each image (829x829), have x,y,z position of center , dx,dy,dz across transducer (the normal vector out of image, values in mm). know physical diameter of images (30 mm), i'm able interpolate each pixel's position in reference known centerpoint. important note cannot measure rolling of image (rotation center), assume image oriented height axis in xy plane. my current method create rotation matrix , local x,y,z each pixel of each frame, transform them multiplying matrix this: for frame=1:numberofframes %create unit normal vector vz = [dx,dy,dz] / norm([dx,dy,dz]); %define x unit vector upwards, y unit vector orthogonal both vx = cross([0,1,0],vz); vy = cross(vz,vx); %create rotation matrix r = [vx(1) vy(1) vz(1); vx(2) vy(2) vz(2); vx(3) vy(3) vz(3)]; z = zposition(frame); q=1:height x = xposition(fra...

css - Flicker while scrolling down in Safari -

i want embed monaco editor in page under fixed texts, want height of monaco editor fill rest of page. people gave me answer ( jsbin ): <html> <style> body { margin: 0; height: 100%; } .rb { height: 100%; display: flex; flex-direction: column; } .myme { flex:1; background: grey; } #container > * { max-height:100%; overflow:auto; } </style> <body> <div class="rb"> <div class="top">1<br/>2<br/>3<br/>4<br/></div> <div class="myme" id="container"></div> </div> <script src="https://www.matrixlead.com/monaco-editor/min/vs/loader.js"></script> <script> require.config({ paths: { 'vs': 'https://www.matrixlead.com/monaco-editor/min/vs' }}) ...

Amazon Product Variation Images different than what is on the listing? -

how can display images on product variation selections different on listing b01kimxi7q? the product variation selections show small images display "100 pack, 1k pack, 200, pack, etc." however, these images cannot found secondary images on of listings. how can create similar listings? this can accomplished using "swatch" images. product detail pages show main image parent products. swatches child products, if available, appear below main image 30 x 30 pixel thumbnails. swatches customers see other aspects of product, such color or detail. you can supply 1 swatch per child sku.

WCF base address confusion -

i following common icalculator example creating , self-hosting wcf service. the config file service contains endpoint, specify base address. address " http://localhost:8733/ ...". in self-host app (console), specify base address uri of " http://localhost:8000/ ...". i not understand how these base addresses related. examples check service checking host address in browser. works fine. why isn't service address available in same way? what servicehost class doing? obviously, listening port 8000. listening 8733? if so, why can't access through browser? when debugging(f5) service class library, visual studio brings wcf test client", shows service address on port 8733. when watching ports network tool (tcpview), not see activity on port 8733 until start client app. can explain going on? service , apps works fine, guess can things done, know happening.