Posts

Showing posts from 2010

c# - Drag file from WPF App -

i find lot of samples describe how drag file wpf app. need export .txt or .csv file app when user try drag listbox item. var filestream = file.create(@"c:\users\myuser\documents\test.txt"); var barray = encoding.unicode.getbytes("some text"); filestream.write(barray, 0, barray.length); //filestream.close(); dataobject data = new dataobject(dataformats.filedrop, filestream); dragdrop.dodragdrop(this, data, dragdropeffects.copy); //filestream.close(); but if release on desktop there isn't file copied. wrong? the reason file drop not working not providing list of files paths requirement clipboard format. fix this... var filename = @"c:\users\myuser\documents\test.txt" var filenames = new string[] { filename }; var filestream = file.create(filename); var barray = encoding.unicode.getbytes("some text"); filestream.write(barray, 0, barray.length); filestream.close(); dataobject data = new dataobject(dataformats.filedrop, filena

javascript - Best way to resolve escaped characters in a database -

i have populated mysql database outputs json data consumed , displayed via angularjs. of text strings in database have escaped quotes , double quotes like: have @ least bachelor\'s degree in child development? or asking children address \"ma\'am\" or \"sir\" formalize things the problem angularjs still displays strings escaped quotes. best way avoid this? do search , replace on database substituting escaped substrings (\',\") else? outputs displayed in angularjs ng-model directive: ... <div class="bs form-group" ng-if="quiz.quizmanager.quiz.questions[quiz.activequestion].quiz_question_type === 'text'"> <input type="text" class="form-control" ng-model="quiz.quizmanager.quiz.questions[quiz.activequestion].answer" ng-change="quiz.selectanswer(0, quiz.quizmanager.quiz.questions[quiz.activequestion].quiz_question_type)"

javascript - type="number" but still requires a text to number conversion -

