Posts

c# - Return different model on partial view -

i'm having trouble returning viewbag list of model partialview, different type of model parentview, wish render result, inside partial view rendered on parent view. perhaps looking @ code, give better understanding. here controller: public actionresult search() { //viewbag.usuarios = db.user.tolist(); return view(); } [httpget] public actionresult pesquisar(userfilter userfilter) { list<usermodel> retorno = new list<usermodel>(); viewbag.mensagem = "não foi encontrado registro com os filtros informados"; if (userfilter.name != null) { retorno = db.user.where(x => x.name.contains(userfilter.name)).tolist(); if (retorno != null) { viewbag.usuarios = retorno; return partialview("search", viewbag.usuarios); } return view("search", viewbag.mensagem); } if (userfilter.userid != ...

Relative path in Xlwings Pythonpath -

is possible reference python code in parent folder of current folder this: pythonpath = "../../python_code" it won't work on computer. objective avoid hard coded paths. indeed, can set so: pythonpath = thisworkbook.path & "/.." you might need @ least v0.7.0 though.

python - Reordering numpy array -

i have following numpy array: arr = np.array([0.3, 3.5, 12.0, 2.9, 11.0, 23.0]) i want reorder array starts @ 4th position, followed items after start position in order, followed items before start position. i.e. [2.9, 11.0, 23.0, 0.3, 3.5, 12.0] how can without loop? try np.roll(arr, -3) negative since want "move" elements left

c++ - Interrupt arduino routine to run a slow delay based process -

i have arduino data collection , sends esp8266 on serial. serial communication esp not quick may know , depends on lot of waiting. have button , want stop data collection or sending , have open door. door opening takes 30 seconds. what's best way this? not full code, goes below. of course doesn't work because can't use while or delay in isr, don't know how restructure it. attachinterrupt(4 , openadoor, falling); void loop(){ gathersomedata(); senddatatoesp(); if(wait_for_esp_response(2000,"ok")) lightgreenled(); else lightredled(); } byte wait_for_esp_response(int timeout, const char* term) { unsigned long t = millis(); bool found = false; int = 0; int len = strlen(term); while (millis() < t + timeout) { if (serial2.available()) { buffer[i++] = serial2.read(); if (i >= len) { if (strncmp(buffer + - len, term, len) == 0) { found = true; break; } } } } buffe...

How to access elements of a pair set in C++ -

i have set. of form set<pair<string,int> > stockset want find if above set has entry given string first element. find value of 2nd part of pair, int given first element of pair string . i know how map , single element set. unable figure out how this, need syntax. you can't figure out because can't this. the elements in set "complete" elements. because see std::pair in there, , think set contains 2 elements, doesn't mean is. set contains std::pair , single, complete, element. if have std::pair , somewhere, can search set see if there's equivalent pair in there. if have half of object set contains, can't it. the options see here are: iterate on set manually, until or not find you're looking for. if there's minimum int value expect in there, can use lower_bound() , passing std::pair minimum value int portion, , string you're search for, , see lower_bound() digs up. perhaps reconsider decision use std::s...

c++ - Overloaded Operator not working properly? -

i getting error when compile program , unsure how fix appropriate function solve problem. post main, header, , cpp file below desired outcome following. help/tips appreciated, thank you! error get: error c2679 binary '+=': no operator found takes right-hand operand of type 'double' updated: have fixed code update "=" operator overload , working except 1 line of output. this output: a: no name: $0.00 b: saving: $10000.99 c: checking: $100.99 a: no name: $10101.98 b: saving: $10000.99 c: checking: $100.99 a: joint: $0.00 b: saving: $10000.99 c: checking: $100.99 a: saving: $10101.98 b: saving: $10101.98 c: checking: $100.99 a: saving: $10302.98 b: saving: $10302.98 c: checking: $201.00 for reason "joint" balance comes 0 , unsure why. should show $10101.98 the main: #include <iostream> #include "account.h" using namespace std; void displayabc(const account& a, const ac...

maven - Jenkins SSH Plugin - Execute different shell script commands depending on task (build/release) - environment variable -

using same jenkins job, there way configure jenkins ssh plugin execute different commands depending on: the task type: maven build/release an environment variable mvn clean install -denvironment=dev i worked out first option (the execution of different commands depending on build type - build vs release) we need following plugins : readonly parameter plugin : pass read parameter (environment=pro) when launching release. environment injector plugin : pass hidden parameter (environment=dev) when building. release plugin job configuration : execution environment -> configure release build override build parameters checked string parameter release_version string parameter development_version readonly string parameter environment - pro inject environment variables build process checked properties content environment=dev post steps: can access declared variable (environment) in shell script. for instance: if [ "$environment" = "dev...