Posts

Showing posts from February, 2013

c++ - finding wildcard entries efficiently -

i have map contains strings keys; string resemble wildcards. a key can have * @ end, means when lookup performed, string has key prefix shall match key. how can efficiently retrieve closest matching entry in such map? i tried sorting map entries in custom way , using lower_bound , sorting not produce correct result: #include <map> #include <string> #include <iostream> #include <algorithm> struct compare { bool operator()(const std::string& lhs, const std::string& rhs) const { if (lhs.size() < rhs.size()) { return true; } if (lhs.size() > rhs.size()) { return false; } bool iswildcardlhsatend = (!lhs.empty() && lhs.back() == '*'); bool iswildcardrhsatend = (!rhs.empty() && rhs.back() == '*'); if (iswildcardlhsatend && iswildcardrhsatend) { return lhs < rhs; } auto lhsubstring =...

Cassandra WriteTimeoutException exception in CounterMutationStage - node dies eventually -

i'm getting following exception in cassandra system.log: warn [countermutationstage-25] 2017-07-25 13:25:35,874 abstractlocalawareexecutorservice.java:169 - uncaught exception on thread thread[countermutationstage-25,5,main]: {} java.lang.runtimeexception: org.apache.cassandra.exceptions.writetimeoutexception: operation timed out - received 0 responses. @ org.apache.cassandra.service.storageproxy$droppablerunnable.run(storageproxy.java:2490) ~[apache-cassandra-3.9.jar:3.9] @ java.util.concurrent.executors$runnableadapter.call(unknown source) ~[na:1.8.0_112] @ org.apache.cassandra.concurrent.abstractlocalawareexecutorservice$futuretask.run(abstractlocalawareexecutorservice.java:164) ~[apache-cassandra-3.9.jar:3.9] @ org.apache.cassandra.concurrent.abstractlocalawareexecutorservice$localsessionfuturetask.run(abstractlocalawareexecutorservice.java:136) [apache-cassandra-3.9.jar:3.9] @ org.apache.cassandra.concurrent.sepworker.run(sepworker.java:109) [apache-...

(STILL NOT FIXED) PHP - Website loading because of file size -

this question has answer here: php change maximum upload file size 13 answers i making basic website can sign , login. working fine, except uploading image file use profile picture. whenever file around 300+ mb , submit form, page keeps loading , gives me '502: bad gateway' as error. i tried changing max_file_size in php.ini , did not change anything. tried increasing memory_limit in php.ini , again, did not fix problem edit 1: getting the 502: bad gateway error still whenever use phpstorm. when uploading nas (which has phpmyadmin , apache installed) works there. changed settings in php.ini, did not change said few times. stop giving me answer, since found answer billion times. edit 2: edited post , said has been answered already. not case. still having same problem!!! in php.ini need set both of following values: ; maximu...

angularjs - Create HTML output to copy and paste into a 2 column Excel page -

i'm working on creating web page allow me paste in bunch of text in textarea , show me cleaned output of need. example, can have 5000+ lines this: 2015-08-11 15:45:44 info filecount:135 - identifier: 198743247, reg-category: 255, dailycount: 1 , durationcode: 112 the information need dailycount number , durationcode number. have written code extract information , store results in array looks this: [{ "dailycount" : 1, "durationcode" : 112 }, { "dailycount" : 5, "durationcode" : 17 }, { "dailycount" : 2, "durationcode" : 6 }] what i'm trying achieve display output in 2 column view can copy output page , paste in 2 column excel sheet. currently, pasting output in excel results in data going 1 column. tried selecting 2 columns , pasting data, excel complains clipboard not having same size , shape selected cells. any appreciated. i'm using angular 1.4 repeat on array display output. if ...

c - Equivalent to Arduino millis() -

i working on integration of "shunt" type sensor on electronic board. choice on linear (ltc2947), unfortunately has arduino driver. have translate in c under linux compatible microprocessor (apq8009 arm cortex-a7). have small question 1 of functions: int16_t ltc2947_wake_up() //wake ltc2947 shutdown mode , measure wakeup time { byte data[1]; unsigned long wakeupstart = millis(), wakeuptime; ltc2947_wr_byte(ltc2947_reg_opctl, 0); { delay(1); ltc2947_rd_byte(ltc2947_reg_opctl, data); wakeuptime = millis() - wakeupstart; if (data[0] == 0) //! check if in idle mode { return wakeuptime; } if (wakeuptime > 200) { //! failed wake due timeout, return -1 return -1; } } while (true); } after finding usleep() equivalent delay(), can not find millis() in c. can me translate function please? arduino millis() based on timer trips overflow interrupt @ close 1 khz, or 1 millisecond...