i've element (x) of type=number. in work verify it's value number before performing mathematical operations i've concluded elements of type "number", while having builtin validation , helpful input controls, still assign values text , require conversion number before performing mathematical operations. question - true or there wrong in code? here's work. entered number 6. x = document.createelement("input"); x.type = "number"; x.step = "0.1"; x.min = "0"; x.max = "9999"; x.defaultvalue = "1"; var p = document.getelementbyid(x.id).value; isthisnumber(p); function isthisnumber(z) { alert(typeof z + " --- " + typeof (z)); // returns "string --- string" if (z.isnan) { alert("it's not number"); } else { alert("it's number"); // returns false - it's number }

javascript - Waiting for ng-repeat to finish rendering before attempting to lookup element? -

i have seen this answer , have created similar directive can confirm does fire event, , data associated ng-repeat does contain data. (at first thought perhaps ng-repeat rendered once before data set, not seem case. i need reference element created in ng-repeat done rendering. selecting class angular.element(".some-class") . can confirm selector working running line on console after page has loaded. however, seems event not accurate because @ time event fired there no elements on page. possibly relevant: the ng-repeat repeating ng-include . the element i'm trying reference highest level element within ng-repeat element. event emitter: angular.module('onfinishrendermodule', []) .directive('onfinishrender', function ($timeout) { return { restrict: 'a', link: function (scope, element, attr) { if (scope.$last === true) { $timeout(function () { scope.$emit(attr.eventname ? attr.e

elasticsearch - Using C# params with serilog -

just starting using serilog + elasticsearch , wondering if there elegant way log params object array in 1 log entry. far way have been able manage looping through each params creates separate log entry each one. way combine them 1 log entry? thanks! sample: public static void methodentry<t>(string methodname, params object[] parameters) { if (parameters.length > 0) foreach (var param in parameters) // create parameters.length number of log entries log.forcontext(typeof(t)).debug("entering {methodname} {@param}", methodname, param); else log.forcontext(typeof(t)).debug("entering {methodname}", methodname); } edit: sinks used: serilog serilog.sinks.elasticsearch (which includes file, periodicbatching, & rollingfile sinks) couple enrichers environment , threadid if know specific type of sender object can use following feature of serilog avoid logging of not required information: log.logg

java - Can't Connect To Tomcat Manager Using Pivotal-tc-server -

i've been trying invoke tomcat manager linux vm, continue receive err_connection_timed_out. i can confirm process running , i'm using correct port tomcat started. status: running pid=13544 # netstat -pl | grep 13544 tcp 0 0 *:23900 *:* listen 13544/java i've added manager-gui role tomcat-users.xml still no luck. if helps followed steps here https://tcserver.docs.pivotal.io/docs-tcserver/topics/postinstall-getting-started.html#postinstall-deploy-apps

svn - Apache webserver Require valid-user leads to internal server error -

i'm setting svn server , want restrict access users have log in first before can view/modify files. dav_svn.conf looks this: <location /svn> dav svn svnparentpath /home/pi/repos # authentication: digest authname "subversion repository" authtype digest authuserfile /etc/apache2/svn-auth.htdigest # authorization: authenticated users require valid-user </location> when try access webpage shows "internal server error". looking inside "/var/log/apache2/error.log" shows following line: [mon sep 11 20:36:47.755229 2017] [authn_core:error] [pid 30331:tid 1972368432] [client 192.168.0.103:59263] ah01796: authtype digest configured without corresponding module, referer: http://192.168.0.100/svn/a/ i can "fix" error changing dav_svn.conf putting xml tag around "require valid-user": <limitexcept propfind options report> require valid-user </limitexcept> however, open viewing ri

python - scipy.interpolate.griddata sensitivity to original grid -

Image
i using scipy.interpolate.griddata in order interpolate data original grid sub-region of grid @ higher resolution. in order speed computation, instead of using whole original data, used part contains target region (with buffer). surprise, obtain different results if use linear interpolation, in middle of subregion. the code follows illustrate this. wondering if expected or if bug in griddata. notice if use 'nearest' instead of 'linear' in code differences null, expected. any appreciated. # modification expample 1 of # http://scipy-cookbook.readthedocs.io/item/matplotlib_gridding_irregularly_spaced_data.html # show problems griddata import numpy np scipy.interpolate import griddata import matplotlib.pyplot plt import numpy.ma ma # generate inital fields on 2d grid x = np.arange(-2,2.1,0.1) y = np.arange(-2,2.1,0.1) x2d, y2d = np.meshgrid(x,y) z = np.abs(x*np.exp(-x2d**2-y2d**2)) + 1 # define target grid # (sub region of initial grid finer mesh) x_target =

Angular 2 - Move form validation to directive -

Image
i move form validation directive , keep ngform validation across fields in form. in following example move input text field of following validation (1. works), directive. when move directive, model updated correct, form.valid operation not effected directive. form not valid, because input text has no value. when given value butten activated , form valid. 1. works: <form (ngsubmit)="onsubmit()" #aliasform="ngform"> <div class="form-group"> <label for="firstname">fornavn</label> <input type="text" class="form-control" id="firstname" required [(ngmodel)]="model.primaryalias.firstname" name="firstname" #name="ngmodel"> <div [hidden]=&quo

How can I distinct a set of rows with collapsed columns in postgresql? -

for instance, have table id_plant | name | petals ----------+------+-------- 12 | foo | 3 13 | bar | 3 14 | foo | 6 i need distinct name , have array petals values. entry foo : result : name | petals ------+-------- foo | [3, 6] use array_agg(). with my_table(id_plant, name, petals) ( values (12, 'foo', 3), (13, 'bar', 3), (14, 'foo', 6) ) select name, array_agg(petals) petals my_table group name; name | petals ------+-------- foo | {3,6} bar | {3} (2 rows)

python - Error message shows even when answer is valid -

this question has answer here: how test 1 variable against multiple values? 16 answers this first course in coding , don't know how use file=sys.stderr correctly. i trying y or n input user , have error message show when answer neither of those. this code: aches = input("aches (y/n): ") if aches != 'y' or 'n': print ("error!",file=sys.stderr) aches= aches.casefold() thank you! it's if aches != 'y' , aches != 'n': . if aches != 'y' or 'n' evaluated if (aches != 'y') or ('n') == if (aches != 'y') or true . guess you're looking if aches not in ['y', 'n']: . better approach if aches.lower() not in ['y', 'n']: , not consider 'y' , 'n' error.

php - Updating Google Custom Search CSE on custom Wordpress theme -

i don't have experience in php i'm trying update website's custom theme code use new google cse. website set header has search bar redirects search results page. search bar code in header.php follows: <form method="get" action="<?php bloginfo('url'); ?>" class="ui-form dark search"> <label for="f-search"><i class="icon-search"></i> <span class="alt">search</span></label> <input type="text" name="s" id="f-search" placeholder="search" /> </form> the search results page: <script src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load('search', '1'); google.setonloadcallback(function

scala - build a 2D lookup table from Spark Dataframe -

i convert smaller dataframe become broadcast lookup table used inside udf of larger dataframe. smaller dataframe ( mylookupdf ) may below: +---+---+---+---+ | x | 90|100|101| +---+---+---+---+ | 90| 1| 0| 0| |100| 0| 1| 1| |101| 0| 1| 1| +---+---+---+---+ i want use first column first key, x1, , first row second key. x1 , x2 have same elements. ideally, lookup table ( mylookupmap ) scala map (or similar) , work like: mylookupmap(90)(90) returns 1 mylookupmap(90)(101) returns 0 mylookupmap(100)(90) returns 0 mylookupmap(101)(100) return 1 etc. so far, manage have: val mylookupmap = mylookupdf.collect().map(r => map(mylookupdf.columns.zip(r.toseq):_*)) mylookupmap: array[scala.collection.map[string,any]] = array(map(x -> 90, 90 -> 1, 100 -> 0, 101 -> 0), map(x -> 100, 90 -> 0, 100 -> 1, 101 -> 1), map(x -> 101, 90 -> 0, 100 -> 1, 101 -> 1)) which array of map , not required. suggestions appreciated. collect() creat

java - Splitting String based on occurance -

i want split string based on first occurrence when try use string.split("\_",1) - gives me arrayoutofbounds exception array[0] = "this_first"; array[1] = "not_first"; array[2] = "maybe_like_this"; array[3] = "this_is_definitely_it"; for(int i=0;i<array.length;i++){ tmparr = array[i].split("\\_"); firstword = tmparr[0]; system.out.println(firstword); tempstring = tmparr[1]; i want first word in tmparr[0] , rest in tmparr[1]. please advice the limit parameter string#split(string, int) defined little bit strangely. go , read javadoc, particularly paragraph starting "the limit parameter...". tl;dr: need this: tmparr = array[i].split("_", 2); (backslash not required)

angular - Get value observable directly without subscribing to it -

i have activatedroute instance 'route' alert(this.route.data) gets me [object object] . thats route configuration object: { path: 'create', component: mycomponent, data :{ firstname: 'pascal'} }, i want directly firstname within component! how can that? when have activated route there not need subscribe static data, how data then?

android - Blur Background when fragment Show and when API < 23? -

is way blur background when fragment show? every ways tried. when called getforeground in: (container.getforeground().setalpha(5)).. it show me error under ( getforeground ) (must api >=23) and application minsdkversion = 14 any way implement method or class blur background when sdk < 23 or when sdk = 14? you can try using getforeground() method within framelayout: container = (framelayout) findviewbyid( r.id.container); container.getforeground().setalpha(5); // 0 (opaque) -> 255 (invisible) or using view.setalpha(float) : your_view_name.setalpha(0.5); // 0 (transparent) -> 1 (opaque)

datagridview cell formatting after data has been loaded from database -

please help!! i've spent 4 hours trying figure out , haven't been able make work. cannot format of datagridview cells after loading data access db. program runs , returns no errors, no satisfactory results. need format "description" red color there's no "numero" try con.open() da.fill(dt) con.close() dgvmain.datasource = dt dgvmain .columns("key").visible = false .columns("masterid").visible = false .columns("numero").headertext = "#" .columns("numero").defaultcellstyle.alignment = datagridviewcontentalignment.middleright .columns("numero").sortmode = datagridviewcolumnsortmode.notsortable .columns("numero").width = 40 .columns("addemdum").visible = false .columns("opens").visible = false .columns("descriptio

Spring Rest returning Json with @id -

see me classes: user.class package br.com.well.modelo; import java.io.serializable; import javax.persistence.entity; import javax.persistence.fetchtype; import javax.persistence.generatedvalue; import javax.persistence.generationtype; import javax.persistence.id; import javax.persistence.joincolumn; import javax.persistence.manytoone; import javax.persistence.table; import org.hibernate.annotations.cascade; import org.hibernate.annotations.cascadetype; import org.hibernate.annotations.fetch; import org.hibernate.annotations.fetchmode; import com.fasterxml.jackson.annotation.jsonidentityinfo; import com.fasterxml.jackson.annotation.jsonignoreproperties; import com.fasterxml.jackson.annotation.objectidgenerators; @entity //@jsonidentityinfo(generator=objectidgenerators.intsequencegenerator.class, property="@id") @jsonidentityinfo(generator=objectidgenerators.intsequencegenerator.class) @jsonignoreproperties(ignoreunknown = false) @table(name = "users")

C++ | Boundary Condition For Graphic -

my c++ knowledge pretty new i've been coding in java past 2 years. decided i'd take leap of faith , learn new language. anyway, i've been following amazing sfml tutorial online , realized little easy tastes wanted create boundary these ball objects coding can bounce around in provided window. surprise, algorithm failed me. i'm going show reduced version of guys online tutorial red circle object. #include "stdafx.h" #include <sfml/graphics.hpp> int main() { sf::renderwindow window(sf::videomode(800, 600), "variables demo"); sf::circleshape circlered(10);//radius 10 circlered.setfillcolor(sf::color(255, 0, 0));//color red float x = true; float y = true; float xred = 100; float yred = 100; circlered.setposition(xred, yred); while (window.isopen()) { sf::event event; while (window.pollevent(event)) { if (event.type == sf::event::closed) window.close(); } window.clear(); //x ,

Dynamic form using AngularJS, multiple values binding -

i looking best approach convert static form angular dynamic form. not sure how bind multiple values same answer. the static page available at: https://jsfiddle.net/hvuq5h46/ <div ng-repeat="i in items"> <select ng-model="i.answer" ng-options="o.id o.title o in i.answersavailable" ng-visible="y.type = 'single'"></select> <input type="checkbox" ng-model="i.answer" ng-visible="y.type = 'multiple'" /> </div> the json file [ { "id": 1, "title": "are student?", "type": "single", "answersavailable": [ { "id": 1, "title": "yes" }, { "id": 2, "title": "no" } ], "answer": [ 1 ] }, { "id": 2, "title": "woul

amazon rds - Why can't DataGrip create a PostgreSQL table but PGAdmin can? -

all, i'm trying run basic create table expression using results of query. the expression is: create table burglaries_nhood ( select n.nbhd_id , n.nbhd_name , n.geom , count(*) count_burglaries denver.crime c join denver.neighborhoods n on st_intersects(c.geom, n.geom) c.offense_ty 'burg%' group n.nbhd_id, nbhd_name, n.geom ) and error is: [2017-09-11 19:38:41] [25006] error: cannot execute create table in read-only transaction [2017-09-11 19:38:41] summary: 1 of 1 statements executed, 1 failed in 669ms (298 symbols in file) using pgadmin, query executes fine. the server running in amazon rds postgresql 9.5 instance. what datagrip cause error show while pgadmin run? update based on comment below: running: select current_setting('transaction_read_only'),pg_is_in_recovery()‌​; in pgadmin yields: current setting, boolean "off";f in datagrip yields: current setting, boolean on, [] i'm not

rest - What is the difference between DTOs and API Resources -

i going through asp.net core tutorials , articles on how make restful api. me, seems in newer demos/articles, people refer dtos api resources. these 2 same concept different names or there difference between two? there standard/convention follow or opinion based? in rest or web api, resource object methods operating. example, list of contact, specific contact id, update contact, delete contact - contact resource. a dto (data transfer object) 1 way of implementing such resource. used when api modifying data in relational database. people have discovered pitfalls returning contact database entity directly client on web api. map contact entity contact dto. so web api resource might dto doesn't have be. depend on situation. imagine have web api get/set time of day on device. wouldn't need create dto this, use string representing date. in case resource of api string.

c# - UWP/Windows Phone Apps System resource management -

i writing uwp app makes use of camera snap photo. when run app on phone able snap photo. there few bugs, of think can work out, big problem occurs when try use stock camera app after suspending app. if explicitly terminate camera app have no problem using stock camera app. far i've tested on lumia 830 , lumia icon , both phones struggle launch stock camera app , both unable save picture after picture taken. have noticed similar problem media player on every windows phone have owned. if using podcast app , try switch spotify app phone struggles make transition system resources 1 app app. there way release phone's camera resources when app suspended. here snippet of event handler using snap picture: private async void camerabutton_click(object sender, routedeventargs e) { cameracaptureui snapphoto = new cameracaptureui(); snapphoto.photosettings.format = cameracaptureuiphotoformat.png; snapphoto.photosettings.allowcropping = true;

css - ionic icon how to show color -

Image
icon name: moment.png this icon real color but when input in scss file, color changed black , white this scss file ion-icon { &[class*="minan-"] { // instead of using font-based icons // we're applying svg masks mask-size: contain; mask-position: 50% 50%; mask-repeat: no-repeat; background: currentcolor; width: 1em; height: 1em; } &[class*="minan-wechatmoment"] { mask-image: url(../assets/icon/moment.png); } }

apache spark - Calling pipe() from a PairRDD and passing a Java Object to it -

i have pairrdd javapairrdd<string, graph> graph java object created using pairfunction<row, string, graph> pairfunction = new pairfunction<row, string, graph>() { private static final long serialversionuid = 1l; public tuple2<string, graph> call(row row) throws exception { integer parameter = row.getas("foo"); string otherparameter = row.getas("bar"); graph graph = new graph( parameter, otherparameter ); string key = somekeygenerator(); return new tuple2<string, graph>( key, graph ); } }; now need run external program using mypairrdd.pipe('external.sh') think spark pass graph object external.sh via stdin. i need access graph.parameter , graph.otherparameter inside external.sh . how manage situation? found !! just need override tostring() method of pojo (graph) expose desirable attributes !!!

java - Can we use multiple yaml files in a single spring boot application? -

i have 1 yaml file reads environment profiles. need yaml file create feature switch can turn on/off during deployment. , how can define feature switch in properties file. yes, can use multiple yaml files if use spring profile . example, if start jvm following flag: -dspring.profiles.active=deployed,cassandra it pick following application yaml files: application.yml , application-deployed.yml , , application-cassandra.yml

javascript - When an object gets stored in memory, does the value only get stored or does it get stored as an object? -

when value gets stored in memory, understand value gets stored in memory when comes objects, how stored in memory? the following gives idea on how objects stored in memory: most objects contain properties in single block of memory ("a", , "b"). blocks of memory have pointer map, describes structure. named properties don't fit in object stored in overflow array ("c", , "d"). numbered properties stored separately, in contiguous array. for more read here .

java - How do i get a 2 decimal answer in this code? because i get more than 2 -

this question has answer here: how round number n decimal places in java 28 answers import java.util.scanner; public class bmi { public static void main(string[] args) { scanner scan = new scanner(system.in); float height,heightsquared,bmi; int weight; system.out.println("your height in meters:"); height = scan.nextfloat(); system.out.println("your weight in kilograms:"); weight = scan.nextint(); heightsquared = (height*height); bmi = weight/heightsquared; if (bmi < 18.5) { system.out.println("your bmi result:"+ bmi + "(under-weight)"); } else if (bmi > 18.4 && bmi < 24.6) { system.out.println("your bmi result:"+ bmi + "(normal-weight)"); } else

Python webApp2 json.encode Object within another Object Error -

i unsure why not being able json encode object has object within it. below have added declarations of 2 classes. #bam class object class bam(object): def __init__(self, name, id, test): self.name = name self.id = id self.test = test # test class object class test(object): def __init__(self, test_name): self.test_name = test_name this having issues. when json.encode following error: main.test not json serializable. objtest = test('hay!') objbam= bam('hi', 1, objtest) self.response.write(json.encode(objbam.__dict__)) any feedback appreciated. thanks in advanced.

php - When I'm upload picture to 000webhost is not truely uploaded always 0.1kb that stored -

hi i'm new php language , trying upload picture web host, , i'm using www.000webhost.com, have problem upload when i'm trying upload picture using postman show success, when i'm check in file manager show 0.1kb. this when testing using postman when check file manager and code databaseconfig.php <?php $hostname = "localhost"; $hostuser = "id2880262_leonheart"; $hostpass = "123456"; $databasename = "id2880262_db_image"; ?> img_upload_to_server.php <?php include 'databaseconfig.php'; // create connection $conn = new mysqli($hostname, $hostuser, $hostpass, $databasename); if ($_server['request_method'] == 'post') { $defaultid = 0; $imagedata = isset($_post['path_name']) ? $_post['path_name']:''; $imagename = isset($_post['name_commend']) ? $_post['name_commend']:''; $getoldidsql = "select id image_upload order id

c - Beginner: syntax error before int main () -

i'm trying run hello world program getting error ./ex1.c: line 3: syntax error near unexpected token `(` ./ex1.c: line 3: `int main (int argc, char *argv[])' or ./ex1.c: 3: ./ex1.c: syntax error: "(" unexpected or ./ex1.c:3: unknown file attribute: ./ex1.c:4: parse error near `}' the weird thing i've run same program before , had no issues. not sure if these issues related problem happened after installed valgrind run exercise 4 in learn c hard way. received error said permission denied fixed using chmod +x . .c files needed permission had not before. did chmod -r 0777 directory of .c practice files. permission problem fixed error above started. may completed unrelated wanted include in case. you can't run .c file using ./ex1.c ; have compile runnable program first. assuming have linux/os x machine, use gcc -wall ex1.c -o ex1 compile (or, more simply, make ex1 ). can ./ex1 run program.

ios - Alamofire Async time in Swift3 -

i have complicate problem me, seems alamofire async problem, , tried find solution here, didn't.. can extract other information in photoasset(i used dkimagepickercontroller), image , creation date..etc. i'd reverse-geo coding using google api, that's why need use alamofire. imagelist return yes, dkassetlist yes, addresslist use alamofire return nil!! please me problem.. below code. @iboutlet weak var imagecollectionview: uicollectionview! var imagelist:[uiimage] = [] var addresslist:[string]? var dkassetslist:[dkasset] = [] var locationinfo:[photolocationinfo] = [] var datelist:[date] = [] @ibaction func imagepickerbuttontouched(_ sender: uibutton) { let pickercontroller = dkimagepickercontroller() pickercontroller.didselectassets = {[unowned self](assets: [dkasset]) in asset in assets { self.dkassetslist.append(asset) print(self.dkassetslist) let assetlocation = asset.location?.coordinate let a

javascript - Bootstrap Tabs Animation -

i tried animate bootstrap tabs adding css class it's not working, simple idea animate tabs content based on bootstrap class .active, problem transition not working: .tab-content .tab-pane h3 { opacity: 0; -moz-transform: translate(-10px, -10px) rotate(30deg); -ms-transform: translate(-10px, -10px) rotate(30deg); -o-transform: translate(-10px, -10px) rotate(30deg); -webkit-transform: translate(-10px, -10px) rotate(30deg); transform: translate(-10px, -10px) rotate(30deg); transition: .5s ease-in-out; } .tab-content .active h3 { opacity: 1; transform: translate(0); } <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" /> <div id="extab1

amazon web services - AWS Lambda time out in 6 seconds -

i using serverless framework nodejs(version 4.4) create aws lambda functions. default timeout 6 seconds lambda execution. connecting mysql database using sequelize orm. see errors execution timed out . code works error. nothing works after timeout error. hard me make sense out of timeout. afraid increasing timeout incur more charge. if seeing errors 'execution timed out' cutting execution of lambdas low timeout. there might several reasons this: the initialization of container can slow, should occur first call of container. if have low memory setting , load lots of libraries can happen takes quite while(usually shouldn't problem node) connecting database can slow if reuse database connections, it's possible stale , can lead timeout. your database queries may slow. to mitigate problem should temporarily add logging lambda , increase timeout, can figure out takes long. unless heavy lambda user unlikely use 400.000 free gb-seconds month. if run la

angular - ngIf with viewchild -

i'm new @ angular2 , not professional. have parent-child component want when user click on button selector of child component show something. should condition , used child component. here codes: parent html: <div *ngif="page2"> <add-property-page2></add-property-page2> </div> <div class="text-center col-sm-12"> <button [disabled]="!propertyform.form.valid" (click)="onsubmit($event,value,amlak)" type="submit" class="btn btn-success">continue </button> </div> and parent component: import {component, oninit, viewchild, viewencapsulation, input } '@angular/core'; import {amlak} '../models/amlak'; import {addpropertypage2component} './add-paroperty-page2.component'; @component({ selector: 'add-property', styleurls: ['./selection.css'], templateurl: './add-property.ht

jquery get the input box value -

i have multiple text boxes , trying value of text boxes based on button click, , value of text box should shown. // html code here <div class="addtext"> // input box value <input type="text" id="textval" placeholder="enter text" class="enter-text" name=""> // div of buttons add , update text <div class="buttonset"> // add button <button id="addtextbtn" class="left">add text</button> // update button <button id="updatebtn" class="right">update text</button> </div> // below code tried not able previous text box value // button click event here jq('body').on(opc_eventtype, '#addtextbtn', function() { // getting text box value here var val = jq(this).prev().prev("input[type=text]").val(); // print on console console.log(val); first of ne

c# - Dependency Injection with inheritance -

i'm using pipeline build mediatr. i'm adding simple behavior aimed @ validating queries , commands: public class validationbehavior<trequest, tresponse> : ipipelinebehavior<trequest, tresponse> trequest : irequest<result> tresponse : result { private readonly ienumerable<ivalidator<trequest>> _validators; public validationbehavior(ienumerable<ivalidator<trequest>> validators) { _validators = validators ?? enumerable.empty<ivalidator<trequest>>(); } public async task<tresponse> handle(trequest request, requesthandlerdelegate<tresponse> next) { (...) } } currently of queries inherits paginatedquery. public abstract class paginatedquery : iquery { public int offset { get; set; } = 0; public int limit { get; set; } = 25; } example: public class getcountriesquery : paginatedquery { public getcountriesquery(paginatedinput input) {

excel - Extract data from Summit FT -

is there way excel extract data summit ft system through vba code or api? i have excel file requires me export 4 different views of summit paste excel template that's filled formulas. wonder if streamline process extracting data code.

ceylon - TestRunner.run() doesn't run testst? -

i have created 'hello world' type test suite, can't seem have run tests. when executed, says: reached run function process finished exit code 0 i can tell 2 functions containing tests never executed, contain print statements never printed. this source code of tests/run.ceylon file: import ceylon.test { testrunner, createtestrunner } mytests1 () { // assert true! assert(40 + 2 == 42); print("mytests1"); return null; } void mytests2 () { // assert false! assert(2 + 2 == 54); print("mytests2"); } "run module `tests`." shared void run() { print("reached run function"); testrunner mytestrunner = createtestrunner( [`function mytests1`, `function mytests2`]); mytestrunner.run(); } the test function has annotated test annotation, see https://modules.ceylon-lang.org/repo/1/ceylon/test/1.3.3.1/module-doc/api/index.html#start

python - How do I convert upgrouped Data to Grouped Data in Pandas -

so have dataset customers in store , sales of store on each day. which looks - store id sales customers 1 250 500 2 276 786 3 124 256 5 164 925 how convert grouped data, this sales customers 0-100 0 100-200 1181 200-300 1286 i have searched while , found pandas site - http://pandas.pydata.org/pandas-docs/version/0.15.2/groupby.html df2.groupby(['x'], sort=true).sum() but unable understand how apply same example. use cut bins , groupby , aggregate sum : df = df.groupby(pd.cut(df['sales'], [0,100,200,300]))['customers'].sum().fillna(0) print (df) sales (0, 100] 0.0 (100, 200] 1181.0 (200, 300] 1286.0 name: customers, dtype: float64 also possible define labels: l =['0-100','100-200','200-300'] b = [0,100,200,300] df = df.groupby(pd.cut(df['sales'], bins=b, labels=l))['cu

vba - How do i get my macro to transpose data that is a string and number -

i have macro transpose data horizontal vertical : set rng = range("a1:d10") sheets("sheet3").select range("g1").select k = 0 each rw in rng.rows each mycell in rw.columns if isempty(mycell) exit if mycell.column = 1 myletter = mycell else activecell.offset(rowoffset:=k, columnoffset:=0) = myletter activecell.offset(rowoffset:=k, columnoffset:=1) = mycell k = k + 1 end if next next the macro works great except when run, tranposes data if data stored text chops , converts number, there way amend macro , not this? example : if had 00293472427 macro spits out 293472427 any appreciated thanks! forgot say, before transposing data looks : a 22.2 11 14 21 and after looks : a 22.2 11 14 21 it seems me want make copy of cells. for each rw in rng.rows each mycell in rw.columns if isempty(mycell) exit if mycell.column = 1 set mylette

sql server - How to sum two columns of different tables in sql -

i created 2 tables book , cd **books** **book_id** **author** **publisher** **rate** angular2 132 venkat ts 1900 angular 160 venkat ts 1500 html 5 165 henry vk 1500 html 231 henry vk 2500 css 256 mark adobe 1600 java 352 john gulberg 4500 c# 450 henry adobe 1600 jsp 451 henry vk 2500 ext js 555 kv venkat w3 5102 html 560 kv venkat gulberg 5000 java2 561 john gulberg 9500 java8 651 henry vk 1650 js 654 henry ts 2500 java 777

ios - Table scrolling not active after scrollEnabled toggled -

this one's little complicated attempt simplify best can. - bit of long read -hopefully- greater cause i'm making reusable googlemaps-like bottom sheet component ios , ready publish people use. - i've got pan gesture recogniser in view contains table.to make sure both table , pan view receiving corresponding gestures using: internal func gesturerecognizer(_ gesturerecognizer: uigesturerecognizer, shouldrecognizesimultaneouslywith othergesturerecognizer: uigesturerecognizer) -> bool { return true; } all good. now, there conditions under dont want them both scroll @ same time. gesture recognising part simple, add custom logic in gesture , nothing. table element i've been using : datatable.isscrollenabled = false; the problem: while performing pan gesture , condition triggered pan recogniser should stop affecting , table should enabled scroll again, table doesnt scroll (probably doesnt receive gesture ) unless take finger of screen , start gesture aga

android - How to assign a value to a ValueRange variable in java? -

i trying implement google sheets api writing feature app using following code web page unable figure out , how assign value valuerange variable. public class sheetsexample { public static void main(string args[]) throws ioexception, generalsecurityexception { // id of spreadsheet update. string spreadsheetid = "my-spreadsheet-id"; // todo: update placeholder value. //the a1 notation of values update. string range = "my-range"; // todo: update placeholder value. // todo: assign values desired fields of `requestbody`. existing // fields replaced: valuerange requestbody = new valuerange(); sheets sheetsservice = createsheetsservice(); sheets.spreadsheets.values.update request = sheetsservice.spreadsheets().values().update(spreadsheetid, range, requestbody); updatevaluesresponse response = request.execute(); // todo: change code below process `response` object: system.out.println(response); } public static sheets createsheetsservice() throws ioexcep

Spring Boot Thymeleaf Could not parse as expression with an url -

i'm putting button on page 1 navigate page 2. page 1 , 2 on different controllers. this code of button. pid id of project. p.id gives id of project. don't know problem here is. <td><a th:href="@{/projects/project/{pid}/clusters(pid=${p.id})" class="btn btn-info" role="button">clusters</a> </td> org.thymeleaf.exceptions.templateprocessingexception: not parse expression: "@{/projects/project/{pid}/clusters(pid=${p.id})" (projects:53) you've missed 1 curly bracket @ end of expression <a th:href="@{/projects/project/{pid}/clusters(pid=${p.id})}" class="btn btn-info" role="button">clusters</a>

cors - fetch request, set-cookie and cookie are ignored ,after I set credentials: "include" -

i use fetch post cross origin request, response successful set-cookie header: access-control-allow-credentials:true access-control-allow-headers:content-type access-control-allow-methods:* access-control-allow-origin:* access-control-max-age:100 set-cookie:csessionid=594747de551d49dcb278bb6a9ad71ccb; domain=jdcf88.com; expires=tue, 12-sep-2017 08:40:30 gmt; path=/ then fetch data request, find request doesn't have cookie request header.the code is: fetch('https://xxx.jdcf88.com/login/islogin?userid=4', { method: "get", credentials: "include", mode: "cors", body: body }) i pretty sure cookie set domain jdcf88.com. 3. don't know why fetch request don't have cookie header , server has set access-control-allow-credentials true, credentials include.

c# - Disambiguate between two constructors, when two type parameters are the same -

given class either<a, b> { public either(a x) {} public either(b x) {} } how disambiguate between 2 constructors when 2 type parameters same? for example, line: var e = new either<string, string>(""); fails with: the call ambiguous between following methods or properties: 'program.either.either(a)' , 'program.either.either(b)' i know if had given parameters different names (e.g. a a , b b instead of x ), use named parameters disambiguate (e.g. new either<string, string>(a: "") ). i'm interested in knowing how solve without changing definition of either . edit: you can write couple of smart constructors, i'm interested in knowing if either 's constructors can called directly without ambiguity. (or if there other "tricks" besides one). static either<a, b> left<a, b>(a x) { return new either<a, b>(x); } static either<a, b> right<a, b>(b x)