Posts

Showing posts from March, 2013

as.h2o() in R to upload files to h2o environment takes a long time -

i using h2o carry out modelling, , having tuned model, used carry out lot of predictions approx 6bln predictions/rows, per prediction row needs 80 columns of data the dataset have broken down input dataset down in 500 x 12 million row chunks each relevant 80 columns of data. however upload data.table 12 million 80 columns h2o takes quite long time, , doing 500 times me taking prohibitively long time...i think because parsing object first before uploaded. the prediction part relatively quick in comparison.... are there suggestions speed part up? changing number of cores help? below reproducible example of issues... # load libraries library(h2o) library(data.table) # start h2o using cores... localh2o = h2o.init(nthreads=-1,max_mem_size="16g") # create test input dataset temp <- cj(v1=seq(20), v2=seq(7), v3=seq(24), v4=seq(60), v5=seq(60)) temp <- do.call(cbind,lapply(seq(16),function(y)...

java - Android compiles but crashes -

i trying develop first app. compiles , installs crashes when open it. here code public class mainactivity extends actionbaractivity implements onitemclicklistener { private listview listview; private drawerlayout drawerlayout; private actionbardrawertoggle drawerlistener; private linearlayout menu; private myadapter myadapter; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); listview=(listview)findviewbyid(r.id.listview); myadapter=new myadapter(this); listview.setonitemclicklistener(this); listview.setadapter(myadapter); drawerlayout=(drawerlayout)findviewbyid(r.id.drawerlayout); drawerlistener= new actionbardrawertoggle(this,drawerlayout,r.drawable.ic_ic_drawer,r.string.app_name, r.string.app_name){ @override public void ondrawerclosed(view drawerview) { toast.maketext(mainactivity.this, "ola", toa...

flash cs6 - How to format static text in actionscript 3.0 -

import flash.events.mouseevent; import flash.text.textformat; mytext.buttonmode = true; var myformat:textformat = new textformat; myformat.size = 24; mytext.settextformat(myformat); here mytext instance name of movieclip of static text. how format static text in flash cs6? settextformat() method of textfield class, not of movieclip class. should call method on textfield , possibly 1 in movieclip , named mytext . if wondering why not receive error calling method doesn't exist on movieclip : because movieclip dynamic class.

asp.net - Entity Framework : A referential integrity constraint violation occurred when I do EntityState.Modified -

i create website in asp.net mvc 4. it's been long have error : referential integrity constraint violation occurred. it's when tried update entry in db. when want buy product, need change user buy. i have 2 1 many relationship. edit user class : public class user { private string email, password, firstname, lastname; private adress shippingadress, billingadress; private bool isconnected; private list<product> products; //private list<auction> auctions; private long idshippinga, idbillinga; public user() { products = new list<product>(); } /* public list<auction> auctions { { return auctions; } set { auctions = value; } } public void addauction(auction auction) { if (auction != null) auctions.add(auction); }*/ public long idbillinga { { return idbillinga; } set { if (value < 0) ...

javascript - Drawing SVG element on top with smooth transitions -

i have page different svg elements react when hovering on them. when hovering, element increases in size, covering neighbouring elements. trouble of neighbours have been drawn later , won't covered. [ example ] i tried fix issue using appendchild() when hovering on make last drawn element, removes smooth transition effect set css. example: for (var = 0; < 20; i++) { (var n = 0; n < 5; n++) { var new_rect = document.getelementbyid("0").clonenode(true); new_rect.setattributens(null, "cx", * 20 + 10); new_rect.setattributens(null, "cy", n * 20 + 10); new_rect.setattributens(null, "id", + n); document.getelementbyid("maing").appendchild(new_rect); } } function expand(evt) { //evt.target.parentnode.appendchild(evt.target); evt.target.setattributens(null, "r", "25"); } function shrink(evt) { evt.target.setattributens(null, "r", "10...

angularjs - Angular: Select dropdown with ng-model-options setter getter set to true -

can show me example on how bind ng-options getter , setter model, plnker demo great. example on want accomplish: // can see item object 2 properties example: // {text: "hello", value: 10} setgetobject: function(value) { if (angular.isdefined(value)) { myobject = angular.copy(value); //copy incoming object } return ???? } <select class="form-control" name="rumfra" ng-model="gettersetter.setgetobject" ng-options="item item.text item in vm.configuration.form.room track item.value" ng-model-options=" {gettersetter: true }"> each time make new selection on dropdown set myobject new value dropdown not effected if return input element. a working example on how use select tag ng-options , ng-model-options="{settergetter= "true"}" appreciated :-) look @ numyx's example: http://plnkr.co/edit/sqjg8np7e9nb9okcd4hn?p=preview because working not objects. can...

windows - Copy work very well, while Move doesnt work at all. -

use file::copy; #variable directory work on $dir = "c:/projekty/perl/muzyka"; #variables used find mp3 files $dir_tmp = $dir."/*.mp3"; @files = glob( $dir_tmp ); #variable directory want create , put files $new_dir = "c:/projekty/perl/muzyka/new_dir"; #creating new directory mkdir ( $new_dir ) or print "mkdir problem"; till point allright. put loop: foreach( @pliki ) { copy( $_, $new_dir) or print "copy problem"; } or: foreach( @pliki ) { move( $_, $new_dir) or print "move problem"; } and problem is: copy works fine, move doesn't want job. works depends on modifications in code never in loop. simple code 1 line: move($a, $b); works perfectly. if use conditions or loops stops working if arguments (directories) seem ok (i checked them print function put in loop). why not working? there circumstances cause errors? copy , move documented set $! on error. it's check whether a...

Javascript arrays cannot equal each other? -

this question has answer here: how compare arrays in javascript? 37 answers i started with: "1:2".split(':') == ["1","2"]; // false then tried: [1,2] == [1,2]; // false and ultimately: [] == []; // false i've since found that: "1:2".split(':').tostring() == [1,2].tostring(); // true so i've solved initial issue (kind of) why can't arrays match each other? javascript arrays objects , can't use equality operator == understand if content of objects same. equality operator test if 2 object same instance (e.g. myobjvariable==myobjvariable , works null , undefined too). if need check if 2 array equals i'd recommend traverse both arrays , verify elements have same value (and 2 array have same length). regarding custom objects equality i'd build instead specific...

multithreading - Threading and Dropbox -

i'm developing application might use dropbox it's storage. my question is, can link folders between computers, more 1 person upload/download to/from same folder. do have worry threading? happens if while person downloading file, other person updating same file. dropbox lock file while 1 operation being done on it? if not, guess have handle in application correct? yes, have worry this. dropbox uses optimistic concurrency. every file has rev (revision) can reference when uploading file (e.g. via /files_put ). basic idea when download file, keep track of rev , , when upload file, pass rev parent_rev parameter. if file has been changed in meantime different user (via shared folder) or same user (via different device), rev won't match. happens dictated autorename parameter. if specify true , file renamed on conflict. if specify false , upload fail altogether, , app can decide do. essentially, can't stop users updating files simultaneously on multipl...

windows - How to determine whether a process handle is of the current process? -

i have handle process, might, or might not, handle of running process. following known handle object: the handle has process_terminate access right. the handle not pseudo-handle, i.e. not return value of getcurrentprocess . is there way know whether handle of current process? i thought using getprocessid , unfortunately fails access denied error, because handle doesn't have process_query_limited_information access right. if have sufficient access target process, can create new handle process_query_limited_information access right using duplicatehandle() . can use handle process id. unless process modifies own security permissions, should have (at least) process_query_limited_information access itself, if duplicating handle fails access denied error unlikely handle points process. if want make absolutely certain, can try opening handle process process id - if fails messing acl , bets off. :-)

jquery - Selectable optgroups in Select2 -

i want create multilevel select2 options indentation don't want use optgroup elements because want allow select main categories. there way style if select2? my raw html select looks this: <select class="js-select-multiple"> <option class="l1">option 1</option> <option class="l2">suboption 1</option> <option class="l2">suboption 2</option> <option class="l2">suboption 3</option> <option class="l1">option 2</option> ... </select> <script>$(".js-select-multiple").select2({maximumselectionlength: 5});</script> so without using select2 can add text-indent property .l2 class. seems select2 doesn't use classes used option, styling classes won't work. is there workaround that? you're correct in recognizing select2 not carry css classes <option> tags results list. has not explicitly t...

c++ - OpenGL framebuffer android without GL_OES_packed_depth_stencil (on Nexus 7 2012) -

how init framebuffer depth , stencil on device not support gl_oes_packed_depth_stencil (in case nexus 7 2012)? this not work: glgenrenderbuffers(1, &depthstencil); glbindrenderbuffer(gl_renderbuffer, depthstencil); glrenderbufferstorage(gl_renderbuffer, gl_depth24_stencil8_oes, width, height); glframebufferrenderbuffer(gl_framebuffer, gl_depth_attachment, gl_renderbuffer, depthstencil); glframebufferrenderbuffer(gl_framebuffer, gl_stencil_attachment, gl_renderbuffer, depthstencil); glenum status = glcheckframebufferstatus(gl_framebuffer); //... you create separate renderbuffers depth , stencil: gluint depthstencil[2]; glgenrenderbuffers(2, depthstencil); glbindrenderbuffer(gl_renderbuffer, depthstencil[0]); glrenderbufferstorage(gl_renderbuffer, gl_depth_component16, width, height); glbindrenderbuffer(gl_renderbuffer, depthstencil[1]); glrenderbufferstorage(gl_renderbuffer, gl_stencil_index8, width, height); glframebufferrenderbu...

Put variable into SQL Statement (Java/SQL) -

so have 2 tabels, student , klas_student described below. student create table if not exists studenten( studentenummer varchar(7) check (studentenummer ~'[0-9a-za-z]{7}'), } klas create table if not exists klas( student varchar(7) references studenten (studentenummer) on delete cascade not null, klas text not null references klas (naam_id) on delete cascade not null ); as can see in klas_student student references studentnumber in table studenten. in java need take studentenummer studenten en put in klas_student. to execute query , take studentenummer studenten. sql = "insert studenten " + "values ('1559335')"; statement2.executeupdate(sql); then want take value , : string studentnummer = result.getstring(1).tostring(); sqlstudentoklas = "insert klas " + "values (studentnummer)"; statement2.executeupdate(sqlstudentoklas); conn.commit(); however in sqlstudenttoklas, doesnt take studentnummer(result.getstring...

c# - Mouse left click and On-Screen-Keyboard -

i'm writing application using kinect windows v2 display , control mouse left hand. wrote method invoke mouse left click , works great. i have problem 1 action. if launch on-screen-keyboard, mentioned click method not working. outside osk windows it's still works perfect. know what's going on ? here's of code. public static void performleftclick() { input mousedowninput = new input(); mousedowninput.type = sendinputeventtype.inputmouse; mousedowninput.mkhi.mi.dwflags = mouseeventflags.mouseeventf_leftdown; sendinput(1, ref mousedowninput, marshal.sizeof(new input())); input mouseupinput = new input(); mouseupinput.type = sendinputeventtype.inputmouse; mouseupinput.mkhi.mi.dwflags = mouseeventflags.mouseeventf_leftup; sendinput(1, ref mouseupinput, marshal.sizeof(new input())); } private void showonscreenkeyboard(object sender, routedeventargs e) { var keyboardproccess = process.getprocessesbyname("osk"); if (key...

c# - WPF Send click through control -

i want send mouse click application behind control. have topmost transparent window , controls in it. able send click through of controls. i have tried setting property ishittestvisible="false" control, doesn´t work. doesn´t send click through control desktop example. i´ve tried solution proposed in question: how create semi transparent window in wpf allows mouse events pass through and works, make transparent controls, not window. how apply solution question single control, example ellipse? the solution: public static class windowsservices { const int ws_ex_transparent = 0x00000020; const int gwl_exstyle = (-20); [dllimport("user32.dll")] static extern int getwindowlong(intptr hwnd, int index); [dllimport("user32.dll")] static extern int setwindowlong(intptr hwnd, int index, int newstyle); public static void setwindowextransparent(intptr hwnd) { var extendedstyle = getwindowlong(hwnd, gwl_exstyle); setwindowlong(...

Item not being properly indexed in PHP array inside of for loop -

i have loop pulling attachments email using php's imap functions. works fine 1 attachment, unable pull more 1 attachment single mail. see code below - for ($i = 0; $i < $count; $i++) { $attachments[$i] = array( 'is_attachment' => false ); if ($email['structure']->parts[$i]->ifdparameters) { foreach ($email['structure']->parts[$i]->dparameters $object) { if (strtolower($object->attribute) == 'filename') { $attachments[$i]['is_attachment'] = true; $attachments[$i]['filename'] = $object->value; } } } if ($email['structure']->parts[$i]->ifparameters) { foreach ($email['structure']->parts[$i]->parameters $object) { if (strtolower($object->attribute) == 'name') { $attachments[$i]['is_attachment'] = true; $attachments[$i]['name'] = $object->value; } } } if ($attachments[...

python - How do I move a laser bullet in a top down shooter in a certain direction? -

i making game in pygame requires player defend earth aliens attacking it. player controlled arrow keys , spacebar used shoot. far working fine except lasers. when fire laser, wish them move in direction player facing. here lazer class: class lazer(pygame.sprite.sprite): def __init__(self): super(lazer, self).__init__() self.image = pygame.image.load('lazer.png') self.rect = self.image.get_rect() def update1(self): keyy = pygame.key.get_pressed() speed = 30 if keyy[pygame.k_up]: self.rect.y -= speed elif keyy[pygame.k_down]: self.rect.y += speed if keyy[pygame.k_right]: self.rect.x += speed elif keyy[pygame.k_left]: self.rect.x -= speed so far laser moves when player presses arrow key. if player stops pressing arrow key, laser stop moving , if player moves in different direction, laser move in direction. here full game code: while gameon...

vb.net - how to get current row index when reading DbDataReader in ADO.net -

i have excel sheet read code this public async function readrecordasync() task(of sellinglist) try dim sellings new sellinglist await conn.openasync() cmd = new oledbcommand() cmd.connection = conn cmd.commandtext = "select * [sheet1$]" dim reader = await cmd.executereaderasync() while reader.read() if checkemptyreader(reader) msgbox("first empty cell index = " & reader.depth) exit while end if dim x new buyableobject if not reader.isdbnull(0) x.name = reader.getstring(0) end if if not reader.isdbnull(1) x.soldcount = getintegervalue(reader(1).tostring) end if if not reader.isdbnull(2) x.sellingprice = getsinglevalue(reader(2).tostring) ...

php - Laravel 5.1.1 LTS: Incomplete Chunked Encoding -

i've seen lots of these reports, none regarding recent laravel 5.1.1 (lts). have started new app, , i'm receiving following error when requesting app.local/ : get http://app.local/ net::err_incomplete_chunked_encoding it takes on 5 seconds come conclusion. now, fresh installation - i've made following changes: use fallbackresource instead of mod_rewrite sending request index.php , and set application path /../name.application/bootstrap/autoload.php in index.php (moved app , config , etc name.application directory. i above error when sending request root of domain - app.local/ . there existing route this, , set return "hello" ( return response('hello') ). response displayed immediately, page continues load 5 seconds, , console throws error. if request /test , response snappy, , don't receive error. seemingly, laravel problem, , i'm not quite sure comes from. it's not .htaccess problem reverting changes makes no di...

java - Android Key or Browser Key for Place AutoComplete? -

i new android development , got stuck in whether use android key or browser key place autocomplete google place api. if can since on google place api documentation( https://developers.google.com/places/android/signup ) written that note: need android api key, not browser key. can use same api key google maps android api v2 apps , google places api android apps. but @ place( http://codetheory.in/google-place-api-autocomplete-service-in-android-application /) written places api doesn’t work android or ios api key please !!! if you're using web service, use browser key. if you're using android library, use android key.

Is there a testing framework that works with threads in Python? -

i understand question might closed, downvoted etc. nonetheless there's no better forum ask here goes. i have publisher in python in thread 1 , subscriber in thread 2. trying code integration tests publisher thread sends data enterprise bus , after delta time subscriber callback happens in thread 2. that's general pattern, , until first test completes don't move test 2. i have been investigating frameworks nothing seems have need. closest came tornado's asynctest http://tornado.readthedocs.org/en/latest/testing.html that's event driven , looking similar threads. i sure problem has been solved elegantly somewhere. if helps on python 2.7.

Connecting Android Studio Project to SVN Repository -

i want version control android studio project subversion. have created test android project in dev machine , have created remote svn repository. then, after configuring subversion settings instructed in connect android studio svn , have selected vcs->import version control->import subversion in order import project svn repository. the problem that, if files imported repository, project not connected it. in fact of project files listed "unversioned files". when make changes code , try commit it, says "no changes detected" reported in: no changes commit android studio svn . the same problem faced in android studio: subversion files marked unversioned solution proposed not working me. the (stupid) "solution" seems 1 proposed in article android studio , subversion , have import project subversion. delete local files , create new android project check out version control option!!! is there solution import android studio project , svn rep...

php - How to call varying urls in Magento -

what have in mage site is: echo "<div class='block-content'><ul>"; foreach($listeditems $optionid => $value) { echo "<li class='item'><a href=".mage::geturl()."catalogsearch/result/?item=".$optionid.">" . $value . "</a></li>"; } echo "</ul></div>"; but want echo matching url instead of list of search result items.

ruby on rails - mysql server not working -

i working on rails , using mysql database. working correctly , of sudden cannot connect database anymore. mysql config: default: &default adapter: mysql2 encoding: utf8 pool: 5 username: root password: root1214 socket: /var/run/mysqld/mysqld.sock when type mysql -u root -p , getting prompt saying enter password. though entered correct password getting following error. error 1045 (28000): access denied user 'root'@'localhost' (using password: yes).

jsf 2 - Redirecting to same page after showing the sucess message -

this question has answer here: how show faces message in redirected page 1 answer show facesmessage , reload page in jsf 2 answers i want redirect user same page success message, once user saved record in database. using jsf2 primefaces. managed bean in viewscope trying below code in save method. facesmessage message = new facesmessage(facesmessage.severity_info, "data added successfully","dataadded successfully"); facescontext.getcurrentinstance().addmessage(null, message); facescontext.getcurrentinstance().getexternalcontext().redirect("mypage.xhtml"); i able navigate page no success message displayed. suggestion on this.

java - JavaFx: can data binding (textfield) be used in production mode? -

i use java 8.0.45. have implemented first javafx application (very simple) data binding. however, biding user input-> pojo seems work bugs. i've checked 200 times. entered new values in text fields , after checked model values. same code, same behaviour. works fine (in cases - 80-90%) model value!=textfield value. i've noticed following. data binding text field works,works , @ point of time binding stops working , new values textfield not passed model. nor exceptions. nor warnings. nothing. binding doesn't work. i have 4 textfiled created via fxml. 2 string model type. 1 integer. 1 bigdecimal. problem happens these fields(sometimes one, several). number fields can have null values, use example propertyobject not integerproperty (people openjfx advised so). so javafx bug or what? p.s. use felix osgi, weld cdi, , pax - don't know if matters... my code following: dto - pojo model public class task { private string name; private integer order; ...

WPF C#-multiple user privileges -

i want display different menu different users using c# wpf. also have multiple login oracle database. i want control user privileges through c#. aravindhan – first need have in place authentication , authorization process in place. so, how authentication: http://blog.magnusmontin.net/2013/03/24/custom-authorization-in-wpf/ basically, need implement interfaces described on link above .net provides you. when on iauthenticationservice ->authenticateuser method, have provide oracle implementation that. the implementation similar snippet below: public user authenticateuser(string username, string cleartextpassword){ var list<internaluserdata> _users = getuserslist(); internaluserdata userdata = _users.firstordefault(u => u.username.equals(username) && u.hashedpassword.equals(calculatehash(cleartextpassword, u.username))); if (userdata == null) throw new unauthorizedaccessexception(...

python - AttributeError error while trying to split an array of numbers -

i created array arr1 = [25, 26] . when try split array on basis on comma using statement array1 = arr1.split(',') , getting error: traceback (most recent call last): file "<stdin>", line 1, in <module> array1 = arr1.split(',') attributeerror: 'list' object has no attribute 'split' where getting wrong? arr1 = [25,26] first arr1 not array list object. second split not part list 's attributes can't use split function list object. you can see list attributes using dir built-in function. >>> dir([]) ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__delslice__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getslice__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', ...

Comparing values inside a 2D Array in java -

i'm working on question need compare values inside 2d array in java. example: int n = 2, c = 2; int [][] arr = new int[n][c]; system.out.println("enter values 2d array: "); for(int i=0; i<n;i++) { (int j=0;j<c;j++) { arr[i][j]=in.nextint(); } } so in above code, user enters values inside 2d array. want compare if arr[i]>=0 , arr[j]>=0 separately , if yes, need perform other operation on this. but i'm not able way. example: for(int i=0; i<n;i++) { (int j=0;j<c;j++) { if (arr[i]>=0 && arr[j]>=0) { //some operation// } } } kindly suggest me way operation - comparing values individually. thank you. arr1[i] array of integers, not integer, can't compare integer. arr1[i][j] int , , can compared integers. if (arr[i][j]>=0) valid syntax, it's not clear if that's want.

javascript - jQuery AJAX/getJSON unexpected token error -

when trying json file server so: function getjson(completedfunction) { $.ajax({ type: 'get', url: 'export.json', datatype: 'json', success: function(data) { treedata = data; console.log(treedata); }, error: function(data, textstatus, error) { console.log("getjson failed, status: " + textstatus + ", error: " + error); }, complete: function(data) { completedfunction(); } }); } chrome shows error getjson failed, status: parsererror, error: syntaxerror: unexpected token c , firefox says getjson failed, status: parsererror, error: syntaxerror: json.parse: expected double-quoted property name @ line 34 column 49 of json data . not seem matter if put few lines above line 34 moving down, error stays there. my json data has following form , drives d3 tree: [{"id": 0, "name": "some organization", "children...

c++ - Fixing DCLP only with volatile -

i reading article " c++ , perils of double-checked locking " explains problems in dclp. the second part of article (where link forwards) shows how try , solve dclp merely c/c++ volatile (which know, impossible). in article writers explain how (last example number 11), write: unfortunately, nothing address first problem—c++'s abstract machine single threaded, , c++ compilers may choose generate thread-unsafe code source mentioned, anyway. otherwise, lost optimization opportunities lead big efficiency hit. after this, we're square one. wait, there's more—more processors. which means (if understand correctly), doesn't matter how use volatile, won't work because " c++'s abstract machine single threaded, , c++ compilers may choose generate thread-unsafe code source mentioned " but mean "c++'s abstract machine single threaded"?! why above examples of volatiles won't prevent reordering? thanks! ...

mysql query returning double rows -

i using standard apache2 lamp configuration (mysql , php5), , utf8 encoding. i have set 4 tables. the first 1 named articles , has 6 columns: id int(11) auto_increment primary key, title varchar(1000), posted (timestamp) author_id int(11), extract text, body text the second 1 named authors id int(11) auto increment primary key, name varchar(100), img varchar(100), bio text the third 1 named categories id int(2) auto_increment primary key, cat_name varchar(100) and fourth 1 named article_categories id int(2) auto_increment primary key, article_id int(11), category_id int(2) now want write mysql query find title, author name , cat_name of article. far i've come this, , returns 10 rows, categories i've set up. (i've set 1 article 2 categories, , 5 categories in categories table). this query: select articles.title, authors.name, categories.cat_name articles, authors, categories, article_categories title '%introduction%'; and result: +--...

c# Intellisense VS2013 tooltip doesn't show XML comments (i try all) -

Image
i read questions intellisense problems intellisense doesn't work. visual studio ultimate 2013 i don't use extension resharper, ghostdoc , on all xml documentation files custom , not custom classes inside starter project's /bin folder . ( build -> generate xml doc on ) i have all documentations browsable via object browsers intellisense doesn't show tooltip information . net classes /ef/identity intellisense shows tooltip information summary custom classes doesn't show parameters / returns etc.. tools -> options -> text editor -> c# -> params info , auto list members checked so, don't know mistake :/ if know appreciate much. time i noticed same today, believe parameters description should apear when start typing parameters (when open first bracket, not when start typing method name). example: type "checktipologia(" - parameter should visible in intellisense. btw: practice name methods pascalcas...

android - how to call RecyclerView in the first fragment of the navigation drawer? I've followed a tutorial by slidenerd but getting one error -

this java file of fragment wish insert recycler view. please dont worry package name deleted reasons. import android.app.activity; import android.os.bundle; import android.support.v4.app.fragment; import android.support.v7.widget.linearlayoutmanager; import android.support.v7.widget.recyclerview; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import java.util.arraylist; import java.util.list; public class dashboard extends fragment { private recyclerview recyclerview; private recycleradapter adapter; /** * returns new instance of fragment given section number. */ public static dashboard newinstance() { dashboard fragment = new dashboard(); return fragment; } public dashboard () { } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview = inflater.inflate(r.layout.a...

xcode - Redundant conformance error message Swift 2 -

i updated project swift 2, , received bunch of redundant conformance of xxx protocol yyy . happens (or always) when class conforms customstringconvertible . place equatable . class graphfeaturenumbersetrange: graphfeature, customstringconvertible { // <--- error here ... } i suspect don't need explicitly conform protocol when implement var description: string { } , or whatever methods protocol requires. should follow fixit instructions , remove these? swift automatically infer conformance if class implements protocol's methods? you'll error message in xcode 7 (swift 2) if subclass declares conformance protocol inherited superclass. example: class myclass : customstringconvertible { var description: string { return "myclass" } } class subclass : myclass, customstringconvertible { override var description: string { return "subclass" } } the error log shows: main.swift:10:27: error: redundant conformance of 'subclass...

ios - Getting warning message while using PopoverController on iPad -

i have 2 view controllers – aviewcontroller , bviewcontroller. bviewcontroller's view used aviewcontroller's subview: bviewcontroller *bviewcontroller = [mainstoryboard instantiateviewcontrollerwithidentifier:@"basic"]; [self.view addsubview: bviewcontroller.view]; ...so can display bviewcontroller's data on aviewcontroller handle data in bviewcontroller. in bviewcontroller use uipopovercontroller when press button on it, displaying this: _popovercontroller = [[uipopovercontroller alloc] initwithcontentviewcontroller:_popcontentview]; [_popovercontroller presentpopoverfromrect:sender.frame inview:sender.superview permittedarrowdirections:uipopoverarrowdirectiondown animated:yes]; i'm getting warning message: presenting view controllers on detached view controllers discouraged how can resolve problem? since showing uipopovercontroller in subview . show uipopovercontroller in viewcontroller .

ios - ios8.3 bluetooth lost connection every 30s -

recently, develop ble app in ios8.3. but, found terrible question. when connect ble device iphone, every 30s, connection lost. after restart iphone, problem disappear. who maybe explain this? thank all. here answer try switching airplane mode on 30 seconds, turn off , try connecting again. try holding down home button , sleep/wake button until device restarts. turn router off 30 seconds , switch on again. go settings > general > reset > reset network settings , setup wi-fi, bluetooth again. try chaining channel on router , check rest of settings. make sure router firmware date. try factory reset of iphone.

basex - How to find the lowest common ancestor of two nodes in XQuery? -

suppose input xml <root> <entry> <title>test</title> <author>me</author> </entry> </root> i find lowest common ancestor of title , author . tried following code in basex: let $p := doc('t.xq')//title, $q := doc('t.xq')//author, $cla := ($p/ancestor-or-self::node() intersect $q/ancestor-or-self::node()) return $cla but returns nothing (blank output). your code works totally fine me, apart returning all common ancestors. the last common ancestor since they're returned in document order , last common ancestor must last node, extend [last()] predicate. declare context item := document { <root> <entry> <title>test</title> <author>me</author> </entry> </root> }; let $p := //title, $q := //author, $cla := ($p/ancestor-or-self::node() intersect $q/ancestor-or-self::node())[last()] return $...

Python hashlib MD5 digest of any UNC file always yields same hash -

the below code shows 3 files on unc share hosted on machine have same hash. shows local files have different hashes. why be? feel there unc consideration don't know about. python 2.7.5 (default, may 15 2013, 22:44:16) [msc v.1500 64 bit (amd64)] on win32 type "help", "copyright", "credits" or "license" more information. >>> import hashlib >>> fn_a = '\\\\some.host.com\\shares\\folder1\\file_a' >>> fn_b = '\\\\some.host.com\\shares\\folder1\\file_b' >>> fn_c = '\\\\some.host.com\\shares\\folder2\\file_c' >>> fn_d = 'e:\\file_d' >>> fn_e = 'e:\\file_e' >>> fn_f = 'e:\\folder3\\file_f' >>> f_a = open(fn_a, 'r') >>> f_b = open(fn_b, 'r') >>> f_c = open(fn_c, 'r') >>> f_d = open(fn_d, 'r') >>> f_e = open(fn_e, 'r') >>> f_f = open(fn_f, ...