Posts

Showing posts from January, 2015

javascript - How to update nested object in Ember -

i'm writing application using emberjs 2.4. have following service generates objects of objects of random data: export default ember.service.extend({ crits: {}, loadcrits() { var newcrits = {}; var max = math.random() * 10; for(var i=0; i<max; i++) { var crit = {}; var num = math.random() * 5; for(var j=0; j<num; j++) { crit["data"+j] = j; } newcrits["crit"+i] = crit; } this.set("crits", newcrits); } }); i have component displays data in table. each key-value pair of each nested object, have button user can change value: <table> {{#each-in critservice.crits |key crit|}} <tr> <td>key</td> <td><ul> {{#each-in crit |k v|}} <li> {{k}} = {{v}} <button {{action "modifycrit&quo

No primary server available when failover happens: MongoDB, Node.js, Mongoose -

i facing issue when failover happens in mongodb replica set. app fails reconnect newly elected primary server , fails perform subsequent write operations. restarting app reconnects successfully. the failover happens instantly , new primary elected. however, app fails connect new primary. mongodb version: 3.2.6 mongoose version: 4.3.4 node.js version:0.10.26 any appreciated. i have primary, secondary , arbiter set running in 3 different nodes. how connect using mongoose , failover works fine. mongoose.connect('mongodb://user:pwd@a.com:27017,b.com:27017,c.com:27017/dbname'); so, expect mongodb:// variables.

php - CodeIgniter : 3.0 database migration through composer -

Image
iam working on codeigniter database migrations. create table using migrate.php controller in project , it's work fine. question possible migrate database using cmd laravel database migrations?. yes. you can php index.php tools most frameworks have built-in command lines , users of these frameworks have interact command line. codeigniter has base command line interface it’s not implemented default . go through tutorial codeigniter migration - tutorials.kode-blog.com

AngularJS / Javascript: Find a string match in a nested object -

i have complex object (a user object) has nested arrays , nested objects within it. i have search filter relatively complicated (checkboxes determining items returned, along search input). currently search in object so: for(var key in item){ if(item[key] && item[key].length && string(item[key]).tolowercase().indexof($rootscope.filt.searchfilter.tolowercase()) !== -1){ realsave = true; } } however, works first layer of objects within item; need search objects within objects. how can this? simpler way above? (note, can't use ng-repeat="item in items | searchfilter" needs parse checkboxes , return values accordingly. try realsave = (json.stringify(item).indexof($rootscope.filt.searchfilter.tolowercase()) !== -1) (it's long line, scroll right) it transform whole object single string, can search sub-string you're looking anywhere inside it.

I can't insert data in a table weird error mysql -

Image
hello have table called 'comisiones' described follows: when try insert new element query: insert comisiones (id,serial,descripcion,fecha,precio) values (0,"111111111111111","iphone 5 instalacion de aplicaciones","09/06/2016",2000); i error: insert comisiones (id,serial,descripcion,fecha,precio) values (0,"111111111111111","iphone 5 instalacion de aplicaciones","09/06/2016",2000) error code: 1054. unknown column 'fecha' in 'field list' with show create table comisiones; this: create table `comisiones` ( `id` int(10) unsigned zerofill not null auto_increment, `serial` varchar(15) collate utf8_spanish_ci not null, `descripcion` varchar(45) collate utf8_spanish_ci not null, `fecha` varchar(10) collate utf8_spanish_ci not null, `precio` int(11) not null, primary key (`id`) ) engine=innodb auto_increment=3 default charset=utf8 collate=utf8_spanish_ci i answ

excel - User Open CSV Into Tab Using VBA -

