Posts

Showing posts from April, 2014

javascript - React Js Axios Post Request not receiving body back from web api -

Image
so have web api set generate token return when send username , password same works through postman if give body this works gives token , correct information when chrome, firefox or ie gives me error code this, var d = { username: uname, surname: pword, grant_type: "password", client_id: "099153c2625149bc8ecb3e85e03f0022", }; console.log(d); var self = this; return ( axios.post('http://localhost/hydraauth/oauth/token', { headers: { 'content-type': 'application/json', }, data: d }).then(function (response) { console.log(response.data) self.setstate({ isloggedin: true, uname: uname, }, function () { sessionstorage.setitem("login", true); sessionstorage.setitem("uname", uname) window.loca

python - How should multiple parsers for keywords in strings be structured? -

i'm writing code parses strings, using simple keywords. on parsing, code performs various actions, such printing response, running functions etc. , keeps track of whether able respond. i using multiple parsers , have illustrated in code shown below. what better ways structure code, particularly mind scalability , code compactness? example, imagine many more parsers being added operate on principles more complex simple keyword-spotting. mwe: #!/usr/bin/python import json import os import requests import subprocess import sys def main(): message = "how you" #message = "ip address" #message = "restart" triggered = [ parse_1(message = message), parse_2(message = message) ] if not any(triggered): report_help() def parse_1( message = none ): def keyphrases_text_response( message = none, keyphrases = none, response = none ): if any(pat

Angular 4.3.4 breaks mdInput and md-input-container -

my team @ work went angular 4.3.3 4.3.0. after these changes, mdinput , md-input-container no longer function correctly. before click input field , animation work shown on material.angular.io/components/input. has else run issue , if so, steps did take resolve them? may need go 4.3.0. package.json - "dependencies": { "@angular/animations": "^4.3.3", "@angular/cdk": "^2.0.0-beta.8", "@angular/common": "^4.3.3", "@angular/compiler": "^4.3.3", "@angular/core": "^4.3.3", "@angular/flex-layout": "^2.0.0-beta.8", "@angular/forms": "^4.3.3", "@angular/http": "^4.3.3", "@angular/material": "^2.0.0-beta.8", "@angular/platform-browser": "^4.3.3", "@angular/platform-browser-dynamic": "^4.3.3", "@angular/rou

python - Split a dataframe by time column - pandas -

i select right portion of dataset explain following example: input df: id_b, ts_b,value id1,2017-04-27 01:35:30,0 id1,2017-04-27 01:35:40,0 id1,2017-04-27 01:35:50,1 id1,2017-04-27 01:36:00,4 id1,2017-04-27 01:36:10,5 id1,2017-04-27 01:36:20,100 id1,2017-04-27 01:36:30,155 id1,2017-04-27 01:36:40,235 id1,2017-04-27 01:36:50,0 id1,2017-04-27 01:36:60,0 id1,2017-04-27 01:37:00,2353 id1,2017-04-27 01:37:10,221 id1,2017-04-27 01:37:20,2432 id1,2017-04-27 01:37:30,2654 id1,2017-04-27 01:37:40,12 id1,2017-04-27 01:37:50,5 id1,2017-04-27 01:38:00,5 id1,2017-04-27 01:38:10,23 id1,2017-04-27 01:38:20,5 id1,2017-04-27 01:38:30,2 id1,2017-04-27 01:38:40,2 id1,2017-04-27 01:38:50,1 id1,2017-04-27 01:39:00,0 id1,2017-04-27 01:39:10,0 id1,2017-04-27 01:39:20,0 id1,2017-04-27 01:39:30,0 id1,2017-04-27 01:39:40,0 id1,2017-04-27 01:39:50,0 id1,2017-04-27 01:40:00,0 id1,2017-04-27 01:40:10,1 id1,2017-04-27 01:40:20,5 id1,2017-04-27 01:40:30,221 id1,2017-04-27 01:40:40,2432 id1,2017-04-27 01:40:5

bash - Remove Previouse Instances in a Pattern -

i have large output file (~25000 lines) of alphanumeric text has @ minimum 4 instances of each step possibly 5th followed data. want output last iteration of each step text file , delete others how this? example: each iteration should on own line input file: data.dat 1 step1.1 1 step1.2 1 step1.3 1 step1.4 2 step2.1 2 step2.2 2 step2.3 2 step2.4 2 step2.5 desired output: 1 step1.4 2 step2.5 this may destroy order: remember recent line each key: awk '{line[$1] = $0} end {for (key in line) print line[key]}' data.dat reverse file , print first time see key, re-reverse output (this "famous" awk idiom) tac data.dat | awk '!seen[$1]++' | tac

c++ - QTableWidget display certain number of rows at a time -

i have large qtablewidget. let's 200 rows. in qlistwidget, there setmaxvisibleitems(30), extremely useful. what's equivalent qtablewidget, except rows. ie. setmaxvisiblerows? i considered setting max height window. however, application can used on varying dpis. so, may small some. plus, felt needless restriction. i saw this: how show 30 rows , hide remaining rows of qtablewidget however, isn't same means. thank in advanced! the best way use qt's void qtableview::setrowhidden(int row, bool hide) void qtableview::setrowhidden(int row, bool hide): if hide true row hidden, otherwise shown. if know count of table can use othewise have use model , use rowcount() . then for loop should easy: for(int = starthidinghere; < numofrows; i++) mytable->setrowhidden(i, true); you can similar method un-hide them. method works great filters if needed in future. other possible useful methods: bool qtableview::isrowhidden(int

excel - Conditional MAX function -

Image
i'm using array formula return max value column (count) based on column (client name). each client has multiple account numbers repeated multiple times. intend return count of account number present in column (acct #) maximum times client. i'm able satisfactory results except when 2 or more account numbers same client have same count want return null or blank not max count. below example: acct # 4565 & 7898 repeated 6 time xyz ltd. since, xyz ltd. maximum time acct # repeated 6 more 1 account repeated 6 times, want return null or blank in column (count max) table array formulas: client name acct # count count max xyz ltd. 1234 =countifs(b:b,b2,a:a,a2) =max(if(a:a=a2,c:c)) xyz ltd. 4565 =countifs(b:b,b3,a:a,a3) =max(if(a:a=a3,c:c)) xyz ltd. 4565 =countifs(b:b,b4,a:a,a4) =max(if(a:a=a4,c:c)) xyz ltd. 4565 =countifs(b:b,b5,a:a,a5) =max(if(a:a=a5,c:c)) xyz ltd. 4565 =countifs(b:b,b6,a:a,a6) =ma

swift - Moving SKSpriteNode to location of the touch -

Image
above image of game. top-down game. wherever on screen player touches, want bullets go location duration. want player able drag around finger on screen, , same thing happens. player doesn't have touch screen everytime wants shoot. i've tried different stuff far nothing seems work. first off, dont know if should have separate function bullet. anyway, bullet function. func spawnbullets() { let bullet = skspritenode(imagenamed: "bullet") bullet.name = "bullet" bullet.zposition = 4 bullet.position = cgpoint(x: player.position.x + 19, y: player.position.y) self.addchild(bullet) } i have "timer" bullet in didmove function: var timer = timer.scheduledtimer(timeinterval: 0.1, target: self, selector: selector("spawnbullets"), userinfo: nil, repeats: true) and lastly, touchesbegan function: override func touchesbegan(_ touches: set<uitouch>, event: uievent?) { touch in touches {

python - Matplotlib histogram-values getting grouped incorrectly? -

Image
my task create histogram of neutron pulse heights. pulse heights separated 150 "categories", bin_names variable. number of neutrons detected @ each pulse height expressed counts variable. graph number of neutrons @ each height. here code: def make_hist(counts, bin_names, start_time, end_time, path): ''' graph title--later start_time = dt.datetime.fromtimestamp(start_time).strftime('%y/%m/%d %h:%m:%s') end_time = dt.datetime.fromtimestamp(end_time).strftime('%y/%m/%d %h:%m:%s') ''' print('counts', counts) [0, 0, 0, 5, 5, 6, 8, 6, 10, 7, 8, 5, 10, 8, 6, 9, 10, 12, 6, 13, 6, 14, 9, 10, 17, 16, 6, 18, 15, 11, 3, 16, 8, 8, 9, 10, 12, 13, 13, 5, 12, 6, 4, 12, 5, 6, 8, 6, 3, 3, 6, 1, 1, 5, 4, 0, 2, 3, 1, 3, 1, 2, 2, 0, 2, 2, 1, 2, 0, 0, 0, 1, 0, 0, 0, 3, 2, 1, 2, 1, 2, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 2, 0, 1, 2, 3, 1, 1, 2, 2, 2, 0, 2, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0,

Grouping columns together in R formattable -

apologies if question trivial, formattable documentation has me confused on issue. my data take shape of: source <- c("c", "p") name <- c("name1", "name2") n <- c(1234567, 4567890) <- c(12345, 67890) ratea <- / n deltaa <- c(na, (ratea[1] / ratea[2]) - 1) df <- data.frame(source, name, n, a, ratea, deltaa) df source name n ratea deltaa 1 c name1 1234567 12345 0.009999 na 2 p name2 4567890 67890 0.014862 -0.3272 there many more columns in actual data, repeating {a, ratea, deltaa} structure several more letters in alphabet. issue grouping columns in formattable command. is: for {source, name} -> no format change {n, a} -> comma format no digits after decimal {ratea, deltaa} -> percentages 2 digits after decimal (i.e., first value in ratea "0.99%") but, grouping columns not easy i'd like. based on formattable documentation tried result <- formattable(df

css - Align an image in the middle -

im trying align image in middle of page, failing that. currently, it's positioned on left side of container . react's render code: return ( <div> <div classname="container"> <div id="logo"> <img src={require('../../images/vidn_logo.png')} /> </div> {heading} <form classname="form-signin" onsubmit={this.formsubmit}> <input onchange={this.setemail} type="email" classname="form-control" autocomplete="email" placeholder="email" required></input> <input onchange={this.setpass} type="password" classname="form-control" autocomplete="new-password" placeholder="password" requir

c++ - non-trivial designated initializers not supported -

i rebuilding library , found error in section of code: enum fix_version { fix_4_0, fix_4_1, fix_4_2, fix_4_3, fix_4_4, fix_5_0, fixt_1_1, }; static const char *begin_strings[] = { [fixt_1_1] = "fixt.1.1", [fix_4_4] = "fix.4.4", [fix_4_3] = "fix.4.3", [fix_4_2] = "fix.4.2", [fix_4_1] = "fix.4.1", [fix_4_0] = "fix.4.0", }; the error receive is: sorry, unimplemented: non-trivial designated initializers not supported . have seen other examples of error, initializers struct , 1 simple char , how can solve this? code comes .c files , compiling in c++ through cmake . thank in advance. the equivalent c++ code this: enum fix_version { fix_4_0, fix_4_1, fix_4_2, fix_4_3, fix_4_4, fix_5_0, fixt_1_1 }; static const char *begin_strings[] = { "fix.4.0", "fix.4.1",

How to Store JSON array data of android app remotely? -

i have created android app data being managed in json array. app working fine share data of application in different mobiles, there possibility save data remotely in internet , sync json other devices. assuming way application if click button json data stored in google drive, , if click sync data button mobile data google drive location should download device. yes can use firebase , convert json gson string using serialize deserialize , convery string , send , fetch other side convery gson json. query ? help:- https://www.androidhive.info/2016/10/android-working-with-firebase-realtime-database/

wildfly - How to force spring boot to log to the container via SLF4J? -

i have spring boot application running on wildfly 10 wish "force" logging through container. ultimate goal control logging via standalone.xml config having org.springframework.* info level , own code debug level. after many questions , googling best solution achieved is: my own code logs correctly , "captured" container. spring framework in debug , ignores whatever defined in container root logger. org.hibernate.sql in debug , ignores application server. i spring auto-configuration report. my configuration far is: <!-- handlers , formatters ommited brevity --> <subsystem xmlns="urn:jboss:domain:logging:3.0"> <add-logging-api-dependencies value="true"/> <use-deployment-logging-config value="false"/> <logger category="com.arjuna"> <level name="info"/> </logger> <logger category="org.jboss.as.config"> <level

java - Client side data not displaying on webpage? -

Image
when viewing ,view page source shows data.on webpage it's not rendering full data. , 1 more when click delete shows me new learning java servlet , new programming language also.i didn't get-tin on did mistake? don't know how prevent query string getting unnecessary value. please me on this? <pre><code> package com.jspiders.studentsapp.servlets; import java.io.ioexception; import java.io.printwriter; import java.sql.connection; import java.sql.drivermanager; import java.sql.resultset; import java.sql.sqlexception; import java.sql.statement; import javax.servlet.servletexception; import javax.servlet.http.httpservlet; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; import com.mysql.jdbc.driver; public class viewallstudentdelete extends httpservlet { protected void doget(httpservletrequest req, httpservletresponse resp) throws servletexception, ioexception { resp.setcontenttype(&quo

How to convert a PDF into an array of images, with Carrierwave and MiniMagick (Ruby on Rails) -

i'm converting uploaded pdfs images, 1 image per page. have figured out how generate images using minimagick::tool::convert , don't know how write version block uploader, can access array of image urls. here's uploader far: class documentuploader < carrierwave::uploader::base include carrierwave::minimagick storage :file # storage :fog def store_dir "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end version :jpg process :convert_to_images process :set_content_type_jpg def convert_to_images(*args) image = minimagick::image.open(current_path) image.pages.each_with_index |page, index| minimagick::tool::convert.new |convert| convert.background 'white' convert.flatten convert.density 300 convert.quality 95 convert << page.path convert << "#{carrierwave.root}/#{store_dir}/image-#{index}.jpg"

r - Using boost multiprecision with Rcpp on Windows -

i'm trying compile , use following code (which have seen on so): // [[rcpp::depends(bh)]] #include <rcpp.h> #include <boost/multiprecision/float128.hpp> namespace mp = boost::multiprecision; // [[rcpp::export]] std::string mexp(double mx) { mp::float128 x(mx); mp::float128 res = mp::exp(x); return res.convert_to<std::string>(); } before compiling, have sys.setenv("pkg_libs" = "-lquadmath") otherwise compilation not work. compilation runs fine, when type mexp(1) in r, r session totally crashes. missing ? session crashes in rstudio in classical r gui. ps: under windows , crash r-3.3.3 r-3.4.1. edit: just tried on linux r-3.4.1 , works fine. don't need sys.setenv("pkg_libs" = "-lquadmath") .

sqlite - SQL syntax error: no such column -

i new sql. stuck on error while, hope 1 me. update roads1f set indoorpathway=pathway1f.indoor_pathway astext(roads1f.geometry)= astext(pathway1f.geometry) the error no such column pathway1f.indoor_pathway i checked pathway1f table, has indoor_pathway column. did use wrong method reference data in table? pathway1f , roads1f same. geometry can considered primary key. pathway1f has column indoor_pathway, roads1f doesn't have. want copy indoor_pathway pathway1f roads1f. you need join update roads1f set indoorpathway=( select pathway1f.indoor_pathway pathway1f astext(roads1f.geometry)= astext(pathway1f.geometry))

video - encoding a yuv file into mpeg2 using mpegencoder -

i wanted compress .yuv using mpeg-2 standard. so, have downloaded mpegencoder of mssg. below code parameters file. don't know how store output video. please me issue. want single , double compressed videos using mpeg-2 standard.is there software serve purpose. akiyo_cif /* name of source files */ - /* name of reconstructed images ("-": don't store) */ - /* name of intra quant matrix file ("-": default matrix) */ - /* name of non intra quant matrix file ("-": default matrix) */ - /* name of statistics file ("-": stdout ) */ 1 /* input picture file format: 0=*.y,*.u,*.v, 1=*.yuv, 2=*.ppm */ 3 00 /* number of frames */ 0 /* number of first frame */ 23:59:59:24 /* timecode of first frame */ 6 /* n (# of frames in gop) */ 2 /* m (i/p frame distance) */ 0 /* iso/iec 11172-2 stream */ 0 /* 0:frame pictures, 1:field pictures */

c# - OpenFileDialog - How to prevent the default directory from being overwritten? -

i'm trying find way reset initial/default directory after closing openfiledialog. consider following example: using (openfiledialog openfile = new openfiledialog()) { // example: opens in 'desktop' directory // user navigates 'documents' directory in form before selecting file dialogresult result = openfile.showdialog(); if (result == dialogresult.ok) messagebox.show(openfile.filename); } // somewhere else, code runs using (openfiledialog openfile = new openfiledialog()) { // problem: opens in 'documents' directory. not good! // how open using same default directory (ie: desktop)? dialogresult result = openfile.showdialog(); if (result == dialogresult.ok) messagebox.show(openfile.filename); } just clear, 'desktop' example, won't know initial directory it's stored in registry (if understand correctly). i tried using restoredirectory option. did not seem have effect. i've read elsewhere it's su

tsql - SQL Server User Defined Table Types and BCP Export -

i can't seem script work. i'm getting following error: msg 137, level 16, state 1, line 14 must declare scalar variable "@tvp_glicu". can tell me missing? declare @tvp_glicu tvp_glicu declare @cmd varchar(500) declare @timestamp nvarchar(100) = replace((convert(varchar(25), getdate(), 121)),':','') --insert batch numbers in user defined table types insert @tvp_glicu (id) values ('563704') insert @tvp_glicu (id) values ('498721') --select * --from @tvp_glicu set @cmd = 'bcp "execute [f0902].[d365o].[get-f0911newrecords]'+@tvp_glicu+'" queryout "d:\d365o\datasource\f0911\'+@timestamp+'.csv" -c -t\^, -t -s' + @@servername + '' execute master..xp_cmdshell @cmd you can't refer table variable bcp created outside scope of query parameter. when bcp executed, creates new session , scope of table variables limited session created table variable.

dependencies - Setting a package install-path for composer -

i've learned how set custom install-path composer package on project side . "extra": { "installer-paths": { "foobar": ["vendor/package"] } } however, want able set dir name package on package side , in composer.json file within package repo. placing installer-path key there doesn't affect installation dir , package installed in default vendor/packagename dir. how set install path package within it's own composer.json? it can solved adding installer-name extra key in package's composer.json file. "extra": { "installer-name": "foobar, }

node.js - NetBeans moving breakpoints (NodeJS) -

when try debug nodejs program in netbeans, instead shifts breakpoints , stops on different lines. example, tried test program: /* 1 */ var fs = require("fs"); /* 2 */ var ld = require("lodash"); /* 3 */ var moment = require("moment"); /* 4 */ /* 5 */ var test = ld.after(1, function() { /* 6 */ console.log(moment()); /* 7 */ }); /* 8 */ test(); when attempt debug breakpoint on line 6, instead stops on line 8. if attempt place breakpoint after starting program, shifts line 8; attempting re-place breakpoint on 6 causes line 8 have multiple breakpoints. causing , how can stop it?

vbscript - Trying to press keys and shortcuts in a hidden CMD window -

i trying create script use copy con write file set objnetwork = createobject("wscript.network") currentuser = objnetwork.username set wshell = createobject("wscript.shell") wshell.run "%comspec% cd c:\users\" & currentuser & _ "\appdata\roaming\microsoft\windows\start menu\programs\startup & copy con master.vbs & x = 1 & x=2^z", 0, true the problem here while using ^z simulate output of crtl + z , cmd doesn't treat them same. as can see, wanted console window hidden, using sendkeys won't work here. any suggestions?

TestNG: repeat a method -

i have test case requires me log out multiple times. want log out own test/method. instead of creating log out method each time, there way can call method? @test(priority = 1, groups = {"regression"}) public void createaccount() throws exception {} @test(priority = 2, groups = {"regression"}) public void addpayment() throws exception {} @test(priority = 3, groups = {"regression"}) public void logout() throws exception {} @test(priority = 4, groups = {"regression"}) public void login() throws exception {} @test(priority = 5, groups = {"regression"}) public void logout() throws exception {} you can using @aftermethod annotation. method called after every test method. if want run test methods, can pass in itestresult test method names. might want include alwaysrun=true logout method run if test fails. something this: @aftermethod(alwaysrun=true) public void logout(itestresult result) { if (result.getname().equalsi

git - How to get commits from remote master to local branch -

before down voting or marking duplicate, let me explain situation. i've remote branch qr-frontend have local branch qr-frontend . need changes master local qr-frontend branch. i'm trying merge branch master remote , pull request. i tried following: git checkout qr-frontend git fetch origin git merge origin/master but when try last command, lot of conflicts on files made changes after last merge. can me correct flow? also, how keep local branch updated master remote?

oracle - how to force user to enter value for substitution variable? -

i have script sqlplus form. ask user enter values substitution variables execute insert statement. some substitution variables used mandatory columns, how can ask user fill again if substitution variable value null? how assign value same substitution variable depending on it's value forcing user enter it? or how force user enter value substitution variable ? something like psedu code: accept x prompt please enter value x while (&x null) loop accept x prompt please enter value x end loop insert ... is possible this crazy but... based on this answer gave question can create script called main.sql this: accept x prompt please enter value x accept y prompt please enter value y accept z prompt please enter value z set term off verify off column script new_value v_script select case when '&&x.' null or '&&y.' null or '&&z.' null 'main' else 'do_insert'

How to redirect using AngularJS datatable button? -

i trying redirect 1 page using angularjs data table button. calling function contains redirect url. function being called redirection not working. using $location.path redirect. doing in right way or there other ways redirect using data table button ? .withbuttons([ { text: 'next page', key: '1', action: function (e, dt, node, config) { $scope.redirect(); } }]); $scope.redirect=function() { $location.path('/next_page'); };

Extracting the cell.value from Excel workbook using Python -

hi trying extract local link cell using python. shows 1 instead of showing location link. please @ image here!! can me out? thank you.

python - How can I know which commit was used when installing a pip package from git? -

if install package git using https://pip.pypa.io/en/stable/reference/pip_install/#git specific commit checked out logged somewhere? you use knittl's idea find nearest commit -- modification below address fact comparing git tree installed package, not git repository: since installed package may lack of directory structure of git repository, make new directory git repo. i'll use html5lib example: mkdir ~/tmp/html5lib cd ~/tmp/html5lib/ git init now fetch git tree: git remote add foreign https://github.com/html5lib/html5lib-python git fetch foreign copy installed package git repo: rsync -a ~/.virtualenvs/muffy/lib/python3.4/site-packages/html5lib ~/tmp/html5lib/ run git diff compare current state of repo (with installed package's code) each revision in git tree: for rev in $(git rev-list --all); echo $(git diff --shortstat foreign/master $rev) $rev ; done | sort -n this sorts number of files changed, number of insertions, deletions. outpu

ios - How to build Xcode project from the command line? -

i've tried reading xcode tools documentation apple provides, can use terminal build .app file , run resulting app on simulator. want do same thing cmd + r on xcode. so far i've attempted build .xcodeproj this: xcodebuild -configuration debug build however, when install & run on simulator app w/ black screen: // boot device xcrun simctl boot "iphone 7" // install app xcrun simctl install "iphone 7" "/users/.../myapp/build/debug-iphoneos/myapp.app" // open simulator open /applications/xcode.app/contents/developer/applications/simulator.app // launch app using bundle id xcrun simctl launch booted "com.example.apps.myapp" not mention xcrun simctl launch booted "com.example.apps.myapp" line never terminates , on simulator keeps trying open , reopen app, app ever shows black screen. if tell me i'm doing wrong building of the .xcodeproj great!

javascript - Polymer 2.0: why do we need an anonymous function when imperatively adding listener -

in new docs polymer 2.0 ( https://www.polymer-project.org/2.0/docs/devguide/events#imperative-listeners ), gives following example: ready() { super.ready(); this.addeventlistener('click', e => this._myclicklistener(e)); } to add event listener imperatively. if wanted remove listener, have following (according docs): constructor() { super(); this._boundlistener = this._mylocationlistener.bind(this); } connectedcallback() { super.connectedcallback(); window.addeventlistener('hashchange', this._boundlistener); } disconnectedcallback() { super.disconnectedcallback(); window.removeeventlistener('hashchange', this._boundlistener); } this make sense me on surface; need make sure same reference function passed both remove , add event listener since that's way indexes different listeners. however, why have use .bind(this)? understand returns new function binds function whatever "this" is, it's useful make new reference

c# - Error: The LINQ expression node type 'ArrayIndex' is not supported in LINQ to Entities -

working on mvc5 app. have string array defined as.... string[] myarray; it has 3 items in it.... {string[3]} [0]: "a411d1bc-21f7-4e4d-a4d3-4dd36e1b319f" [1]: "ef4e3655-fa6f-4dfc-b2d4-178ac5914f0b" [2]: "d75a98c5-a829-43c5-b2cf-d50be1189a05" these primary keys records in aspnetuser table. want execute ef clause using array items in multiple "where". (so want retrieve these 3 users aspnetuser table.) here's code far... iqueryable<event> events = db.events; if (myarray != null) { events = events.include(a => a.aspnetuser); for(int = 0; <= myarray.length-1; i++) { events = events.where(u => u.aspnetuser.id == myarray[i].tostring()); } } so, can see, i'm looping thru array (that contains pk) , using in clause. but, right when hit first .where line in loop i'm getting error: the linq expression node type 'arrayindex' not supported in linq entities. what doin

How to retrieve HTML tag and PHP code with $request in Laravel 5 -

case : want create feature can create new template, save file , code self. i have problem when retrieve $request->code, <p>&lt;title&gt;abc&lt;/title&gt;<br><br>ini template<br><br>{{ $rip-&gt;profile-&gt;name }}<br></p> how can fix it? there no &lt; $gt; , on should go specific code editor? recomendation? fyi: use summernote text editor. thanks in advance.

c++ - Unique list of structure -

i have list of following structure struct element { int id; int groupid; }; i want know how many unique groups there for example list<element> myelements; element e; e.id = 0; e.groupid = 2; myelements.push_back(e); e.id = 1; e.groupid = 0; myelements.push_back(e); e.id = 2; e.groupid = 2; myelements.push_back(e); e.id = 3; e.groupid = 1; myelements.push_back(e); there 4 elements here 3 unique group ids 0, 1, 2 i'm trying efficient way because list grows in size. i tried struct groupid_unique { bool operator() (element first, element second) { return (first.groupid != second.groupid); } }; myelements.unique(groupid_unique()); but returns me 2 un-repetitive ids 0,1 use set store items (temporarily). set store unique items. size of set number of unique items. add equality comparator object: struct element { bool operator==(element const& rhs) const { return id == rhs.id &&am

php - How to stop preg_replace() returning numerical references? -

i'm using preg_replace() perform regular expression search , replace. $string = "this isn't real string example."; $result = preg_replace($pattern, $replacement, $string); echo $result; // isn&#8217;t real string example. as can see, $string contains single quote. regardless of whether match found, when output return value of preg_replace() , single quote becomes &#8217; how can stop preg_replace() returning numerical references such &#8217; ? need string keep single quote character. update here's pattern: $pattern = '/#(\w+)/'; update 2 here's replacement string: $replacement = '<a href="https://example.com/tag/$1/">#$1</a>'; you can try using html_entity_decode() achieve that here snippet $string = "this isn't real string example."; $result = preg_replace($pattern, $replacement, $string); echo html_entity_decode($result); // isn't real string example.

typescript - GSAP in Ionic project -

how can import gsap library ionic project. using npm install gsap don't work when import through import { tweenmax, timelinemax} "gsap"; i use typescript. thanks typical import import {tweenmax, power2, timelinelite} "gsap"; get parts aren't included inside tweenmax import draggable "gsap/draggable"; import scrolltoplugin "gsap/scrolltoplugin"; for more information- https://www.npmjs.com/package/gsap#npm

matlab - Editor tab disappeared in GUI -

Image
the matlab gui (for me) has 4 tabs in upper left - home, plots, apps , (i think) editor. editor tab has disappeared , cannot find documentation how turn on. tried layout->default arranges visible windows , doesn't re-enable missing editor. does know how turn on? type edit in command window. unfortunately right, there no 'editor' option in layout panel of matlab's interface, , obscure reasons it's not present in default layout.

asp.net mvc 4 - Nullable DateTime in Html Helper? -

Image
i have asp.net mvc application trying add field edit date. date nullable datetime object. trying create 3 input boxes (month, day, , year) , have them linked model. want display date components in boxes when there date set. when there's not, should not have value , display placeholder. i'm using html helpers (though not requirement), cannot work when date null. here's have currently: @html.editorfor(model => model.active_date_start.value.month, new { htmlattributes = new { @class = "form-control active-date", @placeholder = "mm", @maxlength = "2" } }) / @html.editorfor(model => model.active_date_start.value.day, new { htmlattributes = new { @class = "form-control active-date", @placeholder = "dd", @maxlength = "2" } }) / @html.editorfor(model => model.active_date_start.value.year, new { htmlattributes = new { @class = "form-control active-date", @placeholder = "yyyy", @maxle

c - Why we cannot dynamically allocate a pointer to a function? -

i tried dynamically allocate pointer function that void (*f)(void*); f = (*f)malloc(sizeof(f) * 2); and got error. error: expected ';' before 'malloc' after searched, discovered cannot dynamically allocate pointer function, can declare array. in first step, declare array of functions void (f[2])(void*); and saw got error, cannot declare array of functions, must declare array of pointers functions. void (*f[2])(void*); in search discovered too, pointer function doesn't point data, points code. if can explain me why cannot dynamically allocate pointer function , why cannot have array of function instead of array of pointers functions. my code following: #include <stdio.h> #include <stdlib.h> void printnr(void *nr) { printf("%i\n", nr); } void printchar(void *ch) { printf("%c\n", ch); } int main(void) { void (*f)(void*); f = (*f)malloc(sizeof(f) * 2); f = printnr; (f + 1) = printc

android - Retrofit/OkHttp3: Create and access custom RequestBody with an Interceptor -

i posting backend. service looks this: public interface thingservice { @post("thing/") @headers("content-type: application/json") single<result<thing>> postthing(@body @nonnull requestbody body); } and interceptor this: public class thinginterceptor implements interceptor { @override public response intercept(@nonnull chain chain) throws ioexception { return chain.proceed(getthingedrequest(chain.request())); } @nonnull private request getthingedrequest(request request) { string thing = getthing(request.body()); httpurl newurl = request.url().newbuilder() .addqueryparameter("thing", thing) .build(); return request.newbuilder().url(newurl).build(); } private string getthing(requestbody body) { thingrequestbody thingbody = (thingrequestbody) body; // no good, see below return thingbody.getthing(); } } here

Repurchase of domain in azure -

i deleted 1 domain 10 days ago , want purchase not showing in available list of domains. when opened www.my-domain-name.com showed "this page parked free, courtesy of azure". mean , how can domain back? you should contact azure support.

PCA data preparation - center, scale and normalization sparse matrix -

i have large sparse data set ~( 300000 * 10000 ), each row instance , each column feature. however, many pixels ( or features) each instance zeros, means there no data there. add zeros myself keep same shape each instance. , segments has data can reside in anywhere along 10000 pixels. example, data can reside 0 2000 pixels, or 1500 7000 pixels, or 5000 10000 pixels. have example fake dataset below: data = np.array([[0,0,0,1,3,5,0,0,0,0], [5,4,8,6,10,0,0,0,0,0], [0,0,4,8,7,3,2,6,9,0], [0,0,0,0,10,5,2,9,3,8], [1,2,3,4,5,6,7,8,9,10], [0,0,0,4,2,6,8,9,0,0]]) i have few questions data preparation: 1) how can better deal pixels data missing instead of adding 0 s in pixels. 2) if there no better solution missing data, how can center/ scale/normalize sparse data in dataset before use scipy.linalg.sparse.svds decompose dataset? hope hear inspiring ideas proceed.

f# - Partially deferred computation builder -

i'm trying work out how use computation builder represent deferred, nested set of steps. i've got following far: type entry = | leaf of string * (unit -> unit) | node of string * entry list * (unit -> unit) type stepbuilder(desc:string) = member this.zero() = leaf(desc,id) member this.bind(v:string, f:unit->string) = node(f(), [leaf(v,id)], id) member this.bind(v:entry, f:unit->entry) = match f() | node(label,children,a) -> node(label, v :: children, a) | leaf(label,a) -> node(label, [v], a) let step desc = stepbuilder(desc) let = step "a" { do! step "b" { do! step "c" { do! step "c.1" { // todo: still evals goes; need find way defer // inner contents... printfn "test" } } } do! step "d" { printfn "d" } } this produc

python 3.x - Input an answer until a certain value is reached -

i attempting let user guess random number created program. if gets number wrong program tell him if guess higher or lower random number. ask him input again. program should loop until random number guessed correctly. from random import randint random = (randint(0, 20)) guess = int(input("guess number: "), 0) if guess > random: print ("guess lower") elif guess < random: print ("guess higher") else: print("you guessed right!") i suggest learning for loops , while loops , , recursive function calls ; can job done you. here's simple example while loop (perform task, while something true): from random import randint random = (randint(0, 20)) guess = none while guess != random: guess = int(input("guess number: "), 0) if guess > random: print ("guess lower") elif guess < random: print ("guess higher") else: print("you guessed rig