Android Studio Notification Lights -

why led lights not working notification? notificationcompat.builder notificationbuilder = new notificationcompat.builder(this) .setdefaults(0) .setsmallicon(r.mipmap.ic_launcher) .setcontenttitle(remotemessage.getdata().get("username")) .setcontenttext(remotemessage.getnotification().getbody()) .setvibrate(new long[]{1500, 0, 1500, 0}) .setlights(color.blue, 2000, 1000) .setwhen(remotemessage.getsenttime()) .setautocancel(true) .setpriority(notificationcompat.priority_high) .setstyle(new notificationcompat.bigtextstyle().bigtext(remotemessage.getnotification().getbody())) .setsound(ringtonemanager.getdefaulturi(ringtonemanager.type_notification)) .setcontentintent(pendingintent); notificationmanager notificationmanager = (notificationmanager) getsystemservice(context.notif...

c# - JpegBitmapEncoder QualityLevel has no effect -

i want save image jpeg jpegbitmapencoder setting qualitylevel has no effect? resulting jpeg same size (~4mb 2200x1500px). rendertargetbitmap rtb = new rendertargetbitmap(collage.breite, collage.hoehe, dpi, dpi, system.windows.media.pixelformats.default); canvas.updatelayout(); rtb.render(canvas); jpegbitmapencoder jpgencoder = new jpegbitmapencoder(); jpgencoder.qualitylevel = 35; // no effect, image big jpgencoder.frames.add(bitmapframe.create(rtb)); using (var fs = system.io.file.openwrite(myfilename, variables))) { jpgencoder.save(fs); fs.close(); fs.dispose(); } i changed to: var fs = new filestream(myfilename, variables), filemode.create); jpgencoder.save(fs); fs.close();

oauth - OAuthToken app script google sheets not going to "Unverified auth flow" -

recently google changes policy oauthtoken requests. if app not verified supposed "unverified auth flow". have script convert sheet pdf , email it. when share "google sheets" has script users getting error 400 : invalid_scope , not "unverified auth flow". ideas why?

php - How can it be possible to divide in batches of AWS SNS topic based push notification? -

basically, using aws cloud application (concept of application based on posts , comments) in have thousand of users registered application , subscribed aws sns topic. whenever posts in app, users notified push notification same time using aws sns topic.so, user may active on app. traffic has been increased on database server , has been hanged. is there way divide topic in multiple topics , set delay (delay won't affect application requirement) between them , send push notification ? or else best resolution handle database load promblem

ios - Show an alert that looks like SKStoreReviewController -

how can show alert thats similar skstorereviewcontroller? i how looks , want use similar ui on app. make new view controller let vc = uiviewcontroller() vc.preferredcontentsize = cgsize(width: 250,height: 300) create want on view, example picker view let pickerview = uipickerview(frame: cgrect(x: 0, y: 0, width: 250, height: 300)) pickerview.delegate = self pickerview.datasource = self then add view controller vc.view.addsubview(pickerview) with can create alert view , set view controller key contentviewcontroller let customalert = uialertcontroller(title: "title", message: "", preferredstyle: uialertcontrollerstyle.alert) customalert.setvalue(vc, forkey: "contentviewcontroller") let okaction = uialertaction(title: "ok", style: .default) { uialertaction in // should happen when click ok } customalert.addaction(okaction) customalert.addaction(uialertaction(title: "abort", style: .cancel, ...

elasticsearch - logstash geoip filter returns _geoip_lookup_failure -

i working on logstash . have installed logstash-filter-geoip but when tried use returns _geoip_lookup_failure thi in logstash.conf file filter{ geoip { source => "clientip" } } this input logstash 55.3.244.1 /index.html 15824 0.043 it returns { "duration" => "0.043", "request" => "/index.html", "@timestamp" => 2017-07-25t14:33:30.495z, "method" => "get", "bytes" => "15824", "@version" => "1", "host" => "des-0033", "client" => "55.3.244.1", "message" => "55.3.244.1 /index.html 15824 0.043", "tried use returns _geoip_lookup_failuretags" => [ [0] "_geoip_lookup_failure" ] }

node.js - Find what NPM modules depend on yours in a local Verdaccio registry -

previously, similar question asked . however, question never received answer addressed attempting complete same task on local verdaccio repo. ben burns noted in comments, making api call used in highest rated answer result in server returning { "error" : "no such package available" } . is there way find dependents on local verdaccio registry? , if so, how?

javascript - Building an $http request from form field in AngularJS -

i trying build basic angularjs weather app takes users zip code form , makes api call current forecast. app has 2 views/routes. first view has input field , submit button collect user's zip. second view display forecast. what want have happen have user put zip code form , upon submitting it, build url make http request call with. final url like: baseurl + userzipfromform + .json i tried using angular's $http, won't let me pass in variable url expecting string. don't think trying qualify query parameter , i've read things creating factory little turned around @ moment. if using ng-submit trigger building url, how make $http request , put response right scope use in forecast view? html: <div class="text-center"> <h2>enter zip</h2> <form name="myform" ng-submit="submitmyform()"> <input type="text" ng-model="zipcode" /> <button type="submit" value...

Spring MVC - REST Api, keep getting 400 Bad Request when trying to POST -

i have rest api service should receive post calls. i'm using postman test them, keep getting 400 bad request error, no body, maybe i'm building bad controller... this controller @postmapping("/object/delete") public responseentity<?> deleteobject(@requestbody long objectid) { logger.debug("controller hit"); object o = service.findbyobjectid(objectid); if(o!=null){ service.deleteobject(object); return new responseentity<>(httpstatus.ok); } return new responseentity<>(httpstatus.not_found); } using @requestbody should send request in json, in way: { "objectid":100 } but 400 error, , strange think logger logger.debug("controller hit"); it's not printed in logs... sending { "objectid":100 } result in receiving object x objectid attribute in java method. if need send id, can use @pathvariable @postmapp...

node.js - angular 2 : file upload progress bar working incorrectly -

Image
i using ng2-file-uploader upload single image file node server. during upload, progress bar not indicating progress when click on "upload" button, though image saved node server. but when click on "cancel" button, progress indicator shows progress. component.ts @component({ selector: 'button-view', template: ` <input type="file" class="form-control" name="single" ng2fileselect [uploader]="uploader" /> queue length: {{ uploader?.queue?.length }} <table class="table"> <thead> <tr> <th width="50%">name</th> <th>size</th> <th>progress</th> <th>status</th> <th>actions</th...

ios - Cannot invoke initializer for type 'User' with an argument list of type '(snapshot: (DataSnapshot)) Swift 3 -

after update firebase pod got error : cannot invoke initializer type 'user' argument list of type '(snapshot: (datasnapshot))' and here code enter image description here any idea solve ..??? func loaduserinfo(){ let userref = databaseref.child("users/\(auth.auth().currentuser!.uid)") userref.observe(.value, with: { (snapshot) in let user = user(snapshot: snapshot) self.usernamelabel.text = user.username self.usercountry.text = user.country! self.userbiographytextview.text = user.biography! let imageurl = user.photourl! self.storageref.reference(forurl: imageurl).data(withmaxsize: 1 * 1024 * 1024, completion: { (imagedata, error) in if error == nil { dispatchqueue.main.async { if let data = imagedata { self.userimageview.image = uiimage(data: data) } } } else { ...

asp.net mvc - Certain Razor views not publishing -

using vs 2017 mvc 5 razor views. when publish application, handful of specific views not copied over. i'd discovered several se questions on same issue in 2010-2011 timeframe. @ time, issue build action in file's properties not set content due bug in rc has since been resolved. well, of mine do day content build action. any reason why small number of views not making in publish? as far i'm aware, there 2 things can cause happen. as in question, build action each view needs set "content" the view files need included in project file, in .csproj file there should line this: <content include="views\controllername\index.cshtml" />

java - How to mock external dependencies for final objects? -

public class a{ private final b b; public void meth() { //some code integer = b.some_method(a,fun(b)); //some code } private fun(int b) { return b; } } when(b.some_method(anyint(),anyint())).thenreturn(100) how mock externally dependency when writing unit tests class a. when mock dependency in above way, value of "a" not getting assigned 100 expected. actually answer of jakub correct. maybe need example understand how it. check main method , contructor of example. public class { private final b b; public a(b b) { this.b = b; } public void meth() { //some code integer = b.some_method(5,fun(5)); //some code system.out.println(a); } private int fun(int b) { return b; } public static void main(string[] args) { b b = mockito.mock(b.class); when(b.some_method(anyint(), anyint())).thenreturn(100); new a(b).meth(); } ...

windows installer - Fail installation of MSI for certain value of registry value -

can installation of msi creating wix fail (non zero) value in windows registry . value of registry changing on 1 of custom action. sequence of action need taken care through msi : 1) calling exe modifying windows registry check. 2) need read value registry , setting in property. 3) based on property value, need go ahead insallation (for 0 value) else need fail insallation. below wix file had created this. (pasting actions in sequence) <property id="inst"> <registrysearch id="instgo" root="hkcu" key="software\abc" name="result" type="raw" win64="no" /> </property> <setproperty id="instval" after="appsearch" value="-1" /> other logic... <binary id='verifyexepath' sourcefile='$(var.productsource)\myfile.exe '/> <customaction id=...

linux - How to have simple and double quotes in a scripted ssh command -

i writing small bash script , want execute following command via ssh sudo -i mysql -uroot -ppassword --execute "select user, host, password_last_changed mysql.user password_last_changed <= '2016-9-00 11:00:00' order password_last_changed asc;" unfortunately command contains both simple , double quotes can't do ssh user@host "command"; what recommended way solve issue ? using heredoc you can pass exact code on shell's stdin: ssh user@host bash -s <<'eof' sudo -i mysql -uroot -ppassword --execute "select user, host, password_last_changed mysql.user password_last_changed <= '2016-9-00 11:00:00' order password_last_changed asc;" eof note above doesn't perform variable expansions -- due use of <<'eof' (vs <<eof ), passes code remote system exactly , variable expansion ( "$foo" ) expanded on remote side, using variables available remote shell. this consume...

javascript - Console showing 'Failed to load resource: the server responded with a status of 404 (Not Found)' for resource I'm looking at/using -

in home.js file, i'm using 3 components in router . sometimes in console, error: failed load resource: server responded status of 404 (not found) for file hq.js when i'm using/looking @ file in app. any idea why be? providing code below: import react, { component } 'react'; import proptypes 'prop-types'; import { connect } 'react-redux'; import { browserrouter router, switch, route, navlink } 'react-router-dom'; import { getelementsbykeyname } '../entities/elements/getters'; import { getloggedinuser } '../entities/auth/getters'; import html5backend 'react-dnd-html5-backend'; import { dragdropcontext } 'react-dnd'; import menubar '../components/menubar'; import sky './sky'; import hq './hq'; import settings './settings'; class home extends component { constructor(props) { super(props); } render() { const { elements } = this.props;...

osx - Installing Local Version of Python -

i'm trying install own version of python independent of system 1 on mac. basically, i'm following machine learning tutorial . i'm in step 4.4 i'm trying run command "python create_lmdb.py" in command-line, error saying opencv module not found. so, found latest opencv tutorial sierra install opencv properly. in step 2 , 3 i've tried edit /.bash_profile "export path=/usr/local/bin:$path". i've saved , opened file confirm file changed. continued tutorial, when "which python" find python still system version file path of /usr/bin/python rather /usr/local/bin/python. i've spent 3 days on problem. i've searched around on here , tried various solutions. i've contacted apple, of course couldn't help...or wouldn't. googled crazy. i've tried installing different distribution of python. i've tried uninstalling , reinstalling python. thanks in advance help. in essence, don't want change. vario...

closures - Captured variable in a loop in C# -

i met interesting issue c#. have code below. list<func<int>> actions = new list<func<int>>(); int variable = 0; while (variable < 5) { actions.add(() => variable * 2); ++ variable; } foreach (var act in actions) { console.writeline(act.invoke()); } i expect output 0, 2, 4, 6, 8. however, outputs 5 10s. it seems due actions referring 1 captured variable. result, when invoked, have same output. is there way work round limit have each action instance have own captured variable? yes - take copy of variable inside loop: while (variable < 5) { int copy = variable; actions.add(() => copy * 2); ++ variable; } you can think of if c# compiler creates "new" local variable every time hits variable declaration. in fact it'll create appropriate new closure objects, , gets complicated (in terms of implementation) if refer variables in multiple scopes, works :) note more common occurrence of problem ...

go - pprof (for golang) doesn't show details for my package -

i've been trying profile go application ( evm-specification-miner ) pprof, output not useful: (pprof) top5 108.59mins of 109.29mins total (99.36%) dropped 607 nodes (cum <= 0.55mins) showing top 5 nodes out of 103 (cum >= 0.98mins) flat flat% sum% cum cum% 107.83mins 98.66% 98.66% 108.64mins 99.40% [evm-specification-miner] 0.36mins 0.33% 98.99% 6mins 5.49% net.dialip 0.30mins 0.28% 99.27% 4.18mins 3.83% net.listenip 0.06mins 0.052% 99.32% 34.66mins 31.71% github.com/urfave/cli.boolflag.applywitherror 0.04mins 0.036% 99.36% 0.98mins 0.9% net.probeipv6stack and here cumulative output: (pprof) top5 --cum 1.80hrs of 1.82hrs total (98.66%) dropped 607 nodes (cum <= 0.01hrs) showing top 5 nodes out of 103 (cum >= 1.53hrs) flat flat% sum% cum cum% 1.80hrs 98.66% 98.66% 1.81hrs 99.40% [evm-specification-miner] 0 0% 98.66% 1.53hrs 83.93% net.ip.matchaddrfamily 0 0%...

adal - OWIN: Issue with System.IdentityModel.Services, CookieHandler session cookie timeout, and no ability to secure session cookie -

listed below web.config file 4.5.1 .net mvc application. <system.identitymodel.services> <federationconfiguration> <wsfederation passiveredirectenabled="true" issuer=https://tenant.com/app/template_wsfed/somenumber/sso/wsfed/passive realm="http://local.tenant.com/clientportal/" requirehttps="false" /> <cookiehandler name="somenumber" persistentsessionlifetime="0:0:2" requiressl="false" /> </federationconfiguration> setting persistentsessionlifetime attribute on cookiehandler not having affect on cookie , not allowing expire trying secure cookie setting requiressl true throws error cannot authenticate user because url scheme not https , requiressl set true in configuration, therefore authentication cookie not sent. change url scheme https or set requiressl false on cookiehandler element in configuration this large enterprise utilizing f5 big-ip platform ss...

python 3.x - A vectorized solution producing a new column in DataFrame that depends on conditions of existing columns and also the new column itself -

my current dataframe data follows: df=pd.dataframe([[1.4,3.5,4.6],[2.8,5.4,6.4],[7.8,6.5,5.8]],columns=['t','i','m']) t m 0 14 35 46 1 28 54 64 2 28 34 64 3 78 65 58 my goal apply vectorized operations on df conditions follows (pseudo code): new column of answer starts value of 1. for row in df.itertuples(): if (m > i) & (answer in row-1 odd number): answer in row = answer in row-1 + m elif (m > i): answer in row = answer in row-1 - m else: answer in row = answer in row-1 the desired output follows: t m answer 0 14 35 46 1 1 28 54 59 60 2 78 12 58 2 3 78 91 48 2 any elegant solution appreciated.

java - How to set environment variable CLASSPATH and NoClassDefFoundError on LINUX -

i've been studying classpaths , came across question. used code below: class aaa { public aaa() { system.out.println("aaa"); } } class bbb { public bbb() { system.out.println("bbb"); } } class abmain { public static void main(string[] args) { aaa aaa=new aaa(); bbb bbb=new bbb(); } } on terminal, did: javac abmain.java mkdir sub set classpath=.:.\sub; move aaa.class .\sub\aaa.class move bbb.class .\sub\bbb.class java abmain when checked sub directory, found aaa.class , bbb.class correctly moved, when try run abmain, following: exception in thread "main" java.lang.noclassdeffounderror: aaa @ abmain.main(abmain.java:17) caused by: java.lang.classnotfoundexception: aaa @ java.net.urlclassloader.findclass(urlclassloader.java:381) @ java.lang.classloader.loadclass(classloader.java:424) @ sun.misc.launcher$appclassloader.loadclass(launcher.java...

web scraping - Python BeautifulSoup extract html table cells that contains images and text -

i want extract table url, got lost... see have done below: url = "https://www.marinetraffic.com/en/ais/index/ports/all/per_page:50" headers = {'user-agent': 'mozilla/5.0'} raw_html = requests.get(url, headers=headers) raw_data = raw_html.text soup_data = beautifulsoup(raw_data, "lxml") td = soup_data.findall('tr')[1:] country = [] data in td: col = data.find_all('td') country.append(col) how text , url of of columns (country, port name, un/locode, type, , port's map)? i did scraping you. can use dictionary key value table headers below. can iterate through individual td required column , use find('tag_name')['attribute_name'] url, src, href etc , .text texts. hope helps. url = "https://www.marinetraffic.com/en/ais/index/ports/all/per_page:50" headers = {'user-agent': 'mozilla/5.0'} raw_html = requests.get(url, headers=headers) raw_data = raw_html.text so...

R: find two strings most commonly found together per category -

i have data frame (df) 3 columns: id number, category, , brand: id category brand 00129 bits b89 00129 bits b87 00129 bits b87 00129 logs b32 00129 logs b27 00129 logs b27 00130 bits b12 00130 bits b14 00130 bits b14 00131 logs b32 00131 logs b27 00131 logs b32 00132 bits b77 00132 bits b89 00132 bits b89 i have 200 different categories , 2000 different brands. i want find 2 brands per category bought id numbers: category brand bits b89,b87 logs b32,b27 or: #$bits #[1] "b89" "b87" #$logs #[1] "b32" "b27" the way think of rework data frame make sure calculated acknowledgment of diff...

scala - Getting a Unique Count over a Particular Time Frame with Spark DataFrames -

i'm trying figure out if i'm trying accomplish possible in spark. let's have csv if read in dataframe looks so: +---------------------+-----------+-------+-------------+ | timestamp | customer | user | application | +---------------------+-----------+-------+-------------+ | 2017-01-01 00:00:01 | customer1 | user1 | app1 | | 2017-01-01 12:00:05 | customer1 | user1 | app1 | | 2017-01-01 14:00:03 | customer1 | user2 | app2 | | 2017-01-01 23:50:50 | customer1 | user1 | app1 | | 2017-01-02 00:00:02 | customer1 | user1 | app1 | +---------------------+-----------+-------+-------------+ i'm trying produce dataframe includes count of number of times unique user customer has visited application in last 24 hours. result so: +---------------------+-----------+-------+-------------+----------------------+ | timestamp | customer | user | application | uniqueuservisitedapp | +---------------------+-----------+------...

javascript - angular reactive form - bind another property other than [value] -

i have angular reactive form select box follows: <select formcontrolname="incomesourceid"> <option value="" disabled >select source</option> <option *ngfor="let source of primarysourceincome" [value]="source.value">{{source.viewvalue}}</option> </select> i show/hide sections depending on dropdown selection. far have: <div class="row" [hidden]="applicationform.get('incomesourceid').value !== '1'"></div> <div class="row" [hidden]="applicationform.get('incomesourceid').value !== '2'"></div> component: this.applicationform = this.fb.group({ incomesourceid: ['', [validators.required, validators.minlength(1), validators.maxlength(50)]] }) this works however, logic based on value, id returned server. prefer build logic check against {{source.viewvalue}} , not change. how can bind ...

active directory - How can you use asp.net core windows authentication alongside Cookie Authentication? -

i have asp.net core (.net framework 4.7) application using cookie authentication in this link app.usecookieauthentication(new cookieauthenticationoptions() { authenticationscheme = "cookieauthentication", loginpath = new pathstring("/login/"), accessdeniedpath = new pathstring("/login/"), automaticauthenticate = true, automaticchallenge = true }); what want allow windows authentication cookie authentication. if user in company's domain he/she doesn't have enter user name , password.but if coming external domain redirected login page , enter user name , password authenticated. if user in company's domain he/she doesn't have enter user name , password. doesn't have enter user name , password tricky part. far know, cannot satisfy both authentication at same time . however, can ask both type of users enter username , password, , authenticate system first. if au...

html - How to avoid populating a table in a repetitive manner? -

Image
right have table looks this: the html table looks (i included brief snippet because rest of html looks same): <table class="table table-bordered table-condensed"> <tr> <th>days</th> <th>date</th> <th>calories</th> <th>happiness</th> <th>hunger</th> <th>motivation</th> </tr> <tr> <td>1</td> <td id="day">{{dayarray[0]}}</td> <td id="calorie">{{caloriearray[0]}}</td> <t...

entity framework - Is there a way to disable building the project during dotnet commands like ef migration or database update? -

i use dotnet cli 2 things dotnet ef migrations add somemigrationname dotnet ef database update both of these build project before doing need , build takes 2 minutes reason, although not when building through vs. how can prevent commands first building project?

pyspark - Metastore error while launching multiple Jupyter Spark notebooks from same directory -

i running jupyter notebook (jupyter 1.0.0) spark (spark 2.1.0) , able run pyspark code. when launch 2 notebooks located under same directory shown below: notebooks |__ notebook1 |__ notebook2 , launch notebook1 , launch notebook2, notebook1 launches , works notebook2 not launch due spark context initiation errors. looks spark metastore . below stack trace spark: caused by: error xsdb6: instance of derby may have booted database xxxxxxxx/notebooks/metastore_db. @ org.apache.derby.iapi.error.standardexception.newexception(unknown source) @ org.apache.derby.iapi.error.standardexception.newexception(unknown source) @ org.apache.derby.impl.store.raw.data.basedatafilefactory.privgetjbmslockondb(unknown source) @ org.apache.derby.impl.store.raw.data.basedatafilefactory.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ org.apache.derby.impl.store.raw.data.basedatafilefactory.getjbmslockondb(unknown source) @ org.apache.derby.impl.store.raw.d...

javascript - how to use jsdom to test functions with 'document' -

i have small question.. trying test functions created (written in typescript), , using mocha/chai/jsdom. now, error while testing functions 'document' inside document.. message 'referenceerror: document not defined'. how can still test these functions 'document' in it? for example: [prompt.spec.ts] import { expect } 'chai' import { jsdom } 'jsdom' import { functionx } './functions' describe('functions', () => { it('is possible execute functionx simple parameters', () => { const jsdom = new jsdom() const htmlelement = jsdom.window.document.createelement('div') expect(functionx(htmlelement, function() { return true; } )).to.equal(true) }) }) [functions.ts] export const functionx = ( body:htmlelement, callback: (ok: boolean) => void ) => { const doc = body.ownerdocument const parent = doc.body // ... let container = document.queryselector('.container...

Opening a .tif image using matplotlib Python -

Image
i pretty new python , trying load .tif image following code in order later mark dots @ various x , y coordinates. import matplotlib.pyplot plt import matplotlib.image mpimg image = mpimg.imread("mothtest.tif") plt.imshow(image) plt.show() i've used following image: and produces following errors: file "<ipython-input-1-69a4ce2424d3>", line 1, in <module> runfile('z:/04projects internal/gemultiplexerproject/method/statisticalmethods/cell arangement app/python app/centroid_lut.py', wdir='z:/04projects internal/gemultiplexerproject/method/statisticalmethods/cell arangement app/python app') file "c:\users\michaela\anaconda2\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile execfile(filename, namespace) file "c:\users\michaela\anaconda2\lib\site-packages\spyder\utils\site\sitecustomize.py", line 87, in execfile exec(compile(scripttext, filename, 'exec'), g...

c++ - Is it possible to have more than 1 .cpp file in a project (souce folder)? If so how would the .cpp file communicate? -

so, working c++. know how link .h file .cpp (pretty simple stuff.) problem having that, don't want write code in 1 .cpp file, makes big , organization becomes hustle. in other languages (c# , python) able write class in different file derive children it, header file in c++, .h files used declaration of functions , .cpp being coded. so, without having 1 large .cpp file, can code in multiple .cpp files? sure. have 1 header file relevant declarations , can have multiple source files implementing them. need make sure linked together. it possible, because when link them together, doesn't matter translation unit definitions come from, thing matters exist. there no difference if have implemented them in same translation unit. it this: // header.h // guards... void func1(); void func2(); // source1.cpp #include "header.h" void func1() {} // source2.cpp #include "header.h" void func2() {}

Kendo UI Angular 2 Default Grid Filter -

i want users use 2 filter options. works default seems contains filter. how change allow <kendo-filter-startswith-operator> to default operator in grid this?? <kendo-grid [data]="view | async" [pagesize]="state.take" [skip]="state.skip" [sort]="state.sort" [sortable]="true" [pageable]="true" [filterable]="true" [scrollable]="'scrollable'" [height]="500" (datastatechange)="datastatechange($event)" [filter]="filter"> <kendo-grid-column field="productionorder" title="order"> <ng-template kendogridfiltercelltemplate let-filter let-column="column"> <kendo-grid-string-filter-cell [column]="column" [filter]="filter"> <kendo-filter-startswith-operator></kendo-filter-startswith-operator> <kendo-filter-eq-operator></kendo-filt...

javascript - Auto-format credit card number input as user types -

i want create input using javascript automatically formats in correct credit card format. what want? the input should format input in groups of 4. e.g. if typed in 1234567890123456 , should format 1234 5678 9012 3456 the max length should 16 digits. if typed in 1234567890123456789 should format "1234 5678 9012 3456" formatting should occur type. if typed "123456" should format "1234 56" invalid characters should ignored. if typed in 564adsd299 474 should format "5642 9947 4" the input should respect traditional behaviour of textbox. (the | here resembles cursor e.g. if typed in 8 when input is: 1234 5|67 should turn 1234 58|67 1234| , should turn 1234 8 1234| 567 should turn 1234 8567 1234| 5679 should turn 1234 8567 9 if delete previous character when input is: 1234 5|67 should turn 1234 |67 1234 |567 should turn 1234| 567 1234| 567 should turn 123|5 67 more test cases follow. example basically sh...

python - NetworkX add_nodes_from doesn't work as expected -

>>> import networkx nx >>> g = nx.graph() >>> g.add_nodes_from([1, 2, 3, 4, 5], carved=false) >>> g[1] {} >>> nx.get_node_attributes(g, "carved") {1: false, 2: false, 3: false, 4: false, 5: false} >>> shouldn't getting "carved" attribute when type 'g[1]'? following works: >>> g[1] {} >>> g[1]["carved"] = true >>> g[1] {'carved': true} >>> what missing here, why isn't "carve" attribute being applied in second example? i'm running python 2.7 on windows. updated install of networkx, thinking maybe had older version? any appreciated. it looks intended use g.node[1] instead of g[1] .

android - Why can't I add Google Cast Companion Library to my project? -

currently, project uses cast companion library sources. here dependencies in build.gradle file: dependencies { compile files('../../external/commonlibs/json/json-io-2.6.0.jar') compile filetree(dir: '../../external/commonlibs/annotations', include: '*.jar') compile filetree(include: '*.jar', dir: 'src/main/libs') compile project(':common') compile project(':common_ui') compile project(':android-google-play-services_lib-v22') compile project(':android-castcompanionlibrary-v22') compile project(':adara-middleware') compile project(':android-support') compile project(':android-mediarouter') compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4' testcompile filetree(dir: '../../external/testlibs', include: '*.jar') androidtestcompile 'com.android.support.test.espresso:espresso-contrib:2.2...

angular - How to add columnDefinitions into md-table from my component content -

i'm starting in angular 2 , didn't found this. how said in title, i've component column definitions set in content, this: <tabela-com-consulta [datasource]="ds"> <ng-container cdkcolumndef="id"> <md-header-cell *cdkheadercelldef md-sort-header >id</md-header-cell> <md-cell *cdkcelldef="let row">{{row.id}}</md-cell> </ng-container> <ng-container cdkcolumndef="nome"> <md-header-cell *cdkheadercelldef md-sort-header>name</md-header-cell> <md-cell *cdkcelldef="let row">{{row.name}}</md-cell> </ng-container> </tabela-com-consulta> now component template: <div id="ls" fxflexfill> <md-table [datasource]="datasource" mdsort> <!-- add each contentchildren of component...

mysql - PHP - file not sending to database error -

i allow users submit files database on website. every time file submitted, these error messages ( ! ) warning: file_get_contents() expects parameter 1 valid path, array given in c:\wamp64\www\mt\developerupload.php on line 8 ( ! ) warning: trim() expects parameter 1 string, array given in c:\wamp64\www\mt\developerupload.php on line 9 but told "file_get_contents" way send file contents database. without "file_get_contents" sends it, gives me error messages , not sure why. want is, submit file using "file_get_contents" later on can display content on users page. here code php $query = "insert pack_screenshots(pack_id, file_name, file_tmp)values(:packid, :file_name, :file_tmp)"; $stmtfileupload = $handler->prepare($query); $errors = array(); foreach($_files['file']['tmp_name'] $key => $error){ if ($error != upload_err_ok) { $errors[] = $_files[...

highmaps - Highcharts Drilldown fail -

i'm using highcharts maps drilldown jsfiddle problem when drilldown, change dataclasses this chart.update({ coloraxis: { dataclasses: [{ to: 5000 }, { from: 5000, to: 6000 }, { from: 6000 }] } }); and works , when drillup have this drillup: function () { this.settitle(null, { text: 'general' }); this.coloraxis[0].update({ coloraxis: { dataclasses: [{ to: 200000 }, { from: 200000, to: 350000 }, { from: 350000 }] } }); } all works perfect when try drilldown again doesn't work. idea solve problem? or how change data classes in different way? it bug , reported here: https://github.com/highcharts/highcharts/issues/6679 . until it's fixed, use v5.0.10 . example: http://jsfiddle.net/hqngy7jj/ - using highmaps v5.0.10 ...

r - ggplot add extra x axis on string categorical x -

Image
i use ggplot draw above graph. related code here: p <- ggplot(avg.dice, aes(x=type, y=average)) + theme_bw() + geom_point() + geom_point(aes(x=type, y=cc.average), col="red") + geom_errorbar(aes(ymin=ci.lower, ymax=ci.upper)) my avg.dice data frame looks this: type average ci.lower ci.upper cc.average 1 e70 0.6105000 0.525 0.6850000 0.520 2 e89 0.5328000 0.480 0.6100000 0.510 3 f10 0.5902000 0.500 0.6900000 0.490 4 f15 0.4122000 0.365 0.4750000 0.335 5 f20 0.5583000 0.485 0.6200000 0.555 6 f22 0.4332000 0.365 0.4950000 0.325 7 f48 0.3113333 0.200 0.4666667 0.155 8 f80 0.5882000 0.510 0.6900000 0.355 9 i3i8 0.5438000 0.495 0.5900000 0.370 10 m5 0.5986000 0.550 0.6550000 0.485 11 series6 0.5271000 0.470 0.6000000 0.350 12 series7 0.5180000 0.450 0.5850000 0.390 13 x3 0.6190000 0.565 0.685...