i trying button when pressed prompts user open csv file , bunch of other things automatically performed on csv file. here code working with: sub mainmacro() dim fnameandpath variant fnameandpath = application.getopenfilename(filefilter:="excel files (*.csv), *.csv", title:="select file opened") if fnameandpath = false exit sub workbooks.open filename:=fnameandpath 'sheets.add after:=sheets(sheets.count) 'activesheet.name = fnameandpath call macro1 call macro2 call macro3 call macro4 end sub put opens csv file , want open in tab , marco1 marco2... can perform respective tasks. button perform of mainmacro() on newly active sheet user loaded in. this code open csv , copy worksheet original workbook will. on copying sheet destination workbook, copied sheet activate. sub mainmacro() dim csvwb workbook dim fnameandpath variant fnameandpath = application.getopenfilename(filefilter:="excel files (*.csv), *.csv", title:=

python - Website google oauth needed -

probably answered somewhere, google-fu can't proper keywords this. ok so, need file site foo.bar/foobar/file.ext . file accessible if aren't google-authenticated on site blank file. how can proper authentication python? sorry if isn't clear it's first time here... in advance help first install python sdk here . then start reading oauth here . they have different examples depending on use case. (e.g. if authenticating user browser, versus server server)

Spring boot When running embended tomcat always use a extrange port -

konnichiwa (hello). i following tutorial microservices in order combine erlang data generator, have created basic program spring-boot (java) everytime run application don't know why tomcat running in weird port number. http://callistaenterprise.se/blogg/teknik/2015/04/10/building-microservices-with-spring-cloud-and-netflix-oss-part-1/ maybe folks can helpme. arigatou! this not showing weird port, random port, maybe have configured in resources/application.properties or resources/application.yml file. server.port=0 or server: port: 0 so should replace 0 , because means (run server in random auto-generated port number) , replace port number want. regards.

Can I use Selenium methods together with Intern/Leadfoot methods? -

i use selenium methods intern/leadfoot methods. how can it? have after promise returned, right? following code? there other ways it? ... var webdriver = require('intern/dojo/node!selenium-webdriver'); ... .findbyxpath('//button[@class="btn btn-success"]') .click() .end() .sleep(1000) .then(function (text) { webdriver.switchto().alert().accept(); }); } these 2 libraries not compatible. each has own internal state updated commands executed, , changes made using 1 confuse other (assuming both able implicitly communicate same remote browser). at least specific case in posted example, leadfoot have acceptalert method equivalent of web driver.switchto().alert().accept() .

watchkit - WKInterfacePicker -- change textColor -

is there easy solution change text color of picker on watchos? maybe easy routine images representing text? unfortunately, can't change colour of text in wkinterfacepicker . maybe, can find solution : how add text image in ios swift

plot a dirac function which is in symbolic - MATLAB -

this question has answer here: deriving dirac delta function using matlab symbolic toolbox 2 answers i using code: syms x ezplot(dirac(x-2)) the function 0 , 1 @ x=2. drawn figure 0 everywhere. how draw correctly? in case value limited being symbolic variable can first change double format, rest in similar way. see syms x x=2; s= double(x); s=2; smin=s-15; smax=s+15; p=smin:0.01:smax; q = double(p == 2); plot(p, q); and having +-15 creating range around dirac function input.

python - Is there an easier way to change the index values of a pandas dataframe? -

i taking dataframe, breaking 2 dataframes, , need change index values no number greater total number of rows. here's code: dataset = pd.read_csv("dataset.csv",usecols['row_id','x','y','time'],index_col=0) splitvalue = math.floor((0.9)*786239) train = dataset[dataset.time < splitvalue] test = dataset[dataset.time >= splitvalue] here's change doing. wondering if there easier way: test.index=range(test.shape[0]) test.index.rename('row_id',inplace=true) is there better way this? try: test = test.reset_index(drop=true).rename_axis('row_id')

spring boot - PropertiesLauncher ignores -Dloader.path= -

