Posts

Showing posts from April, 2013

codenameone - Codename One add icon to title -

i trying add icon title/ title bar. changing title code works fine : settitle("testing"); yet can't figure out way add icon it. here have tried, no avail: image img = image.createimage("/kalender.png"); gettitlecomponent().seticon(img); fontimage icon = fontimage.creatematerial(fontimage.material_search, "titlecommand", 3); gettitlecomponent().seticon(icon); any appreciated. settitlecomponent solve in below fontimage icon = fontimage.creatematerial(fontimage.material_search, "titlecommand", 3); label title = new label(icon); **settitlecomponent(title);** [edit] **gettoolbar().settitlecomponent(titles);**

android - Listview - has focus always return false -

i have edit text in list view. listview created using base adapter , used holders load edit text. when cal holder.edttext.hasfocus(), return false. missing in listview properties? public view getview(final int position, view convertview, final viewgroup parent) {
 
 if (convertview == null) {
 layoutinflater inflater = layoutinflater.from(getcontext());
 convertview = inflater.inflate(r.layout.screen, parent, false);
 holder = new adapter.viewholder(convertview);
 convertview.settag(holder);
 } else {
 holder = (adapter.viewholder) convertview.gettag();
 }
 
 
 holder.edt.setcursorvisible(holder.edt.hasfocus());
 holder.edt.setenabled(true);
 
 holder.edt.s

WSO2 AM - Unable to load UserStoreCountRetriever implementation -

i have created userstoremanager implementation loads correctly via component class. however, need userstorecountretriever implementation allow user store work correctly. have extended jdbcuserstorecountretriever , added class name count implementation advanced property. have registered service in component. when user search following message: "error while listing users. error : exception occurred while trying invoke service method countusers". on console, following stack trace: ...caused by: java.lang.nullpointerexception @ org.wso2.carbon.identity.user.store.count.util.userstorecountutils.getcounterinstancefordomain(userstorecountutils.java:136) it looks can't find, or can't load class required implement count. class in same jar file user store.

python - Split Multilevel dataframe into different csv files -

suppose have following dataframe : x y ---+---+---+--- | b | | b --+---+---+---+--- 0 | 1 | 2 | 3 | 4 1 | 5 | 6 | 7 | 8 2 | 9 | 10| 11| 12 i want split based on multilevel index recursively , save them in csv file. for example file name x_a.csv should contain following dataframe: x --- --+--- 0 | 1 1 | 5 2 | 9 similarly file x_b.csv should store dataframe : x --- b --+--- 0 | 2 1 | 6 2 | 10 and on y_a , y_b. i looking pythonic ( or efficient) way rather iterating on column values separately code quite large. tried using techniques mentioned here dropping column levels , storing individual columns want in such way don't have explicitly mention column names since dataframe may expand ( i.e. @ top level there might 4 columns w, x, y , z). list_of_df = [df[i].to_frame() in df.columns] with @johngalt's suggestion csv: _ = [df[i].to_frame().to_csv('{0}_{1}'.format(*i)) in df.columns] output:

reactjs - How to prevent row selection after clicking on link inside custom rendered cell in AgGrid -

i using aggrid , have rowselection="multiple" on grid, have {cellrendererframework: printcell} on last column, small component displays link. i want so, when click on link inside printcell , action should executed, without altering the state of grid itself, , keep current selected lines selected without making row containing link selected. tried doing event.stoppropagation , event.preventdefault prevent parent row getting selected, no avail. any idea how achieve ? thanks since row click specified behaviour might easier perhaps use checkbox selection , disable focus row selection entirely. if want keep path generated required behaviour intercepting event in cell focus , blocking row selection there. private oncellfocused($event) { if($event.column && $event.column.colid == "commentid"){ this.gridoptions.suppressrowclickselection = true; } else { this.gridoptions.suppressrowclickselection = false; } this swi

api - How do I deal with certificates using cURL while trying to access an HTTPS url? -

i getting following error using curl: curl: (77) error setting certificate verify locations: cafile: /etc/ssl/certs/ca-certificates.crt capath: none how set certificate verify locations? thanks. this error related missing package : ca-certificates . install it. in ubuntu linux (and similar distro): # apt-get install ca-certificates in cygwin via apt-cyg # apt-cyg install ca-certificates in arch linux (raspberry pi) # pacman -s ca-certificates the documentation tells: this package includes pem files of ca certificates allow ssl-based applications check authenticity of ssl connections. as seen at: debian -- details of package ca-certificates in squeeze

javascript - function as argument on evaluate method on google puppeteer -

i want run function inside evaluate(), i'm passing argument, i'm getting 'func not function' , missing? puppeteer version: 10.2 platform / os version: windows 10, node 8.2.1 var func = function() { console.log("xxxxx"); }; var response = await page.evaluate( (func) => { func(); //func not function }, func); if understand correctly, puppeteer has marshal code in evaluate function string , inject page context. can't pass function references or non-serializable across boundary.

c++ - Ordering an array of strings while avoiding duplicates -

so have: string array1[5] = {"a", "b", "c", "d", "f"}; string array2[5] = {"a", "c", "g", "f", "d"}; string result[100]; i'm trying make string result[100] compose of non-duplicates array1 , array2 while being in sequential order of array1[0] array2[0] array1[1] array2[1] etc. (e.g.) string result[100] = {"a", "b", "c", "g", "d", "f"}; this code have far: for (i=0; < 5; i++) { result[i] = array2[i]; } (i=0; i<5; i++) { (j=0; j<100; j++) { if (result[j] == "") { result[j] = array1[i]; break; } if (result[j] == array1[i]) break; } } this code avoids duplicates, not in correct order want. can't wrap head around solving this. appreciated. fully working, wrote. #include <iostream> #include <string> #include

theorem proving - Difficulty applying a proof in Idris -

i attempting prove property on 1 of defined data types follows: reverseproof' : (inputblock : block itype isize iinputs) -> (ind : fin rsize) -> (rinputs : vect rsize ty) -> (receiveblock : block rtype rsize rinputs) -> (prf : index ind rinputs = itype) -> (newinsert : maybeblockty itype) -> (hvect (replaceat ind (maybeblockty itype) (map maybeblockty rinputs))) -> (hvect (map maybeblockty rinputs)) in attempting prove trying use earlier proved fact that: replaceatproof' : (xs : vect n a) -> (i : fin n) -> (f : -> b) -> ((index xs) = x) -> (replaceat (f x) (map f xs)) = (map f xs) i hoping attempting rewrite appropriate expression in reverseatproof' achieve this, when attempting rewrite follows: reverseproof' inputblock ind rinputs receiveblock prf newinsert x = rewrite replaceatproof' rinputs ind

unit testing - Easymock Unexpected method call error when EasyMock.expect() is specified -

i kept running following error: org.apache.kafka.connect.runtime.distributed.distributedherdertest > testcreateconnector failed java.lang.assertionerror: unexpected method call worker.getconnectortype("sourceb"): worker.getplugins(): expected: 3, actual: 0 @ org.easymock.internal.mockinvocationhandler.invoke(mockinvocationhandler.java:44) @ org.easymock.internal.objectmethodsfilter.invoke(objectmethodsfilter.java:94) @ org.easymock.internal.classproxyfactory$mockmethodinterceptor.intercept(classproxyfactory.java:97) @ org.apache.kafka.connect.runtime.worker$$enhancerbycglib$$124447d.getconnectortype(<generated>) @ org.apache.kafka.connect.runtime.distributed.distributedherdertest.testcreateconnector(distributedherdertest.java:344) even though put in: easymock.expect(worker.getconnectortype(conn2)).andreturn(connectortype.source); code can found here: https://github.com/apache/kafka/pull/3812 advice welcome. you nee

xaml - Can I change the Canvas.Zindex of an object using visual states? -

how change canvas.zindex of object using visual states? expecting able this.. <visualstate x:name="myvisualstate"> <visualstate.setters> <setter target="myobject.visibility" value="visible" /> <setter target="myobject.background" value="transparent" /> <setter target="myobject.canvas.zindex" value="12" /> </visualstate.setters> </visualstate> but not work. have not been able find examples on how this. can help? here go. note need () there because canvas.zindex attached property , that's how define value of in xaml. <visualstate x:name="myvisualstate"> <visualstate.setters> <setter target="myobject.visibility" value="visible" /> <setter target="myo

javascript - Angular Reactive Forms: Dynamic Select dropdown value not binding -

i have 2 arrays of data: associatedprincipals (previously saved data) , referenceprincipals (static data populate in dropdown controls). i'm struggling previous value associatedprincipals displayed/selected in dynamic amount (most examples use single dropdown) of dropdowns on page load. i'm not how set form (code behind , html), setting select's formcontrolname. currently, static values in each dropdown populate, cannot selected value bind properly. public ngoninit() { this.factsform = this.formbuilder.group({ associatedprincipals: this.formbuilder.array([]), referenceprincipals: this.formbuilder.array([]) }); // data both of these methods comes external source... var responsedata = // http source... // push retrieved data form this.initprincipals(responsedata[0]); // push static data form this.initstaticdata(responsedata[1]); } public initprincipals(principals?: iassociatedprincipal[]): formarray { principals

windows 10 powershell list all installed features, updates, programs, and hotfixes applied to a system; in order of date applied -

in windows 10, using power-shell how list installed features, updates, programs, , hotfixes applied system; in order of date applied. i see get-hotfix updates , security updates, not .net framework features or programs. thanks in advance. using query below have installed date first , name version , vendor. $installedproducts = get-wmiobject win32_product | select installdate, name,version, vendor | sort-object installdate -descending the install date described here: https://msdn.microsoft.com/en-us/library/aa394378(v=vs.85).aspx and format of data described here: https://msdn.microsoft.com/en-us/library/aa387237(v=vs.85).aspx

Add a colon after a variable when inputed a value (Python 3.6) -

this first time coding in python. when calling inputed value within string, how add colon after variable? have far. name1 = input('enter name of friend: ') bill1 = float(input('enter bill '+ name1)) for example want able have result example python 3.6 introduces literal string interpolation: f'enter bill {name1}: ' for older versions use either format or % : 'enter bill {}: '.format(name1) 'enter bill %s: ' % name1 and string concatenation: 'enter bill ' + name1 + ': '

javascript - framework 7 on click event work at <div class=“toolbar-inner”> </div> but not outside -

Image
html code <div class="toolbar toolbar-bottom" id=""> <div class="myprogress2" id="myprogress2" style="background-color: grey; width:100px;margin-left: 10px"> <div id="mybar2" class="mybar2" style="width: 3%;height: 10px;background-color:white;"></div> </div> <div class="toolbar-inner"> <div class="myprogress2" id="myprogress2" style="background-color: grey; width:100px;margin-left: 10px"> <div id="mybar2" class="mybar2" style="width: 3%;height: 10px;background-color:white;"></div> </div> </div> look @ above code image. use same code @ top div onclick not working , bellow div onclick working js (framework 7) code $$('.myprogress2').on('click', function (e) { myapp.alert('tab'); }); i try jquery function norm

sql server - c# Log SQL Actions for Restore and Backup of DB -

is there way write sql actions log file when doing restore or backup of db in c#? code have restore example. restore restore = new restore { database = databasename, action = restoreactiontype.database, replacedatabase = true }; restore.devices.adddevice(mydbbackup, devicetype.file); restore.replacedatabase = true; restore.norecovery = false; serverconnection con = new serverconnection(@".\myinstance"); server sqlserver = new server(con); backup source = new backup(); restore.sqlrestore(sqlserver); cheers

three.js - A-Frame: How do you add multiple meshes to an entity with setObject3D? -

with a-frames tags, 1 can add multiple components children entity: <a-scene> <a-entity> <a-box>...</a-box> <a-box>...</a-box> </a-entity> <a-scene> how duplicate in registered component setobject3d method? codepen: https://codepen.io/ubermario/pen/wrwjvg yup, can name object3d want. mesh word sort of commonly accepted meshes , used geometry/material components. clarify: setobject3d('mesh') setobject3d('yourobject') setobject3d('whateveryouwantbox');

chunking - Configure NginX proxy to preserve the chunk size sent from the proxied backend server -

question nginx proxy, there way control chunk size (ie mimic chunks being sent proxy-ed backend server, not breaking chunks) i have backend server built return chunked responses clients each chunk set full audio part. when running behind nginx proxy server, nginx seems breaking full chunks returned backend server smaller chunks. data sent properly, original chunks returned server broken several smaller chunks here sample output, 2017/09/11 17:16:20 debug - com.nuance.httpservlet.utils.httpttsparser: readchunk 1414 bytes 2017/09/11 17:16:20 debug - com.nuance.httpservlet.utils.httpttsparser: readchunk 11360 bytes 2017/09/11 17:16:20 debug - com.nuance.httpservlet.utils.httpttsparser: readchunk 2840 bytes 2017/09/11 17:16:20 debug - com.nuance.httpservlet.utils.httpttsparser: readchunk 2840 bytes 2017/09/11 17:16:20 debug - com.nuance.httpservlet.utils.httpttsparser: readchunk 2840 bytes 2017/09/11 17:16:20 debug - com.nuance.httpservlet.utils.httpttsparser: readchunk 28

amazon web services - Create CloudFormation resources in different region -

i've cf stack , i've defined different resources. 1 of these s3 bucket. need run stack in eu-west-1 region while create bucket in ap-southeast-1 region. how can this? unfortunately impossible using standard aws::s3::bucket in cloudformation, since resources managed cloudformation stack can reside in same region stack itself. however, work way around using lambda function your lambda function have set locationconstraint ap-southeast-1 when creating bucket . also, lambda function responsible updating , deleting bucket, can involve bit more code. you can wire lambda function cloudformation using lambda-backed custom resources .

osx - Trying to install Date perl module OS X -

so have script i'm trying run billing_automated.pl i have use date; in first few lines. when try , run script error can't locate date.pm in @inc (you may need install date module) (@inc contains: /usr/local/cellar/perl@5.18/5.18.2/lib/site_perl/5.18.2/darwin-thread-multi-2level /usr/local/cellar/perl@5.18/5.18.2/lib/site_perl/5.18.2 /usr/local/cellar/perl@5.18/5.18.2/lib/5.18.2/darwin-thread-multi-2level /usr/local/cellar/perl@5.18/5.18.2/lib/5.18.2 .) @ billing_automated.pl line 4. begin failed--compilation aborted @ billing_automated.pl line 4. so attempt run cpan install date and vomit of output: reading '/users/username/.cpan/metadata' database generated on mon, 11 sep 2017 20:17:02 gmt running install module 'date' running make s/se/seyhan/html-stable-0.01.tar.gz checksum /users/username/.cpan/sources/authors/id/s/se/seyhan/html-stable-0.01.tar.gz ok cpan.pm: building s/se/seyhan/html-stable-0.01.tar.gz checking if kit complete..

cmd error while using python code -

i new process of learning programming. going learn python first scripting language. downloaded python 3.6.2 , wrote simple "hello world " program in idle- works fine and tried open file in command prompt , showing syntax error below. c:\users\user>cd \code c:\users\user>cd \code c:\code> c:\code>hello.py file "c:\code\hello.py", line 1 python 3.6.2 (v3.6.2:5fd33b5, jul 8 2017, 04:14:34) [msc v.1900 32 bit (intel)] on win32 ^ syntaxerror: invalid syntax c:\code> my pc windows 10 , 64 bits i searched solution , couldn't find any. please reply me if have solution thank you!! i'm not familiar windows cmd, in linux, run python terminal python3 filename.py or make filename.py executable , run ./filename.py

sql - Select Statement with Variable not working C# -

i have done bunch of select statements addwithvalue's , add's 1 can't seem work. works fine when put number in instead of @ordernum. tried @ordernum , '@ordernum' when put '' nothing happens on button click when use @ordernum says can't find ordernum in table. value in sql table char bit data maybe has it? ideas? end of select statement: where poitem.ordno = @ordernum add : cmd.parameters.add(new oledbparameter("@ordernum", potextbox.text)); the entire select statement (the resulting big c# string concatenated smaller chunks): "select cast(poitem.itnbr char(15) ccsid 37) itemno, cast(poitem.itdsc char(15) ccsid 37) itdsc, cast(poitem.house char(15) ccsid 37) hou, cast(poitem.refno char(15) ccsid 37) ref, cast(poitem.staic char(15) ccsid 37) staic, poitem.qtyor, cast(poitem.unmsr char(15) ccsid 37) unmsr, poitem.umcnv, poitem.dkqty, poitem.stkqt, cast(poitem.jobno char(15

embedded - I2C with Atmega168 -

i'm trying control several servos using adafruit pwm servo controller. uses i2c interface communicate micro controller. https://www.adafruit.com/product/815 i'm using atmega 168 attempt send i2c instructions micro controller using simple i2c library. #include "i2c.h" void initi2c(void) { twbr = 32; /* set bit rate, see p. 242 */ /* 8mhz / (16+2*twbr*1) ~= 100khz */ twcr |= (1 << twen); /* enable */ } void i2cwaitforcomplete(void) { loop_until_bit_is_set(twcr, twint); } void i2cstart(void) { twcr = (_bv(twint) | _bv(twen) | _bv(twsta)); i2cwaitforcomplete(); } void i2cstop(void) { twcr = (_bv(twint) | _bv(twen) | _bv(twsto)); } uint8_t i2creadack(void) { twcr = (_bv(twint) | _bv(twen) | _bv(twea)); i2cwaitforcomplete(); return (twdr); } uint8_t i2creadnoack(void) { twcr = (_bv(twint) | _bv(twen)); i2cwaitforcomplete(); ret

Create a 3D plotly surface plot -

i have data frame below , want create 3d plotly surface plot this: https://plot.ly/r/3d-surface-plots/#basic-3d-surface-plot ideally date "z" im not sure this. any suggestions on how proceed? date=c("1/1/2017","1/2/2017","1/3/2017","1/4/2017","1/5/2017","1/6/2017","1/7/2017","1/8/2017" ) treasury_1m=c(0.5, 0.48, 0.66, 0.75, 0.73, 0.84, 0.97, 0.98) treasury_3m=c( 0.52, 0.53, 0.75, 0.81, 0.9, 1, 1.09, 1.03) treasury_6m=c( 0.62, 0.65, 0.89, 0.95, 1.04, 1.11, 1.13, 1.13) treasury_1y=c(0.5, 0.48, 0.66, 0.75, 0.73, 0.84, 0.97, 0.98) treasury_2y=c( 0.52, 0.53, 0.75, 0.81, 0.9, 1, 1.09, 1.03) treasury_5y=c( 0.62, 0.65, 0.89, 0.95, 1.04, 1.11, 1.13, 1.13) treasury_10y=c(0.5, 0.48, 0.66, 0.75, 0.73, 0.84, 0.97, 0.98) treasury_30y=c( 0.52, 0.53, 0.75, 0.81, 0.9, 1, 1.09, 1.03) df = data.

c++ - I want use tesseract in qt -

my program in qt: const char* white_list = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789-"; auto ocr = cv::text::ocrtesseract::create("/usr/share/tesseract-ocr/tessdata/","eng", white_list); ocr->run(gray2, text, &boxes, &words, &confidences); text.erase(remove_if(text.begin(),text.end(),::isspace),text.end()); temp = qstring::fromstdstring(text); ui->textbrowser->append(temp.toupper()); when executed prints: ocrtesseract(33): tesseract not found. /usr/share/tesseract-ocr/tessdata/ eng abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789- ocrtesseract(00): tesseract not found. how can fix it?

swift - Cannot convert value of type 'Foo!' to expected argument type 'Foo!' -

i'm baffled i've run couple of times. errors similar following cannot convert value of type 'foo!' expected argument type 'foo! ' i've searched so, haven't found explains why foo! isn't same foo!. here's example: // fooviewmodel.swift class fooviewmodel: baseviewmodel { fileprivate var foo: foo! fileprivate var bar: bar = bar() init!(model: foo!) { super.init() foo = model } override init() { super.init() } func setfoomodel(_ model: foo!) { self.foo = model } func getfoomodel() -> foo! { return self.foo } func getbar() -> bar { return bar } func getblah() -> string { return "blah" } } here unit test generates error: import xctest @testable import woohoo class fooviewmodeltests: xctestcase { override func setup() { super.setup() } override func teardown() { sup

java - In Spring boot, When the new document is created when using @Document annotation? -

i new spring , mongodb. so, hear use case want understand. in springboot , mongodb structure. trying insert new document in mongo, hence used @document in java pojo/domain/data class. now, have written code , starting server. question is, when collection created in mongodb? i.e. while starting server (spring scan classes @document , create collection id db while creating classes) or when repository code invoked (when trying perform crud operations)? the collection in mongodb along indexes created when repository code invoked perform crud operations ..

vb.net - unable to cast COM object of type "system.__comObject" to interface type 'shell32.shell' -

i run project in win 7 , xp, there error message, in project use shell32.shell copy , extract automatic exe file, shell32.shell not work in windows 7 , xp? if can, please suggest sheell32.shell can run dim sc new shell32.shell() dim pathexeonserver string = "\\server\updateprogram\" try if (not system.io.directory.exists(path.combine(application.startuppath() & "\rs_application"))) directory.createdirectory(path.combine(application.startuppath() & "\rs_application")) else 'do nothing end if me.cursor = cursors.waitcursor file.copy(path.combine(pathexeonserver, filename & ".zip"), path.combine(application.startuppath() & "\rs_application", filename & ".zip"), true) system.io.file.delete(application.startuppath() & "\rs_application\" & filename &

sql server - T-SQL: Is there a way to check if the value of one variable is present in another variable -

code: declare @a varchar(100) = ';2;9;12;13;14;16;17;21;' declare @b varchar(100) = ';2;12;13;' declare @c varchar(100) while len(@a) > 1 begin set @c = substring(@a,1,charindex(';',@a,2)) set @b += @c @c not in @b ----this statement gives problem , shows syntax error set @a = substring(@a,charindex(';',@a,2),len(@a)) select @a, @b, @c end what i'm trying accomplish here have declared 2 variables of varchar type , assigned them value. third variable i've declared sub-string derived 1st variable. value of 3rd variable i'm trying find it's presence in 2nd variable , if it's not i'm trying concatenate 2nd one. so first value @c is: ';2;' , should compare @b , if not present in @b should concatenate @b. so result should in end. @b = ';2;12;13;9;14;16;17;21;' kindly help. thanks. to solve problem straightforwardly, change: set @b += @c @c not in @b to: set @b += case w

java - Use POST for delete/update in Rest? -

i understand (from accepted answer what difference between http , rest? ) rest set of rules how use http accepted answer says no, rest way http should used. today use tiny bit of http protocol's methods – namely , post. rest way use of protocol's methods. for example, rest dictates usage of delete erase document (be file, state, etc.) behind uri, whereas, http, misuse or post query ...product/?delete_id=22 my question disadvantage/drawback(technical or design) if continue use post method instead of delete/put deleting/updating resource in rest ? my question disadvantage/drawback(technical or design) if continue use post method instead of delete/put deleting/updating resource in rest ? the post request not idempotent delete request idempotent . an idempotent http method http method can called many times without different outcomes idempotency important in building fault-tolerant api. suppose client wants update reso

Mule ActiveMQ at particular time interval -

i have scenario wherein need start receiving messages queue after particular time interval irrespective of time message placed in queue. for example flow a process service calls , place below message in queue { filename:"blahblah.pdf" } now flow b need start recieving messages queue after 9pm(or time) daily , process it. i wonder possible achieve scenario in mule. you can achieve in mulesoft using poll scope or quartz schedular . code thing <quartz:inbound-endpoint jobname="readqin" cronexpression="* * * * * ?" doc:name="quartz"> <quartz:endpoint-polling-job> <quartz:job-endpoint address="jms://qin" /> </quartz:endpoint-polling-job> </quartz:inbound-endpoint>

python - How to inserting data into interrelated relationship tables using SQLAlchemy (not flask_sqlalchemy or flask-merge)? -

i new sqlalchemy, trying build practice project using sqlalchemy. have created database containing tables following relationship. questions : how insert data tables interdependent? does form loop in database design? is looping database design, bad practice? how resolve if bad practice? department.manager_ssn ==> employee.ssn and employee.department_id ==> department.deptid database relationship diagram and following current version of code creating exact database. # department table class departments(base): __tablename__ = "departments" # attricutes dname= column(string(15), nullable=false) dnumber= column(integer, primary_key=true) mgr_ssn= column(integer, foreignkey('employees.ssn'), nullable=false) employees = relationship("employees") # employee table class employees(base): __tablename__ = "employees" # attributes fname = column(string(30), nullable=false) minit = c

Complexity Analysis: how to identify the "basic operation"? -

i taking class on complexity analysis , try determin basic operations of algorithms. defined following: a basic operation 1 best characterises efficiency of particular algorithm of interest for time analysis operation expect have influence on algorithm’s total running time: - key comparisons in searching algorithm - numeric multiplications in matrix multiplication algorithm - visits nodes (or arcs) in graph traversal algorithm for space analysis operation increases memory usage - procedure call adds new frame run-time stack - creation of new object or data structure in run-time heap the basic operation may occur in more 1 place in algorithm so i'm trying figure out basic operation of reversearray algorithm. reversearray(a[0..n-1]) i=0 [n/2]-1 temp <- a[i] a[i] <- a[n-1-i] a[n-1-i] <- temp my tutor mentioned basic operation "kind of operation" assignment, addition, division , either choose between assignment

c++ - multiple shortcut key doesn't work -

i put on multiple shortcuts on each qaction , e.g. 'l, right, space'. 'l' shortcut doesn't work. 'right' , 'space' can work. similarly, if register 'a, b' , then, 'a' not work , 'b' work. if use qmainwindow::eventfilter() myself, instead of using qaction::setshortcut() , shortcut keys work. in case, of course, shortcut key text not displayed on main menu. i tested on windows 7 x64, , qt-5.9.1 qmap<qstring, qaction*>& actions = qapp->keyactions().actions(); qmap<qstring, qkeysequence> & seqmap = qapp->keyactions().keymaps(); foreach(const qstring& name, actions.keys()) { qaction* = actions[name]; qkeysequence seq = seqmap[name]; // e.g. qkeysequence("l, right, space") a->setshortcut(seq); a->setshortcutcontext(qt::applicationshortcut); } as name "qkeysequence" suggests, sequence of keys have pressed. string "l, right, space"

angularjs - Kendo treeview on hover -

i working on kendo treeview using angular , typescript.is there event onhover in kendo treeview. want take selected element using on hover event. <div kendo-tree-view k-data-source="treedata" k-data-text-field="['directiveitem.elementid']" k-expand="expandtree" k-change="changetree" k-drag-and-drop="true k-drop="ondrop" ng-click="ctrlopen($event)"> </div>

android - setEncryptionRequired(true) vs setEncryptionRequired(false) -

keypairgeneratorspec.builder setencryptionrequired () indicates key pair must encrypted @ rest. protect key pair secure lock screen credential (e.g., password, pin, or pattern). it comes android's documentation: https://developer.android.com/reference/android/security/keypairgeneratorspec.builder.html#setencryptionrequired() what mean "encrypted at rest ". is secure? is keypair encrypted? what difference between setencryptionrequired(true) , setencryptionrequired(false) please note post contains 1 question. divided subquestions make more clear asking. please don't downvote because contains lot of questions. 1 question.

javascript - To support loadbalancing on NodeJS Server where do we keep our database? -

Image
i trying add load balancing on gcp, doubt shall keep database (mysql). have on different vm. scaled vm accessing it. if install on same vm nodejs server running after scaling data scattered in multiple database in multiple vm. is correct architecture start loading balancing on gcp from looks of it, yes want keep mysql datbase on separate vm. come in handy if decide migrate, cluster etc database. best if storing sessions in database.

c - Reading a binary file into structure variable giving seg fault -

i have below sample file read binary structure , print length of string stored in structure. segmentation fault core dumped when try print full string. not find reason it. #include <stdio.h> #include <stdlib.h> struct sample { unsigned int m; unsigned int v; unsigned int s[128]; int t_length; char *t; }; int main() { int i=0; unsigned int t_len=0; file *fp; struct sample sam; fp =fopen("sample.bin", "rb"); if (fp==null) { printf("file not created\n"); return -1; } fread(&sam, sizeof(sam), 1, fp); printf("t_length %d\n", sam.t_length); t_len=sam.t_length; sam.t=(char *)malloc(sizeof(char) * t_len); fseek(fp,0,seek_set); fread(&sam, sizeof(sam)+t_len, 1, fp); printf("t_length %d\n", t_len); printf("%s\n", sam.t);

php - SQLSRV doesn't fetch all rows -

i'm using sqlsrv extension php , have problem fetching rows simple query. query select should return 133228 rows when trying display rows 15. i've searched answer couldn't find solution , first time using extension. i've found answer previous question same problem in case problem double calling of sqlsrv_fetch_array, don't have sure. here query: $sql = 'select * viewproduct'; $params = array(); $options = array('scrollable' => sqlsrv_cursor_keyset); $stmt = sqlsrv_query($dbremote, $sql, $params, $options); $count = sqlsrv_num_rows($stmt); if ($count === false) echo "error in retrieveing row count."; else echo $count; //$rows = array(); while ($row = sqlsrv_fetch_array($stmt, sqlsrv_fetch_assoc)) { print_r($row); echo "<br>"; //$rows[] = $row; } as said above query returns 15 when should 133228 rows. what missing? thank in advance.

c# - add db column to textbox and save it in db (total) -

i want add value in textbox column in db called quantity using update, every time click save collection in db (quantity) i'm sorry english not good note: db=invoice , table=product edit: solve , hope code usefull ppl private void button1_click(object sender, eventargs e) { sqlconnection con = new sqlconnection("data source=nawaf;initial catalog=invoice;integrated security=true"); con.open(); sqlcommand cmd = new sqlcommand(@"insert [invoice].[dbo].[invoice] ([invoice_number] ,[inventory_id] ,[received_date] ,[supplier_code] ,[supplier_name] ,[product_code] ,[product_name] ,[serial_number] ,[mgf_date] ,[product_unit] ,[receivedq]) values ('" + textbox1.text + "' ,'" + combobox1.text + "' , '" + textbox3.text + "' , &

.net - HTTP Get with Body with HttpClient not possible due to ProtocolViolationException -

i know why not recommended have http body, see: http request body but have third-party service mongodb paas lets query sending http body (the filter clause in http body). doesn't support same query via http post. http body httpclient gives protocolviolationexception complains wrong verb. in humble opinion, httpclient should discourage non-standard usages (similar adding headers via tryaddwithoutvalidation ) not make them impossible. world not perfect after all. httpclient stands in way , paas provider not change apis suit http client. i read numerous related questions here in , many answers talking why bad have http body , should never it. however, have no control in case. how can work around problem system.net.http.httpclient ?

html - Using Jade Templating Includes With Emmet - Jade Overwrites changes made -

i using jade, sass & emmet project , want use includes jade "nav", "footer", "sidebar" & "base html markup" , write content of body emmet the problem facing whenever update on jade files custom markups overwritten. so question are: how can avoid ? are there tools acts includes ? here example of project dir: /project_name/ /jade/ index.jade /template-parts/ base.jade nav.jade footer.jade sidebar.jade /sass/ /vendors/ /resources/ index.html

scala - Relay-modern - How to navigate in RelayFragmentComponent? -

i using scalajs-react-interface , have postlist extending relayfragmentcomponentp , want navigate post screen when user clicks on of post item on list screen there no navigate object in relayfragmentcomponent i'm not sure best way navigate postlist post screen. can me please?

java - @WebMvcTest giving 'Error creating bean with name' error for different service in spring boot test -

i trying write test spring boot application. independent controller test, have used @webmvctest ran issues. here basic structure of code. usercontroller has userservice class autowired. librarycontroller has libraryservice class autowired. here code usercontrollertest :: @runwith(springrunner.class) @webmvctest(usercontroller.class) public class usercontrollertest { @autowired private mockmvc mockmvc; @mockbean private userservice userservicemock; @test public void sometest(){} } it giving error while running code in usercontrollertest: caused by: org.springframework.beans.factory.unsatisfieddependencyexception: error creating bean name 'librarycontroller': unsatisfied dependency expressed through field 'libraryservice'; nested exception org.springframework.beans.factory as per understanding, since have specified usercontroller inside @webmvctest annotation, need mock dependency required controller. asking libr

javascript - can't obtain the correct hour with moment -

ok recieve hour "2017-09-12t18:30:00-04:00" but when want put hour un format 24hours: moment(data[i].hora_llegada, "yyyy-mm-dd hh:mm:ss").format("hh:mm:ss"),¿ i obtain output: "06:30:00" this 6:30 need 18:30 this happen when insert next array: dataassistsuser.push({ actualizacion_registro: data[i].actualizacion_registro, baja: data[i].baja, falta: data[i].falta, fecha_laboral: moment(data[i].fecha_laboral, ['yyyy-mm-dd']).format("yyyy-mm-dd"), fecha_registro: data[i].fecha_registro, hora_llegada: moment(data[i].hora_llegada, "yyyy-mm-dd hh:mm:ss").format("h:mm:ss"), //problem here hora_salida: moment(data[i].hora_salida, "yyyy-mm-dd hh:mm:ss").format("h:mm:ss"), //problem here id: data[i].id, total_atraso: moment(data[i].total_atraso, ['yyyy-mm-dd hh:mm:ss']).format('mm:ss'), user: data[i].user, user_id: data[i].user_id, vacacio

android - How to change the focus from last edit text field to a button on clicking done in soft input? -

i want change focus edit-text field submit button when done clicked on soft input. i've following code : <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:paddingtop="5sp"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="driver + conductor :" android:textsize="17sp" android:textstyle="bold" /> <edittext android:id="@+id/bus_driver_above60" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginleft="5dp" android:layout_weight="1" android:hint="driver" android:inputtype="numberdecimal" android:textalignment="

python - Find closest line to each point on big dataset, possibly using shapely and rtree -

Image
i have simplified map of city has streets in linestrings , addresses points. need find closest path each point street line. have working script this, runs in polynomial time has nested loop. 150 000 lines (shapely linestring) , 10 000 points (shapely point), takes 10 hours finish on 8 gb ram computer. the function looks (sorry not making entirely reproducible): import pandas pd import shapely shapely import point, linestring def connect_nodes_to_closest_edges(edges_df , nodes_df, edges_geom, nodes_geom): """finds closest line points , returns 2 dataframes: edges_df nodes_df """ in range(len(nodes_df)): point = nodes_df.loc[i,nodes_geom] shortest_distance = 100000 j in range(len(edges_df)): line = edges_df.loc[j,edges_geom] if line.distance(point) < shortest_distance: shortest_distance

android - How to override text of edit text when maxLength of edittext is 1 -

for example: enter 1 in edittext again if type 2 in same edittext not want remove manualy 1 want override directly 1 2. for example: edittextotpfirst.addtextchangedlistener(this); edittextotpsecond.addtextchangedlistener(this); @override public void beforetextchanged(charsequence s, int start, int count, int after) { } @override public void ontextchanged(charsequence s, int start, int before, int count) { } @override public void aftertextchanged(editable s) { if (edittextotpfirst.gettext().length() ==1 && !checkedittextempty(edittextotpfirst)) { edittextotpsecond.requestfocus(); } if (edittextotpsecond.gettext().length() ==1 && !checkedittextempty(edittextotpfirst) ) { edittextotpthird.requestfocus(); } } @override public boolean onkey(view v, int keycode, keyevent event) { if (v.getid() == r.id.edittextotpthird) { if (event.getaction() == keyevent.action_up) { if (keycode ==

java - Android spinner validation for multiple/dynamic spinners in one activity -

i have app i'm populating multiple spinners sqlite using same function. validate spinner whereby when user selects item first spinner should not appear in next spinner , on. note first spinner custom while rest created dynamically. i'm populating spinner using object array. on how achieve lot

ios - WKWebView randomly not loading FacebookLike-Button (via WPZoom Social Plugin) -

Image
i'm made app fetches posts wordpress-site via api, presents title , excerpt in uitableviewcontroller , if user taps cell post presented (via segue) in uiviewcontroller-subclass containing wkwebview. the uiviewcontroller subclass handles navigationdelegate , uidelegate of webview. so far works fine. but comes weird behaviour: wordpress-page has whatsapp-button , facebook-like , facebook-share button the whatapp-button , facebook-share (the 1 @ end of row) work without problem. like-button not work. strange thing appears not react anything, @ least none of delegates called) what find out better network-connection better button works. i.e. had problem in 1 out of twenty. didn't realised before colleague (who has terrible internet connection) informed me problem. my guess is, problems must on server side, works in mobile safari , android version works without problems. so, has clue problem , how solve it? to handle like-action implemented func webview(_ webv

r - Can't delete file - open i Rstudio -

is there way force r delete file using unlink() when open in r? when trying r throws warning: warning message: in file.remove(ls) : cannot remove file 'dat.csv', reason 'permission denied'. have large global environment, , have difficulties finding reason file in use. when try delete in using windows, error: action cannot completed because file open in rstudio r session. alternativly, there way see entity blocking delete?

Python 3 - Need to make a program that will R/W a text file and show the amount of Char in new file -

i need make program, ask user .txt file want rewrite new file , should new files name + new file has in uppercase. after doing program has show amount of symbols(characters) in new file. f1 ask name of file want re-write. f2 ask new name should be. #xxxxxxxxxxxx f1 = input("xxxxxxxxxxx xxxxxxxxxxxx (xxxxxxxxxx: ):") f2 = input("xxxxxxxxxxxxxxxxxxxxxx (xxxxxxxx: ):") #xxxxxxxxxxxxxxxxxxxxx firstfail = open(f1, 'r') newones = firstfail.readlines() #xxxxxxxxx indeed = open(f2, 'w') indeed.write((str(newones)).upper()) #xxxxxxxxxxxx firstfail.close() indeed.close() #xxxxxxxxxxxxx sym = open(str(indeed, 'r')) print(str.count(start=0, end=len(sym))) this error i'm getting: sym = open(str(indeed, 'r')) typeerror: decoding str: need bytes-like object, _io.textiowrapper found now know nfail in wrong format , need somehow change have no idea how. the 2 last lines makes no sense: sym = open(str(nfail, '

android - Out of Memory Error when Loading Images from Mipmap folder -

logcat fatal exception: main process: com.example.markpalmer.blackjack21, pid: 21864 java.lang.outofmemoryerror: failed allocate 5808012 byte allocation 5226696 free bytes , 4mb until oom hi, know there posts regarding this, don't understand answers. error random, , occurs when setting imageview: ivplayercard3.setimageresource(picp3); the images not large: 36kb, 500x700 .png files. thing no particular reason have put them in res>mipmap-hdpi folder. reason problem. shifting them drawable folder help? many in advance. why don't try setting thee imageresouce using known libraries picasso check doc here picasso handles oom loading image in segments or fractions. moving them drawable might mipmap creates map of image, better solution use picasso hope helps!

python - Passing a byte array to a C++ function that accepts a void pointer -

i'm using boost::python export c++ functions expect void* . interpret raw memory (an array of bytes) internally. think read , write special purpose device. how pass python bytearray such function? i have tried using ctypes.c_void_p.from_buffer(mybytearray) doesn't match signature of function. here's minimal example: #include <boost/python.hpp> void fun_voidp(void*) {} boost_python_module(tryit) { using namespace boost::python; def("fun_voidp", fun_voidp); } and @ python side: import tryit import ctypes b = bytearray(100) tryit.fun_voidp(b) # fail tryit.fun_voidp(ctypes.c_void_p.from_buffer(b)) # fail tryit.fun_voidp(ctypes.c_void_p.from_buffer(b).value) # fail i'd fix function prototype take char* , go last python line. there's no reason use void* in c++. understand if api does, shouldn't hard wrap own function.

javascript - undefined parameter in js -

Image
i receiving type error stating array testa[i] undefined whenever add input html page. have array set , i'm trying add value of currency array using push method add second part of array i.e([0][currency]) function test() { var testa = []; (i = 0; < 4; i++) { this.currency = prompt("please enter 3-letter currency abbreviation", ""); testa[i].push(currency); } } var index = new test(); any why array undefined appreciated. note: have tried both testa.push(currency) , testa[i] = this.currency, , still same error before. note: final version should have loop through 4 different questions asked , each time adding these array. @ end of loop new variant of array should made , new set of data entered added it. for(i = 0; < 4; i++) { testa[i] = i; for(j = 0; j < 4; j++) { this.currency = prompt("please enter 3-letter currency abbreviation", ""); testa[i][j] = this.currency;

Preview Page before form submission using codeigniter php -

before submitting form there option previewing page user can check how form displaying in front end unable display preview option checking. as have tried display form in popup before submission popup not displaying. <script type= "text/javascript"> $(document).ready( function() { $('#submit').on('click', function(e) { e.preventdefault(); preview(); }); }); function preview(){ var text = $('input[name="blog_title"]').val(); var text_label = $('label[for="text"]').text(); var text_data = '<p><strong>' + text_label + '</strong> : ' + text + '</p>'; $('#preview_data').html(''); $('#preview_data').append(data); $('#preview_data').dialog({ resizable: false, //height:140, modal: true,

h2o.ai Platt Scaling calibration -

i noticed relatively recend add h2o.ai suite, ability perform supplementary platt scaling improve calibration of output probabilities. (see calibrate_model in h2o manual .) nevertheless few guidance avaiable on online docs. in particular wonder whether when platt scaling enabled: how affects models' leaderboard? is, platt scaling calculated after ranking metric or before? how affects computing performance? can calibration_frame same validation_frame or should not (both under computation or theoretical point of view)? thanks in advance calibration post-processing step run after model finishes. therefore doesn't affect leaderboard , and has no effect on training metrics either. adds 2 more columns scored frame (with calibrated predictions). this article provides guidance how construct calibration frame: split dataset test , train split train set model training , calibration. it says: the important step create separate dataset perform calibration

pandas - Python Matrix - Limiting Matrix to top 20 -

Image
i have matrix counts number of links between 2 sets of disciplines did through code df created: new_df = df[['grantrefnumber','subject']] = ['psychology','education','social policy','sociology','pol. sci. & internat. studies','development studies','social anthropology','area studies','science , technology studies','law & legal studies','economics','management & business studies','human geography','environmental planning','demography','social work','tools, technologies & methods','linguistics','history'] final_df = new_df[new_df['subject'].isin(a)] ctrs = {location: counter(gp.grantrefnumber) location, gp in final_df.groupby('subject')} ctrs = list(ctrs.items()) overlaps = [(loc1, loc2, sum(min(ctr1[k], ctr2[k]) k in ctr1)) i, (loc1, ctr1) in enumerate(ctrs, start=1) (loc2,