Posts

Showing posts from July, 2014

c# - Switch statement using string.contains -

i have following method public list<availablefile> getavailablefiles(string rootfolder) { if (directory.exists(rootfolder)) { try { foreach (string f in directory.getfiles(rootfolder)) { if (f.tostring().contains("test")) { files = createfilelist(f); } } } catch (system.exception excpt) { // log stuff } } return files; } what i'm wanting refactor out if statement inside foreach loop, making using of switch statement need check against variety of different words however, i'm struggling put switch statement in due use .contains() , fact need check each of file names may or may not have particular set of characters i'm looking for. is there way in can make use of switch statement or stuck using variety of if statements? edit maybe unclear in wanting do. , seem ho...

pyparsing: Grouping guidelines -

pyparsing: below code put can parse nested function call , logical function call or hybrid call nests both function , logical function call. dump() data adds many unnecessary levels of braces because of grouping. removing group() results in wrong output. there guideline use group(parsers)? also pyparsing document does'nt detail on how walk tree created , not of data available out there. please point me link/guide helps me write tree walker recursively parsed data test cases. translating parsed data valid tcl code. from pyparsing import * pyparsing import oneormore, optional, word, delimitedlist, suppress # parse action -maker; # paul's example def makelrlike(numterms): if numterms none: # none operator can binary op initlen = 2 incr = 1 else: initlen = {0:1,1:2,2:3,3:5}[numterms] incr = {0:1,1:1,2:2,3:4}[numterms] # define parse action number of terms, # convert flat list of tokens nested list def pa(s,l,t): t = t[0] if len(t) > init...

entity framework - CI and MSBuild adding EntityFramework -

(i still beginner stuff) implementing ci jenkins builds using msbuild. pulling code , building visual studio works, when pull repo (bitbucket) these sort of errors: c:\program files (x86)\msbuild\14.0\bin\microsoft.common.currentversion.targets(1820,5): warning msb3245: not resolve reference. not locate assembly "entityframework, version=6.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089, processorarchitecture=msil". check make sure assembly exists on disk. if reference required code, may compilation errors. [c:\users\bob.jenkins\workspace\sift\source\sift.model\sift.model.csproj] and because of these sort of errors domain\incident.cs(5,19): error cs0234: type or namespace name 'entity' not exist in namespace 'system.data' (are missing assembly reference?) [c:\users\bob.jenkins\workspace\sift\source\sift.model\sift.model.csproj] now know has repo not allowing dll or other kinds of files (we don't want because ...

javascript - How to include whitespaces in string replace? -

i need replace strings '5 hours' '5h'. i'm able '5 h'. how remove space in between? when replace "hours" in function " hours" whitespace, replaces nothing , returns '5 hours'. $('div.block_name span').text(function(){ return $(this).text().replace("hours","h"); }); you can use regex so: // "\s?" means find space if exists console.log("5 hours".replace(/\s?hours/, 'h')); // 5h console.log("5hours".replace(/\s?hours/, 'h')); // 5h

python - Skeletal animation transfer - Orientation -

Image
i'm trying make pymel script in maya want transfer animation 1 rig another. right script transferring keyframes orignal rig other, ignores joint orientation. have mathematical formulas unsure of how use them in pymel, since it's not primary language. the formula: "s" rig source , "t" targeted rig. as of have isolated rotation, unsure of how worldspacerotation , translatedrotation. if or give me pointers appreciated! can send current code if needed.

Facebook marketing api insights can be used in graph api explorer -

how see facebook marketing api insights in graph api explorer? explain? can output see in link? marketing api sample i had answer,i expalin here the following links usefull question https://developers.facebook.com/docs/marketing-api/insights-api https://developers.facebook.com/docs/marketing-api/insights/fields/v2.10 https://developers.facebook.com/docs/marketing-api/reference/ad-keyword-stats https://developers.facebook.com/docs/marketing-api/insights/v2.10 https://developers.facebook.com/docs/marketing-api/insights/fields/v2.10 https://developers.facebook.com/docs/marketing-api/tracking-specs/v2.10 https://developers.facebook.com/docs/marketing-api/insights/parameters/v2.10 fb not defined javascript go https://developer.facebook.com , create app , left side nav bar create marketing api , manage above tools. doubts comments here..

logging - How to configure application audit log on a separate file in Wildfly-swarm -

i have configured logging fraction , tried add additional handler store specific logs in different files, using category, looking answer in how log application auditing separate file on wildfly 8 adapting wildfly-swarm fluent api. the code looks this: loggingfraction loggingfraction = new loggingfraction() .consolehandler(level, "color_pattern") .formatter("pattern", "%d{yyyy-mm-dd hh:mm:ss,sss} %-5p [%t] (%c{1}) %s%e%n") .formatter("color_pattern", "%k{level}%d{yyyy-mm-dd hh:mm:ss,sss} %-5p [%t] (%c{1}) %s%e%n") .formatter("audit", "%d{yyyy-mm-dd hh:mm:ss,sss} %-5p (%c{1}) %s%e%n") .periodicsizerotatingfilehandler("file", h ->{ h.level(level) .namedformatter("pattern") .append(true) .suffix(".yyyy-mm-dd") ...

php - Codeinginter : joining 2 tables based on 2 parameters -

i have 2 database tables quotations , garag . both tables have lat, lng field . i have show quotation nearby garages based on defined radius. for have take lat,lng quotations table , match lat,lng of garages table i can nearby garages using following query in ci $sql = "select *, ( 3959 * acos( cos( radians(" . $lat . ") ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(" . $lng . ") ) + sin( radians(" . $lat . ") ) * sin( radians( lat ) ) ) ) distance garage having distance < 25"; $result = $this->db->query($sql) ; but not sure how related quotations requested lat , lng can please me select q.* garage g left join quotes q on sqrt(square(abs(q.lat - g.lat)) + square(abs(q.lng - g.lng))) <= @maxdistanceindegrees g.id = @garageid this should work. note if have large database, problem becomes more complicated, , you'll need create sort of grid system mitigate n^2 issue.

Adding hours in PHP validating holidays -

i have php code generates delivery date , time of order in system validating schedule , sundays, in way: <?php $hours = 6; $date = date('y-m-d h:i a'); $delivery = date("d-m-y h:i a", strtotime("+$hours hours", strtotime($fecha))); echo $delivery; if (date('h') >= 18 || date('h')<9 || date('w')==0){ $c=strtotime("tomorrow 09:00"); $date = date("y-m-d h:i a", $c); $delivery = date("d-m-y h:i a", strtotime("+$hours hours", strtotime($fecha))); echo $delivery; } ?> this validates if order made after 6pm or before 9am or if current day sunday, order goes next day @ 9am , incrementing hours. want validate if current day , next day sunday or holidays 4th july (04-07) or xmas (25-12) generate delivery date time in next day of them (05-07 or 26-12). how can modify it? i help. just run code in while-loop can call tomorrow 09:0...

r - Collapsible Tree example not working -

Image
i read manual, , tried reproduce following example. r produces error: error in collapsibletree(tree, tooltip = true, attribute = "value", aggfun = identity) : df must data frame my question what's wrong piece of code. using r version 3.4.1. thanks! # using flat relationship-style data frame tooltips relationships <- data.frame( parent = c(".",".","a", "a", "a", "b", "b", "c", "e", "e", "f", "k", "k", "m", "m"), child = c("a","k","b", "c", "d", "e", "f", "g", "h", "i", "j", "l", "m", "n", "o"), value = 1:15 ) tree <- data.tree::fromdataframenetwork(relationships, "value") # define root node value 0 tree$value <- 0 # create tree di...

java - Adding values to SharedPreferences from a Custom ListViewAdapter -

i'm trying add values sharedpreferences list, idea when user click on button list item added favorites page, i'm not able so, believe problem because i'm using custom listviewadapter, listview allows me swipe list item left shows button. like so can't put sharedpreferences work in class, have: public class listviewadapter extends baseswipeadapter { arraylist<hashmap<string, string>> array = todasascategorias.getlistacategorias(); string designacao, k_produto; public static final string favoritos = "favoritos"; private context mcontext; public listviewadapter(context mcontext) { this.mcontext = mcontext; } @override public int getswipelayoutresourceid(int position) { return r.id.swipe; } @override public view generateview(final int position, viewgroup parent) { final view v = layoutinflater.from(mcontext).inflate(r.layout.list_item_cat, null); swipelayout swipela...

matplotlib - Python - Adding marker option to plot gives error -

hi i'm trying add markers python plots using mark every option. when add following error: valueerror: many values unpack. i'm not sure causing it. below code. temp = pd.read_csv(path+filename) temp=pd.dataframe(temp).convert_objects(convert_numeric=true) fig,axes = plt.subplots(nrows=2,ncols=1) fig.subplots_adjust(hspace=1) fig = plt.figure() markers_on=[887,1661,2631,3406,4714,5606,6880,8332,9751] fig.subplots_adjust(hspace=.5) fig.suptitle('bc attributes', fontsize=12) plt.subplot(3,1,1) plt.plot(temp.index,temp.bc_t_node0_cpu0_temp, marker='s', markevery=[887,1661,2631,3406,4714,5606,6880,8332,9751]) plt.xlabel('time') plt.ylabel('node0 cpu0 temp') plt.subplot(3,1,2) plt.plot(temp.index, temp.bc_t_node0_cpu1_temp, marker='s', markevery=[887,1661,2631,3406,4714,5606,6880,8332,9751]) plt.xlabel('time') plt.ylabel('node0 cpu1 temp') plt.subplot(3,1,...

android - Why does scale animation change button size? -

Image
i have few buttons in android app of mine, "start", "stop", , "pause". when start pressed becomes disabled , stop , pause become enabled. similarly, when stop or pause pressed, start becomes enabled again. when these buttons change state, animate change bouncing animation visually indicate user button available. problem animation changing buttons size(background). check out gif see mean (watch stop button): here code animation: <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/linear_interpolator"> <scale android:fromxscale="1.0" android:toxscale="1.1" android:fromyscale="1.0" android:toyscale="1.1" android:pivotx="50%" android:pivoty="50%" android:duration="200" an...

excel - How do I make a specific Function -

Image
so im using excel track hours work @ job i have set this: columns b through g label in order: date start lunch out lunch in home total hrs worked column g calculate amount of time worked every day, total jan 1, nother total jan 2, etc. the equation use =(d-c)+(f-e) subtracts beginning time when go lunch, , adds difference between when leave go home , when come lunch however dont go lunch , dont want replace existing equation time.. so heres need.. (this gonna written out how should work.. not equation needs say?) if columns d , e not blank (d-c)+(f-e) else (this if columns d , e blank) f-c remember, column c when start shift, d when clock out lunch, e when come lunch, , f when clock out day , end shift. , column g total hours worked day (has formula) just calculate lunch seperately , subtract total: =(f2-c2)-(e2-d2) that way if lunch blank subtract 0 total.

Importing images into visio through VBA -

i'm using vba import data excel file visio, , need include image in visio file isn't in excel file saved locally. need able manipulate image shape object (ie; set width/height/position using vba, shape.cells("width") = x etc.) i've looked extensively online solution, no avail. appreciated. you must define page want insert picture. read more page.import method (visio) set shp = activepage.import("c:\users\surrogate\pictures\new.png") shp.cells("pinx").formula = "100 mm" shp.cells("piny").formula = "150 mm"

osx - How can I add a context menu option for my macOS swift app? -

i'm creating app (in swift) similar dropbox , want create option "add file app name" , add right click menu. on click i'd have app open , have file loaded user decide saved. have looked on web extensively , can't find other sources help. looking on adding menu option.

osx - Java Mac application failed with error code -10810 -

i'm making java application in eclipse needs run on both windows , mac. made mac app i'm able run independent of eclipse on laptop, when tried run through terminal on mac machine (that had java version required), showed error message: cannot run (/users/agastya/desktop/appname.app). error code: -10810. how can resolve issue? thanks! try run application terminal please use full path appname.app

visual studio - VS2015\IIS express cannot load external DLL -

i have problem visual studio , web api. need use dll project uses third part library (compiled x86 o x64, i've used x86 version) the dll project working in others applications without problem, when add web api project, during startup receive filenotfoundexception on dll (perhaps first 1 of bunch). dll copied in bin folder. can't figure out why iis\vs can't find it. any idea ?!

ios - firebase observeeventtype jsqmessagecollectionview avatar -

i'm going show avatar image of users within conversation. used jsqmessageviewcontroller, function below should used achieve goal. however, observeeventtype seems out function , not being called, , there nil(myuserimage or otheruserimage) in return. crash appear. how can photo url of different users in firebase , return expected avatar image? thank you! - (id<jsqmessageavatarimagedatasource>)collectionview:(jsqmessagescollectionview *)collectionview avatarimagedataforitematindexpath:(nsindexpath *)indexpath { jsqmessage *message = [self.msgarray objectatindex:indexpath.item]; if([message.senderid isequaltostring:self.senderid]){ nsstring *myuserid = [firauth auth].currentuser.uid; __block nsstring *myuserimage; nslog(@"uid : %@",myuserid); [[_photoref child:@"users"] observeeventtype:firdataeventtypevalue withblock:^(firdatasnapshot *snapshot) { nslog(@"my key : %@",snapshot.key); ...

mysql - Getting error 1064 while running query for table creation? -

i have created customers , products table.i getting error while running following command in phpmyadmin. create table orders ( id int not null auto_increment, ordernumber int, productid int, customerid int, orderdate datetime default current_timestamp, primary key(id), primary key (customerid) references customers(id) , foreign key (productid) references products(id) ); 1064 error can not create more 1 primary keys. try code. create table orders ( id int not null auto_increment, ordernumber int, productid int, customerid int, orderdate datetime default current_timestamp, primary key(id), foreign key (customerid) references customers(id) , foreign key (productid) references products(id));

fortran - Parameter encoding in gfortran module files -

let's have module: module testparam real, parameter :: x=1.0, xx=10.0 real, parameter :: pi=3.14 end module testparam compile with gfortran -c testparam.f90 and in generated module file cp testparam.mod testparam.gz gunzip testparam.gz the trimmed output is: (2 'pi' 'testparam' '' 1 ((parameter unknown-intent unknown-proc unknown implicit-save 0 0) () (real 4 0 0 0 real ()) 0 0 () (constant (real 4 0 0 0 real ()) 0 '0.323d70c@1') () 0 () () 0 0) 4 'x' 'testparam' '' 1 ((parameter unknown-intent unknown-proc unknown implicit-save 0 0) () (real 4 0 0 0 real ()) 0 0 () (constant (real 4 0 0 0 real ()) 0 '0.1000000@1') () 0 () () 0 0) 5 'xx' 'testparam' '' 1 ((parameter unknown-intent unknown-proc unknown implicit-save 0 0) () (real 4 0 0 0 real ()) 0 0 () (constant (real 4 0 0 0 real ()) 0 '0.a000000@1') () 0 () () 0 0) then can see value of x has been stored...

rust - Implement one trait for multiple structs at once -

i have trait footrait has bunch of functions. have structs foostruct , barstruct , want implement footrait both structs methods doing same. is there way implement footrait both foostruct , barstruct @ once? imagined following: impl footrait foostruct + barstruct { // implement methods here } no, there no way implement 1 trait multiple structs @ same time without metaprogramming macros. i'd go far there's no reason to, either. if had "the methods doing same", should extract common member variables different struct , implement trait struct (if need trait anymore). can add new struct member of originals. if had like struct dog { hunger: u8, wagging: bool, } struct cat { hunger: u8, meowing: bool, } trait hungry { fn is_hungry(&self) -> bool; } you have struct dog { hunger: hunger, wagging: bool, } struct cat { hunger: hunger, meowing: bool, } struct hunger { level: u8, } impl hunge...

openstack - Unable to load password for provider in Terraform using vault_secret_generic -

i have terraform builds vm using openstack provider. username , password provider being stored in hashicorp vault secret. i've set plan enable vault provider , access secret using privileged token. here's plan looks like: provider "vault" { } data "vault_generic_secret" "openstack" { path = "secret/openstack" } provider "openstack" { user_name = "${data.vault_generic_secret.openstack.data["username"]}" password = "${data.vault_generic_secret.openstack.data["password"]}" tenant_name = "${var.openstack_tenant_name}" domain_id = "${var.openstack_domain_id}" auth_url = "${var.openstack_auth_url}" } when try run plan following error: * provider.openstack: must provide password authenticate so far i've been able verify vault provider , vault_generic_secret data item work in different plan displaying secret values output variables. ad...

How are partially downloaded files in chrome or firefox structured? -

i need analyze file chrome or firefox creates when downloading file, cannot find info them, see high level descriptions file format don't give info byte structure of file formats. need 1 of structures of .part or .crdownload files, info 2 great. thanks.

angular - Property 'sumo' does not exist on type 'HTMLElement' for SumoSelect JQuery -

i trying implement "clear" or "reset" functionality sumoselect dropdown have implemented. using angular 4. code call when want clear dropdown: var num = $('option').length; for(var i=0; i<num; i++){ $('#state')[0].sumo.unselectitem(i); } i installed sumoselect in node_modules putting in typings.d.ts: interface jquery { sumoselect(any):void; } in .angular-cli.json included appropriate js , css files. sumoselect dropdown works fine can't figure out how application recognize sumo on third line of first code segment. have tried other interfaces jquery , htmlelement , no luck. try importing sumo in component. import * sumo 'sumoselect'; and import * $ 'jquery'; or `declare var $ : ;` //in component

java - Spring CORS error -

Image
i'm building webapi spring , client reactjs. i'm trying post request authenticate oauth2, against webapi, keep getting response preflight has invalid http status code 401 websecurityconfigureradapter: @configuration public class websecurityconfig extends websecurityconfigureradapter { @bean public corsfilter corsfilter() { urlbasedcorsconfigurationsource source = new urlbasedcorsconfigurationsource(); corsconfiguration config = new corsconfiguration(); config.setallowcredentials(false); //updated false config.addallowedorigin("*"); config.addallowedheader("*"); config.addallowedmethod("get"); config.addallowedmethod("put"); config.addallowedmethod("post"); source.registercorsconfiguration("/**", config); return new corsfilter(source); } @override protected void configure(httpsecurity http) throws exceptio...

Showing 404 status for JavaScript file path in master page of asp.net -

i giving javascript file path in master page of asp.net in browser console showing error of status 404 in javascript path i.e. in short browser not getting path of javascript file. here code <script async="" src="index/analytics.js.download"></script> <script type="text/javascript" src="index/modernizr.js.download"></script> <script type="text/javascript" src="index/jquery-1.10.1.min.js.download"></script> <script type="text/javascript" src="index/jquery.dlmenu.js.download"></script> <script type="text/javascript" src="index/waypoints.min.js.download"></script> <script type="text/javascript" src="index/jquery.counterup.min.js.download"></script> <script type="text/javascript" src="index/owl.carousel.js.download"></script> <s...

javascript - How to use redux-observable and promise correctly? -

i using hello.js sign in. hello('abc').login() returns promise. it did sign in successfully, because hello.js saved token in local storage. however, code below not dispatch action sign_in_succeed . export const signinepic = (action$, store) => action$ .oftype(sign_in) .mergemap(action => observable .frompromise(hello('msft').login({ scope })) .map(response => ({ type: sign_in_succeed, payload: response.authresponse.access_token }) ) .catch(error => observable.of({ type: sign_in_failed, payload: error })) ); update: jay's pause on caught exceptions way helped me find error. code above has no issue. causes problem first try save token store after getting sign_in_succeed . use token once app sign in fetch something. when fetch using token step runs before saving token in store step, causes issue won't dispatch sign_in_succeed . if make assu...

webforms - Single Page Application with Angular Js hosting on IIS -

i trying create single page app using asp.net forms (consider used empty template web forms project). app has single home page , using material design lite tabs show different content users. everything works in visual studio environment when host same website page in iis, none of tabs show content on click. what's big miss not getting ? why tabbed contents showing when hosting in iis ? thanks in advance help.

python - pass argument to groupby and agg in pandas -

i want use agg after groupby , pass in 2 parameters, param1 , param2. tried following failed. correct way that? thanks. def myfun(x, param1, param2): #some calculations return result b = a.groupby([a.index, 'time']).agg({'salary': myfun, param1, param2}) use syntax: param1=1 param2=100 a.groupby([a.index,'time'])['salary'].agg(myfun, param1, param2) or @ayhan suggests: a.groupby([a.index,'time']).agg({'salary':lambda x: myfunc(x, param1, param2)})

MySQL: Join on same table with sorting -

i performing join on same table t(type_id,place_name) on different type_id : ------------------ type_id|place_name -------|---------- 1 | 1 | b 2 | x 2 | y ------------------ my query : select t1.type_id, t1.place_name t t1 join t t2 on t1.type_id!= t2.type_id , t1.place_name!=t2.place_name; i result: ------------------- type_id|place_name -------|----------- 2 | x 2 | y 2 | x 2 | y 1 | 1 | b 1 | 1 | b ------------------- but want result like: ------------------- type_id|place_name -------|----------- 1 | 2 | x 1 | 2 | y 1 | b 2 | x 1 | b 2 | y ------------------- i need sort result using order by. please help. if want kind of zipped order, this: select t1.type_id, t1.place_name t t1 join t t2 on t1.type_id!= t2.type_id , t1.place_name!=t2.place_name order least(t1.place_na...

c# - Xamarin development. Tasks are completing to early. I need advice regarding threads -

i have method using enable user input time. have set once button pressed opens dialog. user can select time, once user selects time meant populate textview have found once dialog opens textview assigned default value of null. doesn't wait. when have ran tests using toast messages can see underlying code work order messing me about. currently have attempting implement await feature no avail. i have attached code. or advice. reasonably new c# , xamarin way. <<within on create>> starttimepickerbtn.click += async delegate { oncreatedialog().show(); starttimetv.text = (await updatetime()).tostring(); }; private void timepickercallback(object sender, timepickerdialog.timeseteventargs e) { hour = e.hourofday; minute = e.minute; } public async task<string> updatetime() { string time = string.format("{0}:{1}", hour, minute.tostring().padleft(2, ...

access vba - MS Acess loop, adding x to checkbox -

need looping thru check boxes in access. have 3 checkboxes, checkbox1, checkbox2, checkbox3. x = 1 can't syntax loop "check" & x or checkx or check(x) there way declare checkbox name number variable x? thanks! private sub refer_click() dim x integer dim y string x = 1 y = "" until x = 4 if checkx = true y = y & checkx.controls(0).caption & ";" x = x + 1 else: x = x + 1 y = "unchecked" end if loop fillthis.value = y end sub assuming have 10 checkboxes on form, each named "chk" plus sequential number, can use following: for = 1 10 debug.print me.controls("chk" & i).name & vbtab & me.controls("chk" & i).value next

How to change image on mouseover in vue.js? -

in vue.js, can bind image img element: <img v-bind:src="myimage" /> how can define image displayed when mouse moves on image? change value of myimage in mouseover listener: new vue({ el: '#app', data() { return { myimage: "https://s-media-cache-ak0.pinimg.com/originals/bd/5d/84/bd5d845c980508d41b0329dc21d08d2b.jpg", otherimage: "https://cdn.pixabay.com/photo/2014/03/29/09/17/cat-300572_960_720.jpg" } } }); <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.4.2/vue.min.js"></script> <div id="app"> <img :src="myimage" @mouseover="myimage = otherimage"/> </div>

c# - Powershell - Globally register IO.FileSystemWatcher -

i've created filesystemwatcher (c# object). run code below in powershell session. # filters $filter = "somefile.txt" $flagfolder = "c:\path\to\some\folder" # instantiate watcher $watcher = new-object io.filesystemwatcher $flagfolder, $filter -property @{ includesubdirectories = $false notifyfilter = [io.notifyfilters]'filename, lastwrite' } # event: $filter created $oncreated = register-objectevent $watcher created -sourceidentifier filecreated -action { $path = $event.sourceeventargs.fullpath $name = $event.sourceeventargs.name $changetype = $event.sourceeventargs.changetype $timestamp = $event.timegenerated write-host "the file '$name' $changetype @ $timestamp" write-host $path someglobalfunction $param } after running code above, if get-job reports filewatcher: id name psjobtypename state hasmoredata location -- ---- ------------- ----- ...

Is it possible to count the number of occurrences of a calculated field's result in Tableau? -

i have function categorizes calls user has made 3 categories using calculation: if 0 <= datediff('dayofyear', [submitteddatetime], [calldate]) , datediff('dayofyear', [submitteddatetime], [calldate]) <= 7 "week after" elseif -7 <= datediff('dayofyear', [submitteddatetime], [calldate]) , datediff('dayofyear', [submitteddatetime], [calldate]) < 0 "week before" else "not within week" end i wondering if it's possible count number of occurrences of particular outcome of function on per user basis in order categorize each user based off of number of occurrences. i'm attempting use calculation so: if { fixed [subid]: count([datediff calc] = 'week after')} = 1 "1 conference user" elseif { fixed [subid]: count([datediff calc] = 'week after') } > 1 "multiple conference user" else "0 conference user" ...

xaml - Why WPF introduces a new types for collections? -

i found out, wpf uses internally lot of collections such itemcollection or datagridcollumncollection . why not use plain old list or array instead? itemscollection great example. provides grouping , sorting accessible xaml traditional linq not. the other classes follow same pattern. add features should not, or cannot added extremely commonly used collection types. changing behaviour or performance of list<t> breaking api change somebody. most of these classes implementations of static decorator pattern . features added existing collection concept, without changing existing classes. notice inherits , implements following: ilist icollection ienumerable these bread , butter interfaces working collections of types. i'd surprised if itemscollection doesn't use list<object> backing store @ point in implementation.

Excel - Integrating Conditional Formatting and Data Validation -

i constructing model due series of inputted building features, outputs zoning statistics. yes or no, have done standard data validation. of these features have different levels, however, still yes or no. is there way limit level yes or no's such if 1 of levels turned yes, others automatically turn no? don't want wrong information having multiple levels turned yes.

spring - OAuth2 causes Tomcat exceptions -

i tried implement oauth2 maven project. after adding dependency follows: <dependency> <groupid>org.springframework.security.oauth</groupid> <artifactid>spring-security-oauth2</artifactid> <version>${springsecurityoauth2.version}</version> </dependency> tomcat throws numerous exceptions: severe: child container failed during start java.util.concurrent.executionexception: org.apache.catalina.lifecycleexception: failed start component [standardengine[catalina].standardhost[localhost].standardcontext[/springsecurityoauth2example]] @ java.util.concurrent.futuretask.report(futuretask.java:122) @ java.util.concurrent.futuretask.get(futuretask.java:192) @ org.apache.catalina.core.containerbase.startinternal(containerbase.java:939) @ org.apache.catalina.core.standardhost.startinternal(standardhost.java:872) @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150) @ org...

javascript - Safari ReferenceError: Can't find variable: Set -

i getting safari referenceerror: can't find variable: set error safari browser. have checked other browsers didn't error codes working fine me. is can me here wrong here , solution work code browsers? full demo problem line var charactersx = new set([ 0, 32, // space 13 // enter // add other punctuation symbols or keys ]); // convert characters charcode function tocharcodex(char) { return char.charcodeat(0); } var forbiddencharactersx = new set([ tocharcodex("_"), tocharcodex("-"), tocharcodex("?"), tocharcodex("*"), tocharcodex("\\"), tocharcodex("/"), tocharcodex("("), tocharcodex(")"), tocharcodex("="), tocharcodex("&"), tocharcodex("%"), tocharcodex("+"), tocharcodex("^"), tocharcodex("#"), ...

How to create a searchable central repository of code documentation using DocFx -

i'm looking create central repository of our published api documentation using docfx. have documentation auto-generated via build (using tfs) , published through release (using octopus) fine multiple individual sites. however, i'm wanting pull altogether in 1 location. thinking through parent site filter content in of individual sites without having drill down them. have recommendation on how this? also, within same documentation repository want provide capability search of meta data (project-level documentation) across hundreds of projects in our portfolio. give our ba, dev , qa teams easier access our systems do. "filtering" capability built docfx, i'm wanting full-text search across of meta data. have recommendation functionality well?

appmaker - Error With Email Change Notifications Using Project Tracker Template -

short version: i using code project tracker template send out emails showing change in status field (contact name changed from: billy -> susan). everything works expect when have field date instead of string. if have date field in code following error: 'string' value expected 'newvalue' field in model 'systemordershistory', found object. error: 'string' value expected 'newvalue' field in model 'systemordershistory', found object. @ onsystemorderssave_ (datasources:218) @ models.systemorders.onsaveevent:1 modifying records: (error) : 'string' value expected 'newvalue' field in model 'systemordershistory', found object. (error) : 'string' value expected 'newvalue' field in model 'systemordershistory', found object. any appreciated! long version i using code below (adjusted fit names of models , fields). whenever add date field (ex: deliverydate) function "notif...

sql - UPDATE statement in an inheritance based table -

i've got table that's meant used modeling inheritance relationship. it's column oriented have columns properties , looks like: mainid, subid, prop1, prop2, etc. all rows same mainid related , row subid=0 parent row matches mainid , subid > 0. thus: 100, 0, 'abc', 123 100, 1, null, 456 means (100,1) child of (100,0) , querying prop1 (100,1) should give me 'abc' , querying prop2 (100,1) should give me 456 . this seems work ok however, when want update (100,1).prop1 , i'd make field null if update value 'abc' (matches parent.prop1 field). there simple update query can this? realize can on multiple queries 1 update query , updating many fields @ once, if possible (eg update (100,1).prop1='abc', (100,1).prop2=789, etc.) this should work standard sql (eg not specific particular sql engine) use case expression , dependent subquery, part of standard ansii sql , supported databases.: update table t1 set p...

excel - For loops with sheet range in declaration -

so making loop fill values in cells on sheet1. upperbound row number on sheet2, , figured slower saving row number variable. in case isn't entirely clear, i'm saying intuition told me for = 1 sheet2.range("a1048576").end(xlup).row would slower than for = 1 lastrow since loop have keep referencing sheet2. remembered every time debug loop , put breakpoint @ declaration* statement, never stop @ line. figured they'd @ least same amount of time since maybe both temporarily saved. made quick test before asking , surprise, sheet-referencing loop faster other. does know why be? *what line called? declaration of loop? conditional statement?

Installed Python libraries scipy and matplotlib but can't import -

i'm using python 3.4.2, , believe downloaded python.org. i'm running on mac el capitan. i tried downloading scipy using anaconda's graphic installation interface. after running installer, opened idle , tried: >>> import scipy but got error: traceback (most recent call last): file "<pyshell#0>", line 1, in <module> import scipy importerror: no module named 'scipy' i tried same thing numpy, got same error. i tried installing matplotlib, time figured should try using pip on command line. first tried: dhcp-wifi-8021x-155-41-121-77:~ theman$ pip install matplotlib requirement satisfied: matplotlib in ./anaconda/lib/python3.6/site-packages requirement satisfied: numpy>=1.7.1 in ./anaconda/lib/python3.6/site-packages (from matplotlib) requirement satisfied: six>=1.10 in ./anaconda/lib/python3.6/site-packages (from matplotlib) requirement satisfied: python-dateutil in ./anaconda/lib/python3.6/site-packages (fr...

Sum each attributes value from api response javascript -

Image
i want sum similar attributes api response. you need kind of loop. 1 solution use foreach data variable array received api response. var sum=0; var data=[{points_earned:"2"},{points_earned:4}] data.foreach(function(elem){ sum+=number(elem.points_earned); }); console.log(sum); var sumusingreduce=0; var total = data.reduce(function(sum, value) { return sumusingreduce += number(value.points_earned) }, 0); console.log(sumusingreduce); var sum=0; data.foreach(function(elem){ sum+=elem.points_earned; }); others suggested using reduce : the reduce() method applies function against accumulator , each element in array (from left right) reduce single value. example: var total = [0, 1, 2, 3].reduce(function(sum, value) { return sum + value; }, 0);

android - emulator: ERROR: Could not load OpenGLES emulation library -

i download android_wear_square_api_23 android studio avd manager. when want run terminal ./emulator64-x86 -avd android_wear_square_api_23 error emulator: error: not load opengles emulation library [lib64openglrender]: lib64openglrender.so: cannot open shared object file: no such file or directory failed open lib64egl_translator: [lib64egl_translator.so: cannot open shared object file: no such file or directory] gles2_dispatch_init: not load lib64gles_v2_translator [lib64gles_v2_translator.so: cannot open shared object file: no such file or directory] emulator: error: not load opengles emulation library [lib64openglrender]: lib64openglrender.so: cannot open shared object file: no such file or directory emulator: error: not initialize opengles emulation, use '-gpu off' disable it. i try ./emulator64-x86 -avd android_wear_square_api_23 -gpu off error : failed open lib64egl_translator: [lib64egl_translator.so: cannot open shared object file: no such file or directory] g...

createfile - I don't get why my python file creation is not working -

import sys filepath = "d:\\desktop\\sign in out\\" times = ["min.txt","hour.txt","datein.txt","dateout.txt"] while true: z = input("enter first , last name. don't put . in name. : ") y = z+'\\'+z x in range(len(times)): f = open(filepath+y+times[x],'w') f.write('0') f.close() joining files \\ not best way it. recommended way using os.path.join os module: import os while true: z = input("enter first , last name. don't put . in name. : ") y = os.path.join(*z.split()) x in times: open(os.path.join(filepath, y, x), 'w') f: f.write('0') i recommend - using context manager handle files, makes code cleaner. iterating on times directly rather indices also, jean-françois fabre states in answer, you'd better use os.mkdir create directories don't exist before create files ...

angular - Data Binding causes ExpressionChangedAfterItHasBeenCheckedError -

i'm new angular 4. have data binding field below. somehow, there expressionchangedafterithasbeencheckederror. <form> <div> <h2>hello {{input.value}}</h2> <input type="text" [value]="input.value" name="inputtest"/> <input type="text" #input [value]="name"/> </div> <button type="submit">submit</button> </form> below simple constructor: export class app { name:string; constructor() { this.name = `angular! v${version.full}` } } i read lot of posts error, still don't understand why simple data binding cause error. i tried below code, doesn't work. ngafterviewinit() { console.log("ngafterviewinit"); this.cd.detectchanges(); } please help!! please refer plunker: https://plnkr.co/edit/16atvkgf2ba6z2ojqt6h?p=preview as explained in everything need know change detection in angular 1 of operations angula...

Timeout error in Hyperledger Composer -

i'm testing scalability of block chain app going build using hyper ledger composer. using basic-sample-network testing purposes. have installed basic-sample-network using tutorial found here https://hyperledger.github.io/composer/tutorials/developer-guide.html . located on aws instance running ubuntu 16.04 t2.xlarge storage. setup rest service on aws instance, , started spam requests test scalability. after while, got following errors. unhandled error request post /api/org.example.mynetwork.trader: error: error trying query chaincode. error: error executing chaincode: failed execute transaction (timeout expired while executing transaction) @ channel.querybychaincode.then.catch (/home/ubuntu/composer/my-network/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:758:34) unhandled error request post /api/org.example.mynetwork.commodity: error: error trying query chaincode. error: error executing chaincode: premature execution - chaincode (my-network:0.9.2) being launche...

javascript - Why does the date not adjust to the time set by UTC? -

when printing time clocks, similar code works , adjusts timezone selected, not work printing date. idea why? it displays utc default time. <script> function cetdt(){ var = new date(); var today = new date(now.getutcfullyear(), now.getutcmonth(), now.getutcdate(), now.getutchours(), now.getutcminutes(), now.getutcseconds()); var day = today.getdate(); var month = today.getmonth(); var year = today.getfullyear(); var anhour = 1000 * 60 * 60; today = new date(today.gettime() - anhour * -2); var hours = today.gethours(); var minutes = today.getminutes(); var seconds = today.getseconds(); if (hours >= 12){ meridiem = ""; } else { meridiem = ""; } if (minutes<10){ minutes = "0" + minutes; } else { minutes = minutes; } if (seconds<10){ seconds = "0" + seconds; } else { seconds = seconds; } document.getelementbyid("cetdt").innerhtml = (day + '/' + (parsefloat (month) + 1) + '/' + year); } c...

php - prepared Query strings -

this question has answer here: how echo mysqli prepared statement? 4 answers is there function return prepared query string after processing parameters. $stmt = $conn->prepare("select full_name user_info user_id = ?"); $stmt->bind_param("s", $user_id); can see final query string execute? if driver capable of using prepared statements, if doesn't require emulation, final query executed is prepared statement. if want find out executed, need turn on general query log on server. can very, noisy , fill disk on busy server.