i using spring-boot 1.3.5/os x/java 8. the situation follows: need pass launcher class folder trigger devtools restarts. folder not known until execution. i passing -dloader.path=/users/..../class_folder. when try create xml application context fnotf exception. "beans.xml" there. i have tried -dloader.path=file:/users... , -dloader.path=file://users... i thinking modifying launcher source use 1 of command line args last classpath entry. but seems little bit overboard if functionality there. any thoughts? thanks lot! i'm not sure configured correct or not. reference spring boot might helpful. # ---------------------------------------- # devtools properties # ---------------------------------------- # devtools (devtoolsproperties) spring.devtools.livereload.enabled=true # enable livereload.com compatible server. spring.devtools.livereload.port=35729 # server port. spring.devtools.restart.additional-exclude= # additional patterns should excluded

sql - How should I join to achieve this -

Image
i in kind of situation don't know go. have write query such kind of hierarchical. i explain example- table a here have 3 columns this country state city india punjab amristar india punjab ludhiana india tamil nadu chennai india tamil nadu salem india west bengal kolkata india west bengal darjeeling india maharastra mumbai india maharastra nagpur table b here have 4 columns this country state city number india punjab amristar 3 india punjab null 5 india tamil nadu chennai 2 india tamil nadu null 4 india null null 6 now have join these 2 tables on hierarchical level - if 2 country matches, states matches , city matches number assigned them if 2 country matches, s

bdd - How to call a scenario several times without tableized items in a behave test? -

i 'd call scenario -let's 500 times- in gherkin test without tableized items. reason 'd use randomized variables instead of written myself. know how implement random functionality tests called once. for example : scenario outline: want test speed different values when set speed <speed> , wait 5 seconds plays @ <speed> examples: | speed | | 10 | | 20 | | 30 | | 40 | | 50 | import random speeds = ['10', '20', '30', '40', '50'] def next_speed(): return random.choice(speeds) if use random functionality this, how can call scenario 500 times? thanks in advance. if try use gherkin scripting tool, you're gonna have bad time. there better tools that, python or robot framework. ask advantage expect gherkin test. gherkin should answer 'why' doing something, should have examples explain sufficiently different cases - , preferably intere

lua - LSTM on top of CNN -

i have following lstm model implementation in torch, took here: https://github.com/wojzaremba/lstm/blob/master/main.lua i have question following piece of code: local function create_network() local x = nn.identity()() local y = nn.identity()() local prev_s = nn.identity()() local = {[0] = lookuptable(params.vocab_size, params.rnn_size)(x)} local next_s = {} local split = {prev_s:split(2 * params.layers)} layer_idx = 1, params.layers local prev_c = split[2 * layer_idx - 1] local prev_h = split[2 * layer_idx] local dropped = nn.dropout(params.dropout)(i[layer_idx - 1]) local next_c, next_h = lstm(dropped, prev_c, prev_h) table.insert(next_s, next_c) table.insert(next_s, next_h) i[layer_idx] = next_h end local h2y = nn.linear(params.rnn_size, params.vocab_size) local droppe

java - Eclipse Windows 10 permission denied on http requests -

an existing instance of eclipse has developed issues when attempting make connections on http. i'm using eclipse ide java ee developers version 4.5.2... i running eclipse in administrator. i able make service service calls locally without issue. upon attempting communicate on http following error : java.net.socketexception: permission denied: connect @ java.net.twostacksplainsocketimpl.socketconnect(native method) @ java.net.abstractplainsocketimpl.doconnect(abstractplainsocketimpl.java:350) @ java.net.abstractplainsocketimpl.connecttoaddress(abstractplainsocketimpl.java:206) @ java.net.abstractplainsocketimpl.connect(abstractplainsocketimpl.java:188) @ java.net.plainsocketimpl.connect(plainsocketimpl.java:172) @ java.net.sockssocketimpl.connect(sockssocketimpl.java:392) @ java.net.socket.connect(socket.java:589) @ sun.net.networkclient.doconnect(networkclient.java:175) @ sun.net.www.http.httpclient.openserver(httpclient.java:432) @ sun.net.www.http.httpclient.opense

