Posts

Showing posts from August, 2011

c# - Web Api Redirect Incoming Events To Correct Controller -

i have basic restful web api project receive events third-party. there on 10 possible events third-party allows 2 subscriptions (a subscription contains callback url web api). rather limit myself 2 events, want create "master" controller can determine type of event being sent, , redirect json/post correct controller. here example controller have 1 of events [httppost] public async task<ihttpactionresult> create(createdobject createdobj) { await _classtohandleobj.methodtohandle(createobj); return ok(); } in json being sent, there field contains name of event. try read json , use conditional statements send it, wanted know if there best practice way of doing web api.

android - Mediaplayer unable to play audio file in Cordova -

i using media plugin in cordova , trying download , play audio file using below code: $http.get(url, {responsetype: 'arraybuffer'}).then(function(response) { requestfilesystem(filename, {create: true}, function gotfileentry(fileentry) { fileentry.createwriter(function gotfilewriter(writer) { writer.onwriteend = function() { var successcallback = onsuccess.bind(undefined, fileentry); var media = new media(filename, successcallback, successcallback); media.play(); }; writer.write(response.data); }, onerror); }, onerror) }, onerr somehow 1 audio file(412553300.acc) working fine when play second 1 after downloading server not playing code have given error on console this: e/mediaplayer: error (1, -2147483648) i not getting either code have problem or file(394127925) not enough ...

java - Dagger2 where inject @Named @Provides in dependent module? -

Image
i use dagger2 demo https://guides.codepath.com/android/dependency-injection-with-dagger-2 . want use cached , non_cached retrofit call. create in netmodule.java @provides @named("cached") @singleton okhttpclient provideokhttpclient(cache cache) { okhttpclient okhttpclient = new okhttpclient.builder() .cache(cache) .build(); return okhttpclient; } @provides @named("non_cached") @singleton okhttpclient provideokhttpclientnoncached() { okhttpclient okhttpclient = new okhttpclient.builder() .build(); return okhttpclient; } githubmodule.java dependent on netmodule.java. githubcomponent.java @userscope @component(dependencies = netcomponent.class, modules = githubmodule.class) public interface githubcomponent { void inject(demodaggeractivity activity); } my netcomponent.java @singleton @component(modules={applicationmodule.class, netmodule.class}) public interface netcomponent { // downstream components n...

openpyxl - XLRD intermittently reads Bloomberg excel formulas -

i using xlrd gather data excel sheet, performing calculations , writing same sheet (writing using openpyxl preserve .xlsx file type). part of data gathering uses bloomberg formulas automatically gather data in excel. xlrd can read few times, if run script more 3-4 times fails. data gathering strings, , when fails, reads in empty strings. formulas still preserved on sheet , data still there, data being read in doesn't work. does have insight issue, or way ensure compatibility in reading in info? thanks!

bash - File Lock on Linux -

so there 2 scripts: , b, both want write same file. it's possible both scripts want write file @ same time. how can lock file? while script writing file, script b has wait till file unlocked. i tried this: while [ -f $lock ] sleep 0.1 done touch $lock #action rm $lock problem script above it's possible, both of , b looking $lock @ same time, , cant find't start writing. help? try this: script open file set attribute chattr +i test.txt , after script done use chattr -i test.txt . for example: script a chattr +i test.txt tail -n 50 /var/log/maillog > test.txt chattr -i test.txt script b chattr +i test.txt tail -n 50 /var/log/messages > test.txt chattr -i test.txt

c++ - WrapPerspective doesn't dewrap corectly -

after procedure std::vector<std::pair<cv::point, cv::point>> tempendpoints , i'll following first , second parameter: first: [139, 113][201, 310][223, 339][297, 437][323, 472][381, 465][408, 413][484, 291][505, 151] second: [139, 210][201, 692][223, 664][297, 550][323, 523][381, 544][408, 580][484, 699][505, 254] now i'm stuck @ wrapperspective . each of "corner" points creats small image, has individual size (it earlier created textureimage ). stored , fine. want dewrap "small images" inside points, mentioned before. for (int = 0; < tempendpoints.size() - 1; i++) { //do stuff... cv::vec3b zero(0, 0, 0); cv::mat_<cv::vec3b> dewrapped(textureimage.rows, textureimage.cols, zero); cv::point2f srcpts[] = { point2f(tempendpoints[i].first), point2f(tempendpoints[i + 1].first), point2f(tempendpoints[i + 1].second), point2f(tempendpoints[i].second) }; std::cout ...

What is $sel in a Template Haskell Name? -

i'm calling th function, called createrecordsplice in following manner: data user = user {userfoo :: string, userbar :: text} deriving (eq, show, generic) createrecordsplice "user" ''user ['userbar] "newuser" "nuser" notice record selector userbar passed single-quote. now, in th function want check field names of user against userbar , i'm encountering strange field name contains $sel , due which, main logic failing work. (common.testrecordsplices.userfoo,[common.testrecordsplices.$sel:userbar:user]) (common.testrecordsplices.userbar,[common.testrecordsplices.$sel:userbar:user]) what $sel:userbar:user , how 1 convert userbar $sel:userbar:user , or vice versa, without resorting string manipulation? my th function: createrecordsplice :: string -> name -> [name] -> string -> string -> q [dec] createrecordsplice sourceprefix record requiredfields newrectype targetprefix = reify record >>= \case ...

ios - How to get the latest TCP package using GCDAsyncSocket -

i'm working on app uses sockets. use gcdasyncsocket purpose. problem receiving latest packet less number of bytes asked for. way ask packet: tcpsocket.readdata(tolength: length, withtimeout: -1, tag: 0) after that, appropriate delegate method called "length" number of bytes. problem when ask number of bytes larger number of available bytes - delegate method never called. , question is: how remaining bytes?

r - Why does content not appear in bsModal when coming from server? -

for reason displaying of bsmodal content seems go wrong when triggered observeevent server side, images , or text don't appear, , seems cause disabling of sweetalerts in cases (which prebuild modals). i tagged shinyjs reason, since app includes interaction it. besides long post, , complicated issue, hope bsmodal part sweetalert coding shinyjs , copy of work dean attali may other people happen read this. if find useful, give post upvote. a full app scenario 1, 2 , 3 found below. scenarios 4 , further not in full app, because cause other parts of app stop working add code. suggest try app @ end, , read through scenarios. (tried make clear possible.) i'm using bsmodals add new functionality shiny program (very large complex app), , discovered strange while trying incorporate images bsmodals . did research when problem occurs, , present test app here several scenarios. my primary issue: for purposes need figure out why scenario 7b doesn't work, i.e. bsmo...

javascript - ReactJS Uncaught TypeError: Cannot read property '' of null when one method is applied in another -

i use in method visibilityfilter(event){...} method helperfunction(){...}. when push button fire event error: uncaught typeerror: cannot read property 'helperfunction' of null how can rid of error in following code: class buttons extends react.component { helperfunction(){ let number = 2; return number }; visibilityfilter(event){ console.info(' helperfunction():',this.helperfunction()); //error here let action = {type: 'set_visibility_filter',payload: {name: event.target.dataset.filtername, on: true}}; store.dispatch(action); }; render(){ return( <div classname="container-fluid"> <div classname="row"> <div classname="col-lg-4 col-md-4 col-sm-4 col-xs-0"> <buttom type="button" classname="m-t-1-em w-100 btn btn-info" onclick={this...

How to fix hidden dataLabel in highcharts? -

please take @ jsfiddle . here, green bar doesn't display value. know adding overflow:"none", crop:false display value. goes out of plotting area, larger numbers overlaps title. green bar value (only) inside bar instead of hiding value. for particular column (i.e green column) label value inside, can add attribute inside: true in data .refer datalabels.inside more info series: [{ color: colors[0], showinlegend: false, data: [{ ....//first value , { y: 3500, name: 'second', color: colors[1], datalabels: { inside: true //labels inside column } },... // third , remaining }); fiddle demonstration

node.js - Abnormally high memory consumption MongoDb -

comrades. there problem. short description: there application on nodejs (cluster used, sits on 2 protsah). there mongodb (replicated). total value of bases ~ 5 gig. day of work, monga exceeds limit of 8gb , hangs. there not many requests application, 5000 per hour ... question how limit mongo , not fall.

sql - Wrong query in mariadb -

what problem query: insert x(a, b, c, d, e, f, g) values (1, 1, "<p style=\"text-align: center;\">hi</p>\n<p style=\"text-align: center;\"><strong>bye</strong></p>", "test", "test", "test", "test") select * x, y `condition` the error message is: you have error in sql syntax; check manual corresponds mariadb server version right syntax use near 'select * x, y ' @ line 2 @ error (native) code: 1064 i don't know wanted . here tips, should able figure out how fix code: this valid standalone statement: insert t (...) values (...); this insert gets values select : insert t (...) select ...; this old fashioned way from 2 tables: select ... x, y ...; change to select ... x join y on ... ...;

c# - Collecting cookies that are not set by HttpWebResponse -

i need scrape table of info site have valid credentials because owners of site not provide api. i performed login , saved traffic fiddler, , trying replicate key steps. i'm going show steps i've done far, , stuck. log base url cookiecontainer jar = new cookiecontainer(); request = (httpwebrequest)webrequest.create(urlbase); request.cookiecontainer = jar; httpwebresponse response = (httpwebresponse)request.getresponse(); newurl = response.responseuri.tostring(); along return cookie set. when @ cookiecontainer has count of 1 after call. interestingly response object not contain cookie - think okay because can use jar . 2nd call i'm not yet @ page name , password presented, doesn't happen until 4th call. httpwebrequest request = (httpwebrequest)webrequest.create(urlbase + secondcallfolderaddition); cookiecollection bakery = new cookiecollection(); request.keepalive = true; request.headers.add("upgrade-insecure-requests", @"1"); ...

java - How to add checkboxes to JTABLE swing -

Image
does know how put jcheckbox in jtable column? this: i took how use tables thanks in advance. 1) jtable knows jcheckbox built-in boolean tablecellrenderers , tablecelleditor default, there contraproductive declare that, 2) abstracttablemodel should useful, in jtable required reduce/restrict/change nested , inherits methods default implemented in defaulttablemodel , 3) consider using defaulttablemodel , (if not sure how works) instead of abstracttablemodel , could generated simple code: import javax.swing.*; import javax.swing.table.*; public class tablecheckbox extends jframe { private static final long serialversionuid = 1l; private jtable table; public tablecheckbox() { object[] columnnames = {"type", "company", "shares", "price", "boolean"}; object[][] data = { {"buy", "ibm", new integer(1000), new double(80.50), false}, {...

print sizes of all folder and files in each drive using powershell -

i running below powershell command getting error:trying calculate sizes of folder , files in each drive if size lessthan 1kb print size in kb otherwise in mb or gb ls -force | add-member -force -passthru -type scriptproperty -name length -value {ls $this -recurse -force | measure -sum length | select -expand sum } | sort-object length -descending | format-table @{label="totalsize (mb)";if ($_.length -lt 1kb) {expression={[math]::truncate($_.length / 1kb)};width=14} else {expression={[math]::truncate($_.length / 1gb)};width=14}}, @{label="mode";expression={$_.mode};width=8}, name error missing '=' operator after key in hash literal. @ line:1 char:230 + ls -force | add-member -force -passthru -type scriptproperty -name length -value {ls $this -recurse -force | measure sum length | select -expand sum } | sort-object length -descending | format-table @{label="totalsize (mb)";if ( <<<< $ _.le...

sql server - How to copy table to another table? -

i have table 1 000 000 records: create table [dbo].[x2]( [session_id] [uniqueidentifier] not null, [node_id] [uniqueidentifier] not null, [id] [int] identity(1,1) not null, constraint [pk_x2] primary key clustered ( [id] asc )); i need replace field [id] [int] identity(1,1) with [id] [bigint] identity(1,1) but data (including id values) should copied new table , id should identity bigint. i have created new table create table [dbo].[x2_new]( [session_id] [uniqueidentifier] not null, [node_id] [uniqueidentifier] not null, [id] [bigint] identity(1,1) not null, constraint [pk_x2_new] primary key clustered ( [id] asc )); and tried copy data: insert x2_new(session_id,node_id,id) select session_id,node_id,id x2; but slow. how copy data new table faster? in case.. need 'identity_insert off' on destination , insert script.. try setting nolock too.. 1 time activity or repetitive one?

html - How to use VBA for web parsing table with data-reactid -

Image
i trying parse each element table website, however, table reference data-reactid, question how use .document.getelementsbyxxx parse each element? 'vba table data tblnamearr = array(worksheets("sheet1").cells(2, 4), worksheets("sheet1").cells(3, 4), worksheets("sheet1").cells(4, 4), worksheets("sheet1").cells(5, 4)) tblstartrow = 6 set elemcollection = ie.document.getelementsbytagname("table") t = 0 elemcollection.length - 1 r = 0 (elemcollection(t).rows.length - 1) c = 0 (elemcollection(t).rows(r).cells.length - 1) activesheet.cells(r + tblstartrow, c + 1) = elemcollection(t).rows(r).cells(c).innertext next c next r activesheet.cells(r + tblstartrow + 2, 1) = tblnamearr(t) tblstartrow = tblstartrow + r + 4 next t the link website need parse: http://gu.qq.com/hk00001/gp/income

c# - What's the latest version of Roslyn my analyzer can target if I support VS2015? -

i'm writing roslyn diagnostic analyzer should work on vs2015 , later editions. want know latest version of microsoft.codeanalysis can use project , still support vs2015. need use api added in roslyn 1.2.0 ( analysiscontext.enableconcurrentexecution ), think version of roslyn isn't included vs2015 (iirc, vs2017 supports c# 7). mean can't use api in analyzer? yes, roslyn 2.3.0 work on visual studio 2017.3 , newer. in general mappings of roslyn visual studio versions works this: roslyn 1.0.x -> visual studio 2015.0 (rtm) roslyn 1.1.x -> visual studio 2015.1 (update 1) roslyn 1.2.x -> visual studio 2015.2 (update 2) roslyn 1.3.x -> visual studio 2015.3 (update 3) roslyn 2.0.x -> visual studio 2017.0 (rtm) roslyn 2.1.x -> visual studio 2017.1 roslyn 2.2.x -> visual studio 2017.2 roslyn 2.3.x -> visual studio 2017.3

sql - increase Row number based on the existing column -

Image
i using following sql rownumber increased 1 one. have attached image show need. when rownumber null should take max number table , add 1 ,max can 12. [![drop table #test123 create table #test123 ( monthname varchar(15), monthlycount int , totalcount int, rownumber int ) insert #test123 values ('jan', 1,1,1) ,('feb' ,3,4,2) ,('mar' ,null ,null,null) ,('apr', null,null,null) ,('may', null,null,null) ,('jun' ,null ,null,null),('jul', null,null,null) ,('aug', 6,10,3) ,('sep' ,null ,null,null) ,('oct', null,null,null) ,('nov', 2,12,4) ,('dec' ,null ,null,null) --select * #test123 ---i tried following sql select monthname,monthlycount,totalcount,case when rownumber null (select max(rownumber)+1 #test123) else rownumber end rownumber #test123][1]][1] here... order looking for: select [monthname] ,[monthlycount] ,[t...

iot - Not able to filter messages based on header properties in Azure Stream analytics -

i have created azure stream analytics (asa) job filter data based on custom header property send client app. how read/filter message header properties in azure stream analytics? portal return no results when try test out query. below query in azure portal. so far query simple this: select * [mystorage] [iothubin] properties.type = "type1" i tried call out key without parent (such as: type = "") no results well. i sure sending messages custom property in header since can view using device explorer tool. any idea how working? i haven't tried yet myself, supposedly can access custom properties via getmetadatapropertyvalue() . give try: https://msdn.microsoft.com/en-us/library/azure/mt793845.aspx

javascript - How to manipulate loops with input? -

i got loop , i manipulate counter i input on screen. below can select 1 10 , want selection replaced counter in loop. means when choose 2, i should 2. started code below, document.getelementbyid('options').innerhtml = "i" ; seems wrong code manipulate. help! <select id="options" size="1"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option...

pandas - Translating Zip, OrderedDict and DataFrame from Python to Typescript -

i have following code in python: import pandas pd import numpy np import collections import copy weekdays = { 1 : 'null', 2 : 'null', 3 : 'null', 4 : 'null', 5 : 'null', 6 : 'null', 7 : 'null'} months = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'] days_in_month_in_year = {'2017' : [31, 28, 31, 30, 31, 30, 31, 31, 30, 30, 30, 31], '2018' : [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], '2019' : [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],'2020' : [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] } days_in_month_in_year = pd.dataframe(days_in_month_in_year, index=months) startday = 7 month = 0 dict_of_months = collections.ordereddict() index, row in days_in_month_in_year.iterrows(): month_name = months[month] print (month_name) days_in_mo...

how to get the one option from select tag in html using php -

<form action='' method="post"> <select class="form-control" id='qty' name='qty'> <option value='1'>1</option> <option value='2'>2</option> <option value='3'>3</option> </select> <input type="submit" name="submit" value="add cart"> </form> <?php if (isset($_post['submit'])) { $qty = $_post['qty']; echo "$qty"; } ?> i trying to fetch 1 of option select tag.but don't know how fetch post method using form. have display the data got through form. please correct me if did mistake in coding php you have submit form either using button or submit form on change of qty. onchange="this.form.submit()" <form action='' method="post"> ...

What strategies are there for assembling Azure Function microservices into transactions? -

looking azure functions way of expressing small pieces of business logic, can assembled 'units of work.' perhaps creating new functions invoke others, perhaps logic apps, not sure. in general, how can these agglomerations of functions executed transaction... can db contexts , service bus transactions passed around? what strategies there assembling azure function microservices transactions? for micro service, eventual consistency more suitable strong transactional consistency. find more information of context , solution of transaction micro services following link. compensating transaction pattern applications running in cloud modify data. data might spread across various data sources held in different geographic locations. avoid contention , improve performance in distributed environment, application shouldn't try provide strong transactional consistency. rather, application should implement eventual consistency. in model, typical business operation c...

javascript - Angular 4 Firebase manipulate *ngFor of Observable or use index in an Observable -

i using angular 4 firebase database.in app want display on browser leaderboard top ten users. using code on component.ts export class homefillercomponent implements oninit { topusers: observable<any>; constructor(db: angularfiredatabase,public authservice: authservice) { this.topusers = db.list('users', { query: { orderbychild: "totalscore", limittolast: 10, } }).map((topusers) => {console.log(topusers); return topusers.reverse();}) } and html code: <a class="btn btn-download nav-item vlink dropdown-toggle pointer " data-toggle="dropdown">leaderboard</a> <ul class="dropdown-menu text-center list"> <ul *ngfor="let topuser of topusers | async"> <li> {{ topuser.username | json }}:{{ topuser.totalscore | json }} </li> ...

python - How do I change the font family of matplotlib bar chart labels? -

this question has answer here: how change fonts in matplotlib (python)? 4 answers i'm using following line add labels bar chart, how can adjust font family? plt.xticks(xticks_pos, labels, ha='right', rotation=55, fontsize=20) you can use fontname shown in this question . plt.xticks(xticks_pos, labels, ha='right', rotation=55, fontsize=20, fontname='monospace')

java - How can I access internal storage to list all pdf files in ListView -

public arraylist<string> getfiles(string directorypath) { arraylist<string> myfiles = new arraylist<string>(); file f = new file(directorypath); f.mkdirs(); file[] files = f.listfiles(); if (files.length == 0) return null; else { (int i=0; i<files.length; i++) myfiles.add(files[i].getname()); } return myfiles; } and called function passing enviroment.getexternalstoragedirectory() now how can same internal storage? public arraylist<string> searchpdfinexternalstorage(file folder) { arraylist<string> myfiles = new arraylist<string>(); if (folder != null) { if (folder.listfiles() != null) { (file file : folder.listfiles()) { if (file.isfile()) { //.pdf files if (file.getname().contains(".pdf")) { myfiles.add(file.getpath()); ...

reactjs - html textarea to state with react typescript -

i trying have input of textarea go state "competitors" when submit button clicked, having trouble accomplishing this. if have info on how debug scenarios in future helpful because dont know going on inside onsubmit() code: import * react 'react'; import * redux 'redux'; const { connect } = require('react-redux'); import { push } "react-router-redux"; import { col, jumbotron, row, well, label, button } 'react-bootstrap'; import { isession, iapplicationstate } "store"; import './profileuserpage-styles.scss'; import { feedcomponent, feed } "api" import { content } "components"; interface iprofileuserpageprops { session: isession; feed: feed; feedcomponent: feedcomponent; } interface iprofileuserpagestate { competitors: string[]; } function extractcompanies(lst: feedcomponent[]): string[] { var rstring: string[] = []; lst.foreach(element => { rstring.push...

python - Ignoring bad rows of data in pandas.read_csv() that break header= keyword -

i have series of messy *.csv files being read in pandas. example csv is: instrument 35392 "log file name : station" "setup date (mmddyy) : 031114" "setup time (hhmmss) : 073648" "starting date (mmddyy) : 031114" "starting time (hhmmss) : 090000" "stopping date (mmddyy) : 031115" "stopping time (hhmmss) : 235959" "interval (hhmmss) : 010000" "sensor warmup (hhmmss) : 000200" "circltr warmup (hhmmss) : 000200" "date","time","","temp","","spcond","","sal","","ibatt","" "mmddyy","hhmmss","","øc","","ms/cm","","ppt","","volts","" "random message here 031114 073721 031114 083200" 03/11/14,09:00:00,"",15.85,"",1.408,"",.74,...

vagrant - Pip stuck on "Running command python setup.py egg_info" - no errors. -

i run vagrant on windows 10 virtualbox,xenial64 ubuntu load taigaio via manual setup . at pip install -vvv -r requirements-devel.txt part , pip hangs forever when tries install django-sampledatahelper . when try install package, shows same effect: no errors, not going bash, hanging on: downloading url https://pypi.python.org/packages/2b/fe/e8ef20ee17dcd5d4df96c36dcbcaca7a79d6a2f8dc319f4e25107e000859/django-sampledatahelper-0.4.1.tar.gz#md5=a750d769af76d3f6e5791cfeb78832b0 (from https://pypi.python.org/simple/django-sampledatahelper/) running setup.py (path:/tmp/pip-build-pzcrou/django-sampledatahelper/setup.py) egg_info package django-sampledatahelper running command python setup.py egg_info i tried fresh vm install, in virtualenv or without it, pip mirrors, removing cache , --no-cache option, xenial64 , bento/ubuntu-16.04 distros, vagrant ssh , putty. efect same. it seems there wrong ubuntu xenial64 distribution , manual setup instructions. when use be...

visual studio - OpenCV 3.2 CommandLineParser on Windows 7 -

i creating software on opencv3.2 on windows7 (msvs-2017). using cv::commandlineparser getting commandline arguments. problem facing is, call constructor of commandlineparser, bad_alloc runtime problem. code this. #include "stdafx.h" #include <opencv2/core.hpp> #include <iostream> using namespace std; using namespace cv; void passargument(int argc, char **argv) { cout << "hello"; cv::commandlineparser parser{ argc, argv, "{ h | | print }" "{ info | false | print info }" "{ t true | true | true value }" "{ n unused | | dummy }" }; cout << "after constructor"; if (parser.get<bool>("help")) { cout << "help" << endl; } if (parser.get<bool>("info")) { cout << "info" << endl; } } int main(int argc, char** argv) { // initialize command-l...

Find if an element exists in C++ array -

#include <iostream> float x[10], k; int n, i; cout<<"n= "; cin>>n; (i=0; i<n; i++){ cout<<"x["<<i<<"]= "; cin>>x[i]; } cout<<"array's elements: "; (i=0; i<n; i++) cout<<x[i]<<", "; cout<<endl<<"k= "; cin>>k; for(i=0; i<n; i++) if(x[i]!=k){ cout<<endl<<"k doesn't exist in array."; cout<<endl<<"k= "; cin>>k; } i trying find if element exists in array, if doesn't exist want re-type element , repeat whole array , check it. mine doesn't start (i=0). there standard function called std::find in header <algorithm> : #include <iostream> #include <algorithm> int main() { int myarray[6]{10, 4, 14, 84, 1, 3}; if (std::find(std::begin(myarray), std::end(myarray), 1) != std::end(myarray)) std::cou...

Oracle datebase connectced through Entity Framework ( C# VS 2015 database-first) error -

i'm bit new entity framework , trying connect oracle database through entity framework. using visual studio 2015 entity framework wizard, created database reverse engineering our current database. when start debugging had error: an unhandled exception of type 'system.invalidoperationexception' occurred in entityframework.dll additional information: context cannot used while model being created. exception may thrown if context used inside onmodelcreating method or if same context instance accessed multiple threads concurrently. note instance members of dbcontext , related classes not guaranteed thread safe. using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using librarydll.dal; namespace librarydll { public class class1 { public void testdb() { using (entitiesdbtest db = new entitiesdbtest()) { list<book> boo...

javascript - Excel office-js API - Insert values to a blank sheet -

how can insert values blank sheet? way know of inserting values retrieving range , inserting values using values property, such as range.getrange("a1:" + cellbottomright); range.load("values"); context.sync().then(function () { range.values = twodimensionalarrayofvalues; }); is there simpler way using single function insert values, rather first retrieving range? thanks! edit : i've been trying create new sheet , insert 2-dimensional array it, values inserted starting cell a1. far, managed following: let neesheet = context.workbook.worksheets.add("new sheet"); newsheet.activate(); newsheet.getrange("a1").values = twodimensionalarray; context.sync(); but didn't work. how can work? thanks! (adding answer in response new information @avi12 added question above, under "edit") philip's answer above correctly shows how insert single value cell a1 of worksheet. address specific scenario you'...

python - menuBar() in PyQt5 -

Image
i trying load menubar onto gui, class object has no attribute self.menubar(). can me, no tutorials seem offer way around. class emailblast(qtwidgets.qwidget): def __init__(self): super().__init__() bar = qtwidgets.menubar() file_menu = bar.addmenu('file') file_edit = bar.addmenu('edit') error message: file "basicemail.py", line 84, in email_config self.ui = emailblast() file "basicemail.py", line 96, in __init__ self.menubar() attributeerror: 'emailblast' object has no attribute 'menubar' what missing here. updated project: class mainwindow(qtwidgets.qmainwindow): def __init__(self): super().__init__() self.email_blast_widget = emailblast() self.setcentralwidget(self.email_blast_widget) bar = self.menubar() file_file = bar.addmenu('file') file_edit = bar.addmenu('edit') class emailblast(qtwidgets.qwidget): def __init__(self)...

Passing PHP Session Value -

i'm attempting pass value 1 wordpress page through php session. have dropdown list on both pages, identical except option values. selected option on 2nd page @ page load reflect chosen value submitted on first page. i've looked lot of questions haven't been able find need. appreciated! page 1: <?php if(!isset($_session)) { session_start(); echo $_session['state']; $var_value = $_session['state']; } ?> <form> <input type=hidden name="returl" value="page2.php"> <select id="state" name="state"> <option>state 1</option> <option>state 2</option> <option>state 3</option> </select> <input type="submit" name="submit" value="submit"> </form> page 2: <?php session_start(); if(isset($_post['state'])){ $_sessi...

java - How to register a netbeans custom DataLoader -

hello have created custom multifileloader , wondering how register dataloaderpool when creating netbeans plugin. https://alvinalexander.com/java/jwarehouse/netbeans-src/java/src/org/netbeans/modules/java/javadataloader.java.shtml http://netbeans-org.1045718.n5.nabble.com/multifileloader-being-called-multiple-times-for-same-file-td3026758.html i don't know if there way @annotation or if have add netbeans layers.xml . according references found on web, there no annotation. correct way either: use manifest/services register (see dataloader faq ) use layer.xml (see intviewer plugin site ) the documentation doesn't give lot of details. hereunder more detailed explanation: manifest approach easy implements inefficient. dataloader methods called fileobject encountered netbeans. mean file on disk files in virtual filesystems layer filesystem. how to : create file in directory meta-inf/services in src directory of project called org.openide.loaders.d...

activerecord - Rails 5: STI With Has Many Through Association -

i have searched extensively solution situation, can't find anything. in application have person model only stores data people: class person < applicationrecord end then have trial model. trials can have many people using has-many-through association. additionally, in context of trial , person can defendant or plaintiff . achieve this, set models this: class trial < applicationrecord has_many :trial_people has_many :plaintiffs, class_name: 'plaintiff', through: :trial_people, source: :person has_many :defendants, class_name: 'defendant', through: :trial_people, source: :person end class trialperson < applicationrecord belongs_to :trial belongs_to :person end class plaintiff < person end class defendant < person end i using select2 jquery plugin add in defendants , plaintiffs each trial in view. obtaining ids in strong parameters: params.require(:trial).permit(:title, :description, :start_date, :plaintiff_ids => [], :...

Excel 2013 VB to re-calculate data entry value on exit from cell? -

i have spreadsheet, need manually enter values external sources. 3 of these cells, there decimal value: ex: 66.78, 28.5, 0.5171 i able enter digits (without decimal) and, on exiting cell, have vb code appropriate division each column (but without duplicating division if later edited...). that is: type in 6678, , cursor moves next cell, vb divides 100. type in 285, vb divides 1 10. next 1 divided 10000. brute force solution enter integers elsewhere, , have division formula want decimal values. but, similar code have 1 cell's text turn uppercase when leaving cell, expect there's way run code fragment on cell's numeric value - here's uppercase code: private sub worksheet_change(byval target range) if not (application.intersect(target, range("$d11:$d$110")) _ nothing) target if not .hasformula application.enableevents = false .value = ucase(.value) application.enableeven...

arrays - php array_reverse get last in loop -

so im trying reverse array , add last item on loop, when run code: $data = ($json['data']); foreach($data $item){ if(isset($item['metadata']) && $item['metadata']['id_suscripcion'] == $id_sus){ if ($item === end($data)) echo $item['id'].' last element!'; } } i results: array ( [ticketnumber] => 172252526529700541 [metadata] => array ( [id_suscripcion] => 0000000000004314 ) [id] => 193172252526529772 ) array ( [ticketnumber] => 172242526591400527 [metadata] => array ( [id_suscripcion] => 0000000000004314 ) [id] => 193172242526591380 ) array ( [ticketnumber] => 172232526775600149 [metadata] => array ( [id_suscripcion] => 0000000000004314 ) [id] => 193172232526775687 ) 193172232526775687 last element! now problem when ...

mysql left outer join returns all rows, ignores specified field value -

i have 2 tables in mysql database: cellphone table id phone_number verification_code table id verification_codes code_expires code_used i'm trying query specific id in cellphone table, , want row whether or not have valid verification code. here query select a.id, a.phone_number, b.verification_code, b.code_expires cellphone left outer join verification_codes b on (a.id = b.id , a.id = '12345' , b.code_expires > now() , b.code_used null) instead of getting id i'm looking for, huge recordset includes id numbers. can me format query correctly? conditions on first table in left join go in where clause. conditions in second go in on : select c.id, c.phone_number, vc.verification_code, vc.code_expires cellphone c left outer join verification_codes vc on c.id = vc.id , vc.code_expires > now() , vc.code_used null c.id = '12345'; -- single quotes unnecessary if id number the reason simple. left join keeps all r...

Google Maps Visualization API- ControlWrapper -

is there way give labels categoryfilter control? instead of dropdown 0 7 have dropdown "label 0" "label 7". see current code here http://ineedawebdeveloper.info/demos/map/ figured out. added column description (filtercolumnlabel: 'description'). geochart (displaymode - region) complain if have more 2 columns. around use view on chart restricted 2 columns , tooltip role. var mapchart = new google.visualization.chartwrapper({ charttype: 'geochart', containerid: 'regions_div', options: { displaymode: 'regions', colors: ['#996600', '#6600cc', '#cc3300', '#ff00ff', '#00ff00', '#ffff00', '#ff3300', '#ff0066'], tooltip: { ishtml: true } }, 'view': { 'columns': [1, 2, 3] } });

java - Why Hibernate doesn't return anything from the Native Query -

i have application based on hibernate 4.2 , spring boot 1.4. , have specific sql query can not model hql in performant way. log.debug("request current bids station : code {}, bidtype {}, versionnum {}", code, bidtype, grainproadminproperties.getprice().getcurrentversionnumber()); list<object[]> result = sessionfactory.getcurrentsession().createsqlquery( "select bid.*, tp.price tp_price, tp.price_nds tp_pricends " + "from bid, transportation_price tp, station_location lts, partner part, station stat " + "where " + " bid.is_active = true and" + " bid.archive_date null , " + " part.id = bid.elevator_id , " + " part.station_id = stat.id , " + " lts.region_id = stat.region_id , " + " lts.district_id = stat.district_id , " + " (stat.locality_id null or " + " lts.l...