Posts

Showing posts from August, 2011

process - Android M: How to get all processes UID's? -

i have application uses traffic stats api see running processes using network. i used getting uid obtained through getrunningappprocesses() method. apparently has been changed in android m return application package name shown here . my question is: there way name and uid of every running processes in android m? here sample of how doing before, recreate functionality on android m. list<runningappprocessinfo> procinfos = activitymanager.getrunningappprocesses(); packagemanager pm = context.getpackagemanager(); (int = 0; < procinfos.size(); i++) { try { string packagename = procinfos.get(i).processname; string appname = ""; try { appname = pm.getapplicationlabel( pm.getapplicationinfo(packagename, packagemanager.get_meta_data)) .tostring(); } catch (namenotfoundexception e) { appname = ""; } int uid = procinfos.get(i).uid; ...

python 2.7 - mysql.connector, multi=True, sql variable assignment not working -

sql code (all in 1 file saved in python variable "query"): select @dtmax:=date_format(max(dt), '%y%m') table_a; delete table_b date_format(dt, '%y%m')=@dtmax; does mysql-connector allow use of variable assignment i've done in query above. i.e. take value of max(date) table_a , delete date table_b. python code: c = conn.cursor(buffered=true) c.execute(query, multi=true) conn.commit() conn.close() all know 2nd sql statement doesnt execute. i can copy , paste sql code toad , run there without problems not through mysql.connector library. have used pandas legacy script written else , don't have time re-write everything. i kindly appreciate help. when use multi=true , execute() return generator. need iterate on generator advance processing next sql statement in multi-statement query: c = conn.cursor(buffered=true) results = c.execute(query, multi=true) cur in results: print('cursor:', cur) if c...

android - PhoneGap Build Plugins -

i have been writing app in brackets , have been building phonegap build can have android , iphone versions programming on windows. i trying use barcode scanner work in both android , iphone: https://www.npmjs.com/package/phonegap-plugin-barcodescanner-quick but directions type commands in cli, have not been using since have been suing phonegap build. i tried adding code so: $(document).ready(function () { //todo user id local storage var searchterm = window.localstorage.getitem("search"); var userid = window.localstorage.getitem("userid"); var history = []; var lastupdate = window.localstorage.getitem("searchupdatetime"); //todo scan stuff cordova.plugins.barcodescanner.scan( function (result) { alert("we got barcode\n" + "result: " + result.text + "\n" + "format: " + result.format + "\n" + "canc...

migration - Cannot reduce size of RCP view when migrated to Eclipse 4 -

i'm working on migrating set of eclipse rcp applications 3.6 4.2. i'm struggling issue rcp perspectives view height cannot reduced below size (looks 10% window height). code works fine in eclipse 3.x , user can reduce view height dragging border. however, in 4.x height of top view (button view) can reduced upto value. can this, please? public class perspective implements iperspectivefactory { public static final string id = "im.rcptest2.fixedperspective"; public void createinitiallayout(ipagelayout layout) { string editorarea = layout.geteditorarea(); layout.seteditorareavisible(false); layout.addstandaloneview(buttonview.id, false, ipagelayout.top, 0.1f, editorarea); layout.addstandaloneview(view.id, false, ipagelayout.left, 0.25f, editorarea); ifolderlayout folder = layout.createfolder("messages", ipagelayout.top, 0.5f, editorarea); folder.a...

osx - "./toolchain build kivy" gives an error on Mac OX X 10.8 despite following the tutorial -

i'm trying build kivy ios. following tutorial in kivy's guide , enter command: $./toolchain.py build kivy but outputs error message: traceback (most recent call last): file "./toolchain.py", line 173, in <module> class archsimulator(arch): file "./toolchain.py", line 178, in archsimulator sysroot = sh.xcrun("--sdk", "iphonesimulator", "--show-sdk- path").strip() file "./tools/external/sh.py", line 1021, in __call__ return runningcommand(cmd, call_args, stdin, stdout, stderr) file "./tools/external/sh.py", line 486, in __init__ self.wait() file "./tools/external/sh.py", line 500, in wait self.handle_command_exit_code(exit_code) file "./tools/external/sh.py", line 516, in handle_command_exit_code raise exc(self.ran, self.process.stdout, self.process.stderr) sh.errorreturncode_64: ran: '/usr/bin/xcrun --sdk iphonesimulator --show-sdk-path' stdout: stderr:...

Insert records from one table to another without violating any constraint in SQL Server database -

there 2 databases db_main , db_backup in sql server 2008. i want copy data of table1 db_backup table1 of db_main . the structure of tables in both database same. both tables in both database have foreign key, primary key constraint. when try copy data of table1 db_backup table1 of db_main query: insert [db_main].[table1] select * [db_backup].[table1]; i foreign key error. the insert statement conflicted foreign key constraint "fk_table1_table3". conflict occurred in database "db_main", table "table3", column 'requestid'. please let me know simple way copy records of table1 db_backup table1 of db_main , without violating constraint? please reply what means example trying insert record table1 has example requestid = 75 . foreign key constraint means there must record requestid = 75 in table3 .... , there isn't. so means need load data table3 to find records causing issue run sel...

android - My activity doesnt recognise text equality -

can me, i'm killing myself on here. in activity have code , application displays currentq not equal (currentq.getodg() != answer.gettext()) answer can see through logcat log.d words identical. can't understand doing wrong. 08-25 05:28:45.125: d/yourans(25316): na život u mraku na život u mraku log cat radiogroup grp = (radiogroup) findviewbyid(r.id.radiogroup1); answer = (radiobutton) findviewbyid(grp.getcheckedradiobuttonid()); log.d("yourans", currentq.getodg() + " " + answer.gettext()); if (currentq.getodg().equals(answer.gettext())) { answer.setbackgroundresource(r.drawable.radiotocan); toast poruka1 = toast.maketext(getapplicationcontext(), "točno!", toast.length_long); view vieew1 = poruka1.getview(); // vieew.setbackgroundcolor(color.parsecolor("#bd8bdc")); vieew1.setbackgroundresource(r.drawable.toast1); poruka1.setview(vieew1)...

ios - How to display Game Center leaderboard from SKScene -

i going preface noting ton of other threads in here this, can not of methods listed work. furthermore few of them latest ios , swift. anyway trying trigger function inside of view controller skscene in order show game center leaderboard. function have inside of uiviewcontroller func gamecenterviewcontrollerdidfinish(gamecenterviewcontroller: gkgamecenterviewcontroller!) { gamecenterviewcontroller.dismissviewcontrolleranimated(true, completion: nil) } func showleader() { var vc = self.view?.window?.rootviewcontroller var gc = gkgamecenterviewcontroller() gc.gamecenterdelegate = self vc?.presentviewcontroller(gc, animated: true, completion: nil) } i have tried acouple of methods access , trigger function have been having hardest time let alone accessing function skscene. reason looking function self.view doesn't work. how can this?

c++ - pointer to a member function of a class -

i have declared pointer member function of class. giving error. #include<iostream> using namespace std; class b { public: int b; void get() { cin>>b; } }; int main() { b b1 ; void (b::*ptr)()=&b::get; b1.*ptr(); cout<<b1.b; } the pointer-to-member operators .* , ->* have lower precedence function call syntax. need do: (b1.*ptr)();

c++ - break sub task of parallel_for_each -

i have big vector of items sorted based on 1 of fields, e.g. cost attribute, , want bit of processing on each of these items find maximum value of different attribute... constraint here cannot use item calculate maximum value if item's cost exceeds arbitrary price. the single threaded for-loop looks this: auto maxvalue = -max_flt; for(const auto& foo: foos) { // break if cost high. if(foo.cost() > 46290) { break; } maxvalue = max(maxvalue , foo.value()); } i've been able somewhat convert parallel_for_each. (disclaimer: i'm new ppl.) combinable<float> localmaxvalue([]{ return -max_flt; }); parallel_for_each(begin(foos), end(foos), [&](const auto& foo) { // attempt out if cost high. if(foo.getcost() > 46290) { return; } localmaxvalue.local() = max(localmaxvalue.local(), foo.getvalue()); } auto maxvalue = localmaxvalue.combine( [](const auto& first, const auto& second) { ...

json - how to convert compiled url in normail form using python -

i used gogole api search via python , used script below import urllib import json m_json query = raw_input ( 'query: ' ) query = urllib.urlencode ( { 'q' : query } ) response = urllib.urlopen ( 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&' + query ).read() json = m_json.loads ( response ) results = json [ 'responsedata' ] [ 'results' ] result in results: url = result['url'] # url in original , threw name error exception print ( url ) and after got result below : query: inurl:"readnews.php?id=" http://www.idmantv.az/readnews.php%3fid%3d14999 http://www.kanda.com/readnews.php%3fid%3d9 http://www.dcfever.com/news/readnews.php%3fid%3d12573 http://www.thegrower.org/readnews.php%3fid%3d6c0p5n0e8i6b but want url in normal form like http://www.idmantv.az/readnews.php?id=14999 how python? use urllib.unquote or urllib.unquote_plus decode % -encoded string: >>> urllib.unq...

c++ - How to synthesize key press events? -

i able key value's hal through call function in qt. created event key qkeyevent *event = new qkeyevent (qevent::keypress, inputkey.keyvalue, qt::nomodifier); note: inputkey.keyvalue key value received hal layer. now need register key event in qt, if key press happened in ir remote in respective form, keypressevent(e) or event(e) invoke. , based on key press, specific action execute. note: more 1 form there, key press event trigger , more 1 keys there "page_up, page_down, ok key etc....." tried invoke postevent() , connect(.......) nothing helped me. keypressevent() not getting executed. e.g. this: // receiver pointer qobject qcoreapplication::postevent (receiver, event); you can find more info here . you can reimplement qobject::event() or qwidget::keypressevent in widget receive key events. visit link or link more information. see example code below consists of 2 buttons , label. clicking pushbutton sends 'enter pressed' , pushbutt...

excel vba, write textbox value to a sheet based upon combobox value -

i have userform , userform1, multiple textboxes , comboboxes . i want when user fills out textboxes , comboboxes information saved worksheet on next available row. the worksheet in top row, row 1, has headers defining information held in each column. first 7 columns have information written them userform next 121 columns not have information written them userform. for first 7 columns info be, date, line, pitch, devices completed, number of operators, , comments. info come either combobox selections or textbox inputs , saved same column. have part figured out. for part having issue 121 other columns, columns have header code type of reject a, ab, abe, ect there 121 different reject codes. on userform user select combobox reject code in textbox next input number of rejects code, combobox1=abe , textbox1=3. when user clicks save want sub take info date, line, pitch, devices completed, number of operators, , comments placed open row under columns a,b,c,d,e,f respectively sub...

javascript - angular $http not sending any value into server -

i'm trying send json data server, , want response text server. this code : app.directive("registersection",['$http',function($http){ return{ restrict : "e", templateurl : "view/register-section.html", controller : function(){ this.regdata = {}; this.adddata = function(){ // send data $http({method:'post',url:'http://url.com/account/register',data:json.stringify(this.regdata)}).then(function(dt){ alert(json.stringify(dt)); },function(dt){ alert(json.stringify(dt)); }); }; }, controlleras : "reg" }; }]); this html code : <form name="registerform" ng-submit="registerform.$valid && reg.adddata()" novalidate> <input type="text" name="name" ng-model="reg.regdata.name" placeholder="your name" required><br /> <input type="email...

jsf 2 - datatable emptymessage does not automatically colspan to total no. of columns when datatable has no rows -

i using primefaces 5.2 on weblogic 11g/java 1.6/jsf 2.1. have datatable rows conditionally not rendered. problem when datatable has no rows display, emptymessage spanned first column , not columns. below datatable sample. <p:datatable var="sale" > <f:facet name="header"> sales/profits of manufacturers </f:facet> <p:columngroup type="header"> <p:row> <p:column rowspan="3" headertext="manufacturer" /> <p:column colspan="4" headertext="sale rate" /> </p:row> <p:row> <p:column colspan="2" headertext="sales" /> <p:column colspan="2" headertext="profit" /> </p:row> <p:row> <p:column headertext="last year" /> <p:column headertext="this year" ...

android - how to load chart values from json url and display in mpandroidchart -

i want load data json url , pass values mpandroidchart lib.or can suggest when chart lib easy load json data , draw charts you can use library volley parser json load data arraylist in mpandroidchart

junit - Spring Integration Java DSL unit test - How to mock a Service Activator class or other components/endpoints? -

i have class contains few service activator methods follows: @messageendpoint public class testservice { @serviceactivator public void setcomplete(message<string> message){ //do stuff } } in integration flow, 1 of channels call 1 of these methods: @bean public testservice testservice() { return new testservice(); } @bean public integrationflow testflow() { return integrationflows.from("testchannel") .handle("testservice", "setcomplete") .handle(logger()) .get(); } i'm writing unit test flow , using mockito mcoking service activator class: @contextconfiguration(classes = integrationconfig.class) @runwith(springjunit4classrunner.class) @dirtiescontext public class apptest { @mock private thegateway startgateway; @mock private testservice testrvice; @autowired @qualifier("testchannel") directchannel testchannel; @before p...

python - Copying a list of lists into part of another one in the most pythonic way -

i have large list of lists, containing zeros. have another, smaller list of lists want copy positions in bigger list of lists. want replace original values. way i've found far this: start = (startrow, startcol) in range( start[0], start[0] + len(shortlist) ): j in range( start[1], start[1] + len(shortlist[0]) ): longlist[i][j] = shortlist[i-start[0]][j-start[1]] however, doesn't feel pythonic - far know, list comprehensions in general prefered loops, , though didn't find in few hours of searching, there might function doing more elegantly. there better solution mine? edit: i'm interested in numpy solutions well, or perhaps more in plain python ones. you can replace inner loop slice-replacement: start = (startrow, startcol) i, elements in enumerate(shortlist, start[0]): longlist[i][start[1]:start[1] + len(elements)] = elements depending on want do, using numpy -arrays alternative: large[startrow:startrow + small.shape[0], startcol:sta...

Sitecore security - combining roles -

is there way combine access rights sitecore item? for example, have page lock down users member of 2 different roles rather just one, , user has 1 of roles should denied access. i know can have roles within roles wondering if there simpler way achieve this? i'm using sitecore 7.2. if trying check in code, can using var user = authenticationmanager.getactiveuser(); return user.isinrole("role1") && user.isinrole("role2") ? "granted":"denied"; but if trying achieve in sitecore security on item, , of 2 roles assigned. ex: if allow access item in role1 deny in role2, user roles 1 , 2 have his/her access denied.

Achieve Inter-App Communication on iOS through sockets -

i wondering how inter-app communication on ios in ios 7. occurred me if foreground app bind sockets , act server, , if background app (and had background entitlement audio) can connect servers. seemed me possible inter-app communication agreeing on port between 2 apps , switching app binds port based on whether in foreground or not. problem is, can never seem connect localhost background, example have code on loop: truct addrinfo *server_address; int ret = getaddrinfo("localhost", "1666", null, &server_address); int connection_id = connect(self.sockethandle, server_address->ai_addr, server_address->ai_addrlen); and connection_id -1. unsure why cannot connect given bind process not throw errors. check answer: ios - possible communicate between apps via localhost? also, remember make sure you're background app not stopped when other app entering in foreground (by default app stopped) but speaking don't think it's way intera...

alignment - How to have border of different sizes in wxwidgets? -

usually when add particular widget sizer in wxwidgets specify alignment , border flags ( .... ,wxalign_righ | wxleft | wxright , 10 ) my requirement have left border of 10 , right border of 20 , how achieve flag combination or way it? i don't think can way want to. have omit wx.right command , add dummy widget box: hbox.add((dummy,-1, wx.left,20)) if attempting in vertical box: vbox.add((-1, 20)) e.g. #!/usr/bin/python # -*- coding: utf-8 -*- # border.py import wx class example(wx.frame): def __init__(self, parent, title): super(example, self).__init__(parent, title=title, size=(260, 180)) self.initui() self.centre() self.show() def initui(self): panel = wx.panel(self) panel.setbackgroundcolour('#4f5049') vbox = wx.boxsizer(wx.vertical) hbox = wx.boxsizer(wx.horizontal) midpan = wx.panel(panel) midpan.setbackgroundcol...

Retrieve the column values of jqgrid dynamically -

here code of jqgrid. $("#grid").jqgrid({ url:$url, editurl:"serivce.php", datatype: "json" , mtype:"post", colnames:["test"], colmodel:[ {name:"test",index:"test", width:150,align:"center", editable:true, edittype:"select", editoptions:{size:1, dataurl:"../someurl.php?param1=parm } }, ], rownum:10, rowlist:[10,20,30], add: { top:30, left:20 }, edit:{ top:30, left:20 ...

javascript - Polymer dropdown list issue -

i having huge difficulty implement simple dropdown list polymer 0.5. i parallel migrating polymer .5 1.0. separate discussion ( migrating polymer project .5 1.0 error ). here code using define polymer element inside body: <polymer-element name="x-trigger" extends="paper-icon-button" relative="" on-tap="{{toggle}}" noink=""> <template> <shadow></shadow> <content></content> </template> </polymer-element> i using element further down body this: <x-trigger icon="menu" relative="" noink="" role="button" tabindex="0" aria-label="menu"> <paper-dropdown tabindex="-1" class="core-transition" style="outline: none; display: none;"> halign = left <br> valign = top </paper-dropdown> </x-trigger> i defined following script section...

c# - What is the url for Facebook authentication with WebAuthenticationCoreManager -

i have code facebook authentication var scopes = "email user_birthday user_events user_friends user_about_me"; webaccountprovider facebookaccountprovider = await webauthenticationcoremanager .findaccountproviderasync("https://www.facebook.com/dialog/oauth"); webtokenrequest webtokenrequest = new webtokenrequest(facebookaccountprovider, scopes); webauthenticationcoremanager not facebook oauth endpoint https://www.facebook.com/dialog/oauth , sets facebookaccountprovider null. know how can findaccountproviderasync working facebook? webauthenticationcoremanager.findaccountproviderasync() finds account providers have been registered windows. means (say) facebook app need support (which doesn't). @ moment it's useful microsoft accounts , organizational accounts (office 365/azure ad). if want use facebook's oauth 2.0 implementation directly can use webauthenticationbroker instead (there examples on page).

finding datetimepicker in visual studio -

i cant find "datetimepicker" in toolbox of visual studio 2008, can find , make use of it? tried search using "choose items" find there cant make visible in toolbox. please help. if not displaying try add manually. right click on toolbox --> add tab. once tab created--> right click--> use choose items--> here can select controls want add. check out

subprocess - How to receive the arguments in python sub process runable file -

subprocess.popen(['python', downloadscript.py, "--longitude", long, "--latitude", lat, "--download_to", ],stdout=subprocess.pipe) i want longitude , latitude , download_to in downloadscript.py file the pythonic way parse arguments in python module argparse : import argparse parser = argparse.argumentparser() parser.add_argument("longitude", help="enter longitude") parser.add_argument("latitude", help="enter latitude") parser.add_argument("download_to", help="target directory") args = parser.parse_args() latitude = args.latitude read more here: https://docs.python.org/2/howto/argparse.html

cluster analysis - Using variable length data inputs with EM algorithm clustering -

we have set of sequences taxi positions. want cluster data considering sequential patterns in data lines. example: t1, t2, t3, t4 travels , a,b,c,d,e set of places. data have like, t1 b c b d t2 a t3 b b b c e d t4 b c d c b d c a but problem length of data not variable. how can cluster these type of data using em. since not accept variable length data there way can customize it. thanks em general principle. can use different models . probably popular model em gaussian mixture modeling , gmm. naturally, if use covariances, gmm requires fixed dimensionality. but if use other models, there no reason cannot work variable length vectors. example, there em variants process text data, , text have different length.

mysql - How Do create insert query using procedure -

how create insert query using procedure create definer=`root`@`localhost` procedure `insert_emp `() insert employee(id,name,salary,address) values (id,name,salary,address) $name= $_post['name']; $salary= $_post['salary']; $address= $_post['address']; $sql=mysql_query("call insert_emp ($name,$salary,$address)"); make sure field "id" set auto-increment inorder have easy inserting table. delimiter $$ create /*[definer = { user | current_user }]*/ procedure `insert_emp`(in name varchar(15),in salary int,in address varchar(15)) begin insert `employee`(employee.`id`,employee.`name`,employee.`salary`,employee.`address`) values (id,name,salary,address); end$$ delimiter ; example query, call insert_emp ('anish',18000,'mlre');

c - xError When compiling Dcmi -

excuse english. i want set dcmi in hal, because use coocox have copy code generator cubemx the compiler not line: __hal_linkdma(hdcmi, dma_handle, hdma_dcmi); code: void dcmi_dma_init(void){ gpio_inittypedef gpio_initstruct; __gpioe_clk_enable(); __gpioa_clk_enable(); __gpioc_clk_enable(); __gpiod_clk_enable(); __dcmi_clk_enable(); __dma2_clk_enable(); hal_nvic_setprioritygrouping(nvic_prioritygroup_2); hal_nvic_setpriority(dcmi_irqn, 0, 0); hal_nvic_enableirq(dcmi_irqn); /* pe4 ------> dcmi_d4 pe5 ------> dcmi_d6 pe6 ------> dcmi_d7 pa6 ------> dcmi_pixck pc6 ------> dcmi_d0 pc7 ------> dcmi_d1 pc8 ------> dcmi_d2 pc9 ------> dcmi_d3 pd3 ------> dcmi_d5 */ gpio_initstruct.pin = gpio_pin_4 | gpio_pin_5 | gpio_pin_6; gp...

Laravel change uri to lowercase -

you know laravel case sensitive. how can forced user used lowercase in address bar ? can change uri in middleware ? how ? i'm using laravel 5.1.10 you can't force user use lower or upper case in address bar. want keep in mind. case sensitive or not case sensitive depends on server , environment. in general windows machines case insensitive on other hand, linux case sensitive. lowercase way go or chasing bugs dog chasing tail. hope help.

google.appengine.api.user spring null error -

package controller; import java.io.ioexception; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; import javax.servlet.http.httpsession; import org.springframework.security.core.context.securitycontextholder; import org.springframework.stereotype.controller; import org.springframework.web.bind.annotation.requestmapping; import com.google.appengine.api.users.userservicefactory; import ro.mindit.configuration.userinfo; @controller public class samplesecuredcontroller { @requestmapping("/test") public string test(httpservletrequest request, httpservletresponse response) throws ioexception { com.google.appengine.api.users.userservice userservice = userservicefactory.getuserservice(); //response.sendredirect(userservice.createloginurl(request.getrequesturi())); system.out.println(userservice.getcurrentuser()); return "redirect:/login"; } } can tell me why nullpointerexce...

c# - Which one of these approaches to casting is the most effective? -

i have been wondering quite while now. if(something mytype){ var item = mytype; } or var item = mytype; if(item != null){ } the 2nd version var item = mytype; if (item != null) { ... } is better: one type conversion ( as ) not 2 ( is , as ). the 1st version (a bit modified ) can used struct not nullable : // can't put "as" struct, i.e "something int" if (something int) { int item = (int) something; // note changed type conversion ... }

c - Void pointers, type casting and possible code improvements -

considering code follows: void get_value_by_peek_name(json_object *json_obj, const char *peak_name, void **value) { json_object *value_obj; if (json_object_object_get_ex(json_obj, peak_name, &value_obj)) if (json_object_is_type(value_obj, json_type_double)) sscanf(json_object_to_json_string(value_obj), "%lf", *value); } this implementation, expected, generates warning: format ‘%lf’ expects argument of type ‘double *’, argument 3 has type ‘void *’ i looking suggestion better implement function and, of course, avoid warning above. elsewhere, considering code: double timestamp; void *holder; // other code... // response_obj initialized get_value_by_peek_name(response_obj, "timestamp", &holder); timestamp = *((double *) holder); printf("- timestamp: %lf\n", timestamp); is there way make code more elegant , without declaring explicitly void pointer holder using directly timestamp hold value? ...

javascript - Replace node's native domain module -

there's native node module called domain being deprecated. i'm interested in copying , running local version changes. i tried copy module source , require copy , error. assertion failed: (args[1]->isobject()), function setupdomainuse, file ../src/node.cc, line 950. abort trap: 6 here's i'm running: $ node -pe process.versions { http_parser: '2.5.0', node: '2.5.0', v8: '4.2.77.21', uv: '1.6.1', zlib: '1.2.8', ares: '1.10.1-dev', modules: '44', openssl: '1.0.2d' } how replace node's native domain module local 1 copied? you're using domain module on master branch, you're using io.js v2.5.0 should use module belonging version ( here ). after that, need comment out this line before load properly.

c# - xUnit Async Test in Callback -

this current test. succeeds, should obvious not do. how make test fail? [fact] public async task executecallback() { timer timer = new timer(); timer.elapsed += (sender, e) => { new myclassundertest((param) => { assert.null(param); assert.notnull(param); timer.stop(); }); }; timer.interval = 500; timer.start(); system.threading.thread.sleep(1000); } i want test inner logic of class (how executes provided action , parameters), , it's behavior when runs in eventhandler since tricky things threads. as mentioned timer event handler runs on different thread nunit test. thrown exception not caught nunit, test succeeds.

c# - Why the test outcome sometimes stays 'in progress' when I have saved 'passed'? -

here part of code giving me headache: testoutcome outcome = testoutcome.passed; run.addtestpoint(point, null); run.save(); itestcaseresult result = run.queryresults()[0]; result.outcome = outcome; result.save(); point.state = testpointstate.completed; point.save(); sometimes saves outcome 'passed', 'in progress'. 50/50, more or less. ideas? edit : looks doing toggle between 'in progress' , 'passed'. strange. problem solved! if ever encounter this, please add : result.state = testresultstate.completed; before save result.

php outputs sourcecode instead of running nginx -

Image
i have showing on site. lang function showing on web, not runned should run on site. server running nginx q: why doing that, , how can prevented? content of file: <? function lang($line) { $ci = & get_instance(); $languagevariable = explode(" ", $line); $outcome = ''; foreach($languagevariable $langline) { $outcome .= $ci->lang->line($langline); } return $outcome; } function langw($string, $var1 = false, $var2 = false, $var3 = false) { return sprintf(lang($string), ($var1 ? $var1 : ''), ($var2 ? $var2 : '')); } function langv($line, $var) { $ci = & get_instance(); return sprintf($ci->lang->line($line), $var); } make sure have: short_open_tag=on in php.ini, restart nginx server http://php.net/manual/en/ini.core.php#ini.short-open-tag if can't edit php.ini, can either replace <? <?php (not best..) or add following .htacces...

php - Error using chartJs on laravel project -

i trying use chartjs draw bar chart on laravel project have been getting error - "failed create chart: can't acquire context given item". have tried debugging , think looks okay. this js file $(document).ready(function () { $.ajax({ url: "{{url('properties','totaltaxpaidbylga')}}", method: "get", success: function(data) { console.log(data); var player = []; var score = []; for(var in data) { player.push("player " + data[i].playerid); score.push(data[i].score); } var chartdata = { labels: player, datasets : [ { label: 'player score', backgroundcolor: 'rgba(200, 200, 200, 0.75)', bordercolor: 'rgba(200, 200, 200, 0.75)', ...

algorithm - Optimization of FIS membership functions, via GA -

i trying optimize fis of ga, matlab optimization toolbox. code looks this: function errorr=fun3_2(x) name='eleni'; type='mamdani'; numinputs='8'; numoutputs='1'; % numrules='80'; andmethod='min'; ormethod='max'; impmethod='min'; aggmethod='max'; defuzzmethod='centroid'; a=newfis('eleni'); %inputs_______________input 1____________ a.input(1).name='arias'; a.input(1).range=[0 1]; a.input(1).mf(1).name='1'; a.input(1).mf(1).type='trimf'; a.input(1).mf(1).params=[x(1) x(2) x(3)]; a.input(1).mf(2).name='2'; a.input(1).mf(2).type='trimf'; a.input(1).mf(2).params=[x(4) x(5) x(6)]; a.input(1).mf(3).name='3'; a.input(1).mf(3).type='trimf'; a.input(1).mf(3).params=[x(7) x(8) x(9)]; .... ...and on, totally 8 inputs , 1 output of 10 mfs each. i insert linear inequalities correctly, as 0<x(1)<x(2)<x(3)<1 0<x(4)<x(5)<x...

vbscript - Reading and writing with Excel (very very strange) -

i have application supposed take inputted url , file name (aswell value due there being multiple documents save) , write values excel document. example | facebook.com | facebook | 3 | youtube.com | youtube | | google.com | google | the first url, second file name, , third number of documents (basically). at moment happens first 2 cells contain continuosly updating numbers , third contains "[object]" first hta vbs sub export dim url_1 ' url being saved excel dim filename_1 ' name file being saved dim fullpath ' path of file dim oexcel ' excel dim obook ' workbooks dim osheet ' worksheets dim iv ' interval value dim ic ' interval cap dim target ' target filepath 'sets interval cap ic = ic_ ' declares fso set fso = createobject("scripting.filesystemobject") ...

Android Cocos2d-x 3.7: how to get Application Context in cocos2d-x? -

i use android code cocos2dx call encountered problem. not call in android cocos2dx context, i'm not sure whether there problem following code, , following way need call in android , errors such calls occur . void admasterconvsdk::admasterinitial(std::string appid) { jnimethodinfo methodinfo; if (jnihelper::getstaticmethodinfo(methodinfo, "com/admaster/square/api/convmobisdk", "initial", "(landroid/content/context;ljava/lang/string;)v")) { jstring appid = methodinfo.env->newstringutf(appid.c_str()); jclass cl = methodinfo.env->findclass("org/cocos2dx/lib/cocos2dxactivity"); jmethodid methodcontext = methodinfo.env->getstaticmethodid(cl,"getcontext","()landroid/content/context"); jobject context = methodinfo.env->callstaticobjectmethod(cl,methodcontext); methodinfo.env->callstaticvoidmethod(methodinfo.classid,methodi...

php - Multiple Azure Virtual Machines on same Cloud Service -

i have cloud service on azure , on cloud service, have 2 vms . , have apache , php , mysql , phpmyadmin installed on both. both vms lie on same availability set well. if cloud service dns hello.cloudapp.net , access phpmyadmin going hello.cloudapp.net/phpmyadmin , create database, vm create database on? one of two, depending on whichever 1 load balancer decides send to. the problem having separate instance of mysql local each vm. instead, need create shared data context between 2 instances; mysql cluster looks promising.