c# - wix: How to prevent user from restarting machine during the installation or upgrading of application -

there possibility machine shutdown/reboot/logoff when update\installation happening might corrupt install. if have rollback option in place scheduling removeexistingproducts afterinstallinitialize, resume installation\update after machine restarts? if there way in wix such can prevent user restarting , logging off during installation\upgrade? how can make wix installer resumes remaining work after restart or after abrupt shutdown (via hardware)? update we have desktop application deployed our clients. there provision our client auto upgrade latest version. our application download latest version of msi , run msiexex.exe command in silent @ background user not have anything. things done silent @ background. working perfectly. now, of our client complains had v2.1 earlier has gone now. thinking following possible cases: during upgrade, latest version of msi downloaded , invoked using command msiexec.exe @ background application itself. uninstallation of installed (existi

javascript - step jQuery and backgroundposition -

i new comer in jquery. there explain me in detail following code means? $.extend($.fx.step, { backgroundposition: function(fx) { // can } as described in jquery docs code add/merge/update function $.fx.step called backgroundposition

c++ - Is there any performance reduction for simple if? -

for example, have class class point { public: float operator[](int i) const { if (i == 0) return m_x; // simple ifs, performance reduction?? if (i == 1) return m_y; return m_z; } private: float m_x; float m_y; float m_z; }; is there performance reduction compare access element of std::array<float, 3> ? if so, how can remove it. want use fields x, y, z other array. is there performance reduction? i assume mean, "compared doing array lookup". if so, answer (potentially) yes -- branching operation can potentially cause pipeline stall (if cpu mispredicts branch taken), make things slower. cpu branch prediction pretty these days, might not issue in real life--it depend lot on usage patterns of program calling code. if so, how can remove it. want use fields x, y, z other array. you can remove ifs using three-item array instead of 3 separate items. if don't accessing items array, can add ac

javascript - MVC immediate validation is not triggering? -

i have form in mvc 5. have 3 drop-downs on form required. when submit form, error message appears. problem that, when select value drop-down, error messages still show. , if submit button, required error message disappears. the main problem immediate validation not working. scenario occurs when first submit form without selection , select drop down value. error still show. here form. @using (html.beginform()) { @html.antiforgerytoken() @html.hiddenfor(model => model.processid) <div class="row"> <div class="col-sm-6"> @html.validationsummary(true, "", new { @class = "text-danger" }) </div> </div> <div class="row"> <div class="col-sm-12 bgnmrgn"> <div class="col-sm-12"> <h3>@resources.basicinformtion</h3> </div> <div class="form-group col-sm-2"> <label clas

How to add external header files during bazel/tensorflow build -

i trying add external header file (like opencl header file) experimentation tensorflow. tried add build file under tensorflow/core/build file: # includes implementations of kernels built tensorflow. cc_library( name = "all_kernels", visibility = ["//visibility:public"], copts = tf_copts() + ["-ithird_party/include"], <==== line added i have created softlink in directory location of these header files opencl driver (under tensorflow/third_party) (like ln -s /opt/opencl/ ) still complains has not found header file. if add external header file directly (like /opt/opencl/cl/) complains external files cannot included (or such thing). i not have root password copy these header files /usr/include/ too. can explain how external header files tensorflow building? thanks quick help. i've faced similar problem when built tensorflow intel mkl , had add mkl headers. solution following: create symlink headers third_party

javascript - Accessing a variable obtained by user from separate file in JS -

a beginner question: i'd create app obtain imaginary number user , plot complex plane. since i'm hoping add other things later, keep code in separate files, connected in html file. in first file, real , complex part user: $(document).ready(function() { $("#button-number").click(function() { var realpart = prompt("please, enter real part of number:") var imagpart = prompt("please, enter imaginary part of number:") });}) which use in second file: $(document).ready(function() { var c = document.getelementbyid("complexplane"); var number = c.getcontext("2d"); number.beginpath(); number.arc(500+50*realpart,300-50*imagpart,10,0,2*math.pi); number.stroke(); number.fill();}) however, doesn't work. works if define variables manually outside function. i'm not entirely sure how operations timed, since variables aren't defined when document loads. i'd love know how solve issue. this works exp

javascript - How to integrate datetimepicker with ASP.NET localisation -

i'm using trent richardson's datetimepicker extension jquery, obtained via nuget: http://trentrichardson.com/examples/timepicker/ trent's documentation says can create localised datetimepicker this: $('#basic_example_4').timepicker( $.timepicker.regional['es'] ); i'm attaching datetimepicker asp.net textbox setting cssclass property on textbox, , having javascript attach datetimepicker selecting on css class: <script type="text/javascript"> $(document).ready(function () { $('.calendarstartdatetime').datetimepicker({ dateformat: 'yy-mm-dd', timeformat: 'hh:mm tt', controltype: 'select', oneline: true }); }); </script> ... <asp:textbox id="startdatetime" runat="server" cssclass="calendarstartdatetime" meta:resourcekey="startdatetimeresource1"></asp:textbox> my asp

python - NumPy IFFT introducing black bars in OaA Convolution Algorithm -

Image
i'm having trouble diagnosing , fixing error. i'm trying write oaa algorithm, described in paper . #!/usr/bin/env python # -*- coding: utf-8 -*- """ quick implementation of several convolution algorithms compare times """ import numpy np import _kernel tqdm import trange, tqdm pil import image scipy.misc import imsave time import time, sleep class convolve(object): """ contains methods convolve 2 images """ def __init__(self, image_array, kernel, back_same_size=true): self.array = image_array self.kernel = kernel # store these values accessed _lot_ self.__rangex_ = self.array.shape[0] self.__rangey_ = self.array.shape[1] self.__rangekx_ = self.kernel.shape[0] self.__rangeky_ = self.kernel.shape[1] # ensure kernel suitable convolve image if (self.__rangekx_ >= self.__rangex_ or \ self.__rangeky_ >= self.__range

Azure vs On-premise Service Fabric -

i have bit of trouble finding differences azure , on-premise service fabric versions. did read somewhere on-premise version not support auto-scaling, easy understand. however, on-premise version offer type of operational capabilities such resource managers, visual management of cluster, etc.? the core service fabric platform runtime gets installed on set of virtual or physical machines. once tell machines how find each other, form cluster , provide set of management capabilities includes service fabric explorer ui, rest api, , tcp endpoint powershell. of common whether you're running on azure, on-premises, or in public cloud. what's different in environments lives outside of machines form cluster. includes: autoscaling while service fabric can handle new machines being added , removed cluster, has no knowledge of how process works, external agent needs handle it. in azure, that's virtual machine scale set. failure domain/upgrade domain management

sql - Dynamic "column" update in mysql with respect to parameter of procedure -

i want update column of table t1 in procedure called my_proc(param) . want this: if param=1 update t1 set c1="some value" if param=2 update t1 set c2="some value" if param=3 update t1 set c3="some value" ... cnn suggest, should appropriate approach? your code right. correct syntax is: if param = 1 update t1 set c1 = 'some value'; elseif param = 2 update t1 set c2 = 'some value'; elseif param = 3 update t1 set c3 = 'some value' end if; if like, write 1 update : update t1 set c1 = (case when param = 1 'some value' else c1 end), c2 = (case when param = 2 'some value' else c2 end), c3 = (case when param = 3 'some value' else c3 end);

c# - Model is of different type than specified in using Statement MVC View -

Image
i have renamed class mvcpatientlaboratoryresultsofinterestviewmodel mvcpatientbloodresultsviewmodel . the problem follow, can seen in image. type of model in razor view, not correspond type declared in using statement. i following error: the type or namespace name 'mvcpatientlaboratoryresultsofinterestviewmodel' not exist in namespace 'edr.presentation.webmain.viewmodels' (are missing assembly reference?) i have cleaned solution, , tried rebuild, no success. why happening? just try reopen vs studio

asp.net mvc - how to return to filled out form from other view in mvc -

i not experienced in programming, apologize in advance if obvious question. i have form in user types in information. validated in httppost sent page contact information shown user can check, if in order. if not there button going previous form correct this. problem: works perfect, except going correction. how can go filled out form? below code far: index-controller: public actionresult defaultform(questionviewmodel viewmodel) { //method wrote populating dropdown dropdownpopulate(viewmodel); return view(viewmodel); } [httppost] public actionresult defaultform(questionviewmodel viewmodel, string tbbutton) { if (modelstate.isvalid) { try { if (tbbutton.equals("questsend")) { return view("verify", viewmodel); } else if (tbbutton.equals("questupload

syntax - continue statement confusing in powershell, looks like break statement -

my code looks like: 1..10 | % { $i=$_ 10..20 | % { if ($_ -gt 12) { continue } write-host $i $_ } } why output is: 1 10 1 11 1 12 it seems continue statement in poweshell not different other language, why powershell designed this? if change continue return , expect result. as peterserai pointed out in comment , don't use loop in code, instead using foreach-object cmdlet different . just use foreach loop instead: foreach($obj in 1.. 10) { $i = $obj foreach($obj2 in 10 ..20) { if ($obj2 -gt 12) { continue } write-host $obj $obj2 } }

python - How to parse tuples that has no delimiters? -

i'm using pyparser , want parse files contain tree structure values stored after equals sign no actual delimiters otherwise. i've done parsing except rare cases when data stored in multiple lines, have rewrite parser not stop grabbing value equals sign end of line equals sign equals sign (or end ) ignoring word preceeds (or ignoring end ). example of data: ( itemname = foo someotherstuff = bar foo1 foo2 astring1 = itemname someotherstuff ) code: equals = suppress("=") token = word(alphanums + "-,./_:*+=#[];") decimal = regex(r'-?0|[1-9]\d*').setparseaction(lambda t:int(t[0])) stringtemplate = token | decimal sexplist = group(suppress("(") + zeroormore(sexp) + suppress(")")) sexp = forward() this doesn't work obviously astring = group(stringtemplate + equals + stringtemplate) so i've tried these: multilinestring = group(token + equals + oneormore(stringtemplate) + ~followedby(stringte

nsmutablearray - Store user input in array objective-c -

i trying input user , want store in array. int main(int argc, const char * argv[]) { @autoreleasepool { int i; char name[10]; nsmutablearray *myarray=[[nsmutablearray alloc]init]; (i=0; i<10; i++) { scanf("%c",name); [myarray addobject:i]; } } return 0; } you trying insert non object in nsmutablearray. nsmutablearray can store objects only, char , int data types of c language not treated objects in objective c. first need convert them objects can insert. try this: [myarray addobject:@(i)]; or [myarray addobject:[nsnumber numberwithint:i]]; name: [nsstring stringwithformat:@"%c",name]

android - addOnScrollListener, pass base and limit -

i learning how use onscrolllistner the recyclerokhttphandler class execute select base 0 , limit 5 server. want execute again recyclerokhttphandler new data , examle base 5 limit 10. when adding below on onscrolllistner handler.execute().get(); i got error : cannot execute task: task has been executed (a task can executed once) ok understand cannot execute again task , how should passe base , limit ? this (it working) execute class images server, need pass base 0 , limit 5 final recyclerokhttphandler handler = new recyclerokhttphandler( this, new recyclerokhttphandler.myinterface() { @override public void mymethod(arraylist result) { madapter_first = new myadapter(result,searchactivity.this); madapter_first.notifydatasetchanged(); mrecyclerview_first.setadapter(madapter_first); } },"girls",base,limit); try { handler.execute().get(); } catch (exception e) { l

javascript - how to read & write external xml file in apache cordova? -

i creating android app. want use xml file store little amount of data short period of time.. able read xml using ajax.get() method file not able write xml.. please me so.. if want store little amount of data , using cordova, use , set local storage: localstorage.setitem("lastname", "smith"); and var agentsmith=localstorage.getitem("lastname"); as w3school says: with local storage, web applications can store data locally within user's browser. but if want use xml, do: var v = new xmlwriter(); v.writestartdocument(true); v.writeelementstring('test','hello '); v.writeattributestring('foo','bar'); v.writeenddocument(); console.log( v.flush() ); and obtain: <?xml version="1.0" encoding="iso-8859-1" standalone="true" ?> <test foo="bar">hello world</test> like here create , modify xml file using javascript

How to optimise ram memory consumption by javascript web application -

i have javascript web application abnormally consumes more 4gb of ram memory, when launch application memory consumption 700 800mb while doing action on application time longer ram memory consumption spike up. root cause of , how make application consume 400 500mb of ram. it's impossible answer question, it's broad , don't know code (and won't read obvious reasons). think should read article on javascript optimisation on google chrome développer website. you should analyse functions use memory , pin point problem find possible memory leak and/or optimise code. https://developers.google.com/speed/articles/optimizing-javascript optimizing javascript code authors: gregory baker, software engineer on gmail & erik arvidsson, software engineer on google chrome recommended experience: working knowledge of javascript client-side scripting can make application dynamic , active, browser's interpretation of code can introduce i

python - Recall a function every x milliseconds on Tkinter (Pygame's set_timer equivalent) -

i developping little application plotting network graph, showing " how fast ping is ". here related code review post. basically, have thread managing canvas. thread targets following method (simplified): def update(self): # draw vertical line on right of canvas self.draw_line(tag="spike") # move lines -1 px , delete lines outside canvas # can long. lines = list(self.canvas.find_withtag("spike")) while len(lines) > self.width: self.canvas.delete(lines.pop(0)) l in lines: x0, y0, x1, y1 = self.canvas.coords(l) self.canvas.coords(l, x0 - 1, y0, x1 - 1, y1) # recall in 10ms if self.alive: self.root.after(10, self.update) so might think, function bit slow on large canvas (for example 800x600). because uses recall method after computation, have recall time of computation_time + 10 ms. have recall time of exactly 10ms . as saw on a post pygame method pygame.time.set_timer() k

uml - How to make Sequence Diagram for Update Inventory -

Image
i'm preparing sequence diagram project. made following sequence diagram retailer updating inventory it's confusing me because first time use technique real project.i have used database object here , don't know whether right or wrong. , thing need clarify using updating meant both editing/add new item inventory. wrong way? or else can draw separately? the following image part of updating process, 1 take , correct me if did mistake.(updateui- user interface).thanks in advance. it not right. there couple of issues: your database never issue messages actions inside db not exposed. call crud outside db. you mix synch/asynch (likely unwillingly). filled arrows synch, unfilled ones asynch. main page v in mvc , updateui c. controller act on click user , interact db. so guts here more reasonable sketch:

c# - What's the best strategy for having multiple captcha image at the same time? -

let me explain problem giving example: imagine creating blog application in users can leave comments, need ensure if user human or not. keep in mind due limitations, can't use google recaptcha, have create own captcha code. so far there no problem since there bunch of samples on internet , of them use sessions keep last created code , of them use encrypted key, in url or hidden input in forms. firstly, if use sessions i'm not able display several blog posts contain unique captcha code can validate them after user submission because keep last generated random code. secondly, if use encrypted key , reveal in output html or in query string easy robots use generated key several times unless store these keys after submission. if choose use disposable keys have search database every time prevent generating duplicated random code. the question what's best approach let users open several posts , leave comment each 1 less code , i/o complexity.

asp.net - Trouble using response.redirect -

hi , sorry poor english. i have asp.net + vb.net application , here example of code illustrating problem : first have default.aspx page 2 buttons, "valid" , "redirect" protected sub butvalid_click(sender object, e eventargs) handles butvalid.click if (file.exists(server.mappath("log.txt"))) dim lines() string = io.file.readalllines(server.mappath("log.txt")) dim tmp integer = convert.toint32(lines(lines.length - 1)) tmp = tmp + 1 file.appendalltext(server.mappath("log.txt"), environment.newline & tmp.tostring) else file.writealltext(server.mappath("log.txt"), "1") end if end sub protected sub redirect_click(sender object, e eventargs) handles redirect.click response.redirect("accueil.aspx") end sub valid button write txt file , redirect redirecting ... here page_load code of accueil.aspx : threading.thread.sleep(3000) response

iOS 9 Swift Segue from TextField -

i trying start uiactivityindicator user clicks "enter" on uitextfield. since once hit enter app fetches information stored in web, user know app working. the web fetch happens inside shouldperformseguewithidentifier function, given based on results segue or not happen. so, order of methods called starting when user clicks on return key. want start uiactivityindicator @ exact moment. tried "textfielddidendediting , textfieldshouldreturn" both of them happen after prepareforsegue , shouldperformseguewithidentifier. thanks lot in advance. why not call code in textfieldshouldreturn itself? func textfieldshouldreturn(textfield: uitextfield) -> bool { activityindicator.startanimating() //do web stuff if shouldperformsegue == true { self.performseguewithidentifier("some identifier", sender: self) } return true }

c# - .Net Core Test Project keeps on losing System references -

i have created simple .net core mvc webservice. when run it works fine. i added in test project , couple of tests, , worked ok. this morning refactored webservice dao code using moved seperate assembly. did started http500 errors, , test project no longer run. system.io.filenotfoundexception: not load file or assembly 'system.runtime, version=4.1.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a' or 1 of dependencies. system cannot find file specified. a quick google didn't turn up, deleted references dao assembly project , copied code original project. original project works, still getting binding errors in test project. fusion shows error; test method testservice_tests.controllertests.testgetenquiries threw exception: system.io.filenotfoundexception: not load file or assembly 'system.runtime, version=4.1.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a' or 1 of dependencies. system cannot find file specified.assembly manager loade

c# - How to determine the user role that received from database if admin or not -

i want to take user name , password database , user role according inserted user name , password code not work public bool login(out string msg) { bool b = true; msg = ""; sqlconnection con = new sqlconnection(connection.connectstr); try { con.open(); sqlcommand com = new sqlcommand("user_proc", con); com.commandtype = commandtype.storedprocedure; com.parameters.add("@u_name", sqldbtype.nvarchar).value = this.u_name; com.parameters.add("@u_password", sqldbtype.nvarchar).value = this.u_password; com.executenonquery(); con.close(); b = true; } catch (exception ex) { con.close(); msg = ex.message; b = false; } return b; } and c# code should check role database , redirect me server page if admin , client page if not:-

c++ - How to create a wrapper on printf? -

this question has answer here: call printf using va_list 4 answers i want write conditional printf, this class conditionalprintf { public: conditionalprintf(bool print) : print_(print) {} void printf(int x, double y, char b, const char* format, ...) const { // use x, y , b va_list argptr; va_start(argptr, format); if (print_) printf(format, argptr); va_end(argptr); } private: bool print_; }; but prints garbage. there wrong? may implicit parameter change things? also, if isn't idea whatsoever, other solutions there? don't want write if (print) printf(...) billion times. vprintf forwards arg list printf #include <stdio.h> #include <stdarg.h> class conditionalprintf { public: conditionalprintf(bool print) : print_(print) {} voi