Posts

Showing posts from January, 2015

haskell - What is practical use of monoids? -

haskell - What is practical use of monoids? - i'm reading learn haskell , i've covered applicative , i'm on monoids. have no problem understanding both, although found applicative useful in practice , monoid isn't quite so. think don't understand haskell. first, speaking of applicative , creates uniform syntax perform various actions on 'containers'. can utilize normal functions perform actions on maybe , lists, io (should have said monads? don't know monads yet), functions: λ> :m + control.applicative λ> (+) <$> (just 10) <*> (just 13) 23 λ> (+) <$> [1..5] <*> [1..5] [2,3,4,5,6,3,4,5,6,7,4,5,6,7,8,5,6,7,8,9,6,7,8,9,10] λ> (++) <$> getline <*> getline 1 line , 1 "one line , one" λ> (+) <$> (* 7) <*> (+ 7) $ 10 87 so applicative abstraction. think can live without helps express ideas mode , that's fine. now, let's take @ monoid . abstraction , pretty simple

c# - BufferedStream in WinRT? -

c# - BufferedStream in WinRT? - is there equivalent of system.io.bufferedstream class winrt? class isn't available, there way accomplish same behavior? no, can utilize of windows runtime streams asstream... extension methods. create "wrapper" streams contain internal buffer, , can set size. refer stream performance in c# , visual basic section of access file scheme efficiently msdn document. c# stream windows-runtime bufferedstream

ios - UISplitViewController presentsWithGesture = YES not working -

ios - UISplitViewController presentsWithGesture = YES not working - in appdelegate in application:didfinishlaunchingwithoptions: instantiate uisplitviewcontroller next code: popmenuviewcontroller *menuvc = [[popmenuviewcontroller alloc] initwithstyle:uitableviewstyleplain]; uinavigationcontroller *menunavcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:menuvc]; popmenudetailviewcontroller *detailvc = [[popmenudetailviewcontroller alloc] initwithnibname:@"popmenudetailviewcontroller" bundle:nil]; uinavigationcontroller *detailnavcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:detailvc]; menuvc.detailviewcontroller = detailvc; splitviewcontroller = [[uisplitviewcontroller alloc] init]; splitviewcontroller.viewcontrollers = @[menunavcontroller, detailnavcontroller]; splitviewcontroller.presentswithgesture = yes; splitviewcontroller.delegate = self; self.window.rootviewcontroller = splitviewcontroller; but, in p

Types of NETEZZA Planners -

Types of NETEZZA Planners - what types of planners utilize in netezza , use? eg: facteral_planner can explain or please provide link know this. i found an unofficial blog post mentions: the fact relationship (factrel) planner, the snowflake planner, the star planner. here's link 1 document entitled determining fact relations fact relation planner , snowflake planner ibm website won't allow me view after logging in client id. may have more luck. title suggests factrel planner uses 1 algorithm (absolute table size) guessing fact tables while snowflake planner uses different method (size relative other tables). i can't find relevant snowflake planner or star planner in of official documents or training documents have. searches snowflake or star homecoming things schemas rather planners. netezza

jquery - Transform-Style preserve-3d in internet explorer CSS not working -

jquery - Transform-Style preserve-3d in internet explorer CSS not working - i got website working in opera chrome , firefox gets messed preserve-3d feature in net explorer. is there way prepare net explorer css code , leave other browsers code right now? i hope thats possible. css: .back img{ max-width: 90%; height: auto; margin: 1em; overflow: hidden; } .front{ margin-top: 0.2em; height: 100%; width: 100%; line-height: 1.2; margin-left: 0.2em; margin-right: 0.2em; } /*container flip*/ /* flip pane when clicked */ .flip .flipper, .flip-container.hover .flipper, .flip-container.flip .flipper { transform: rotatey(180deg); -ms-transform: rotatey(180deg); } /* flip speed goes here */ .flipper { transition: 0.8s; transform-style: preserve-3d; } /* hide of pane during swap */ .front, .back { backface-visibility: hidden; top: 0; left: 0; } /* front end pane

Conversion of a Bitmap to Pixel Array for Microsoft OCR C# -

Conversion of a Bitmap to Pixel Array for Microsoft OCR C# - i'm working microsoft's ocr library , having problems converting bitmapimage pixel array. i'm making application windows phone 8, , writeablebitmap.pixelbuffer.toarray() isn't alternative have static function that'll alter normal bitmapimage byte array feed ocr engine. well, every time feed in application crashes. what's wrong here? here static class bitmap converter public static class bytearraychange { public static byte[] converttobytes(this bitmapimage bitmapimage) { byte[] info = null; using (memorystream stream = new memorystream()) { writeablebitmap wbitmap = new writeablebitmap(bitmapimage); wbitmap.savejpeg(stream, wbitmap.pixelwidth, wbitmap.pixelheight, 0, 100); stream.seek(0, seekorigin.begin); info = stream.getbuffer(); } hom

excel - Auto-fill the date in a cell, when the user enters information in an adjacent cell -

excel - Auto-fill the date in a cell, when the user enters information in an adjacent cell - i have spread sheet, people can come in project updates , date of update. happening people forgetting date notes. there way have date cell autopoplute current/date of entry? i assuming if function it? this event macro place date in column b if value entered in column a. macro should installed in worksheet code area: private sub worksheet_change(byval target range) dim range, b range, inte range, r range set = range("a:a") set inte = intersect(a, target) if inte nil exit sub application.enableevents = false each r in inte r.offset(0, 1).value = date next r application.enableevents = true end sub because worksheet code, easy install , automatic use: right-click tab name near bottom of excel window select view code - brings vbe window paste stuff in , close vbe window if have concerns, first seek on trial wo

PHP what if continue 2 and break both in switch case statement -

PHP what if continue 2 and break both in switch case statement - i new php. saw below code online, comes go on 2 , break in switch case statement. mean? foreach ( $elements &$element ) { switch ($element['type']) { case : if (condition1) go on 2; break; case b : if (condition2) go on 2; break; } //remaining code here in loop outside switch statement } from php.net:continue: continue accepts optional numeric argument tells how many levels of enclosing loops should skip end of. default value 1, skipping end of current loop. php.net:switch if have switch within loop , wish go on next iteration of outer loop, utilize go on 2. php continues execute statements until end of switch block, or firs

java - How to save a SparseBooleanArray using SharedPreferences? Or any other alternative? -

java - How to save a SparseBooleanArray using SharedPreferences? Or any other alternative? - i'd save sparsebooleanarray using either sharedpreferences, or else, that's more preferred. i've tried using http://stackoverflow.com/a/16711258/2530836, everytime activity created, bundle re-initialized, , bundle.getparcelable() returns null. i'm sure there workaround this, haven't arrived @ despite few hours of brainstorming. also, if there isn't, utilize sharedpreferences? here's code: public class contactactivity extends activity implements adapterview.onitemclicklistener { list<string> name1 = new arraylist<string>(); list<string> phno1 = new arraylist<string>(); arraylist<string> exceptions = new arraylist<string>(); myadapter adapter; button select; bundle bundle = new bundle(); context contactactivitycontext; sharedpreferences prefs; sharedpreferences.editor editor; @

parse.com - Progress Block runs too many times - swift -

parse.com - Progress Block runs too many times - swift - i using block bring in uimages parse. for object in objects { allow thumbnail = object["staffpic"] pffile thumbnail.getdatainbackgroundwithblock({ (imagedata: nsdata!, error: nserror!) -> void in if (error == nil) { allow image = uiimage(data:imagedata) } }, progressblock: {(percentdone: cint) -> void in self.logoimages.append(self.image) }) } problem is, runs progressblock 6 times (if there 6 images in query). need run progressblock 1 time when done. any ideas ? the progressblock of pffile 's getdatainbackgroundwithblock:progressblock: used progress of individual files beingness downloaded, not way know when downloads have completed. called more 6 times when downloading single file. shouldn't appending self.image self.logoimages there, should done in result block after create image imagedata . for objec

c++ - How to read input from header file? -

c++ - How to read input from header file? - i have header file abc.h //abc.h unsigned int *get(void) { static unsigned int input[] = { 1, 2, 2, 4, 5, 6, 7 }; homecoming input; } now, want read input(from header file,not text file) main cpp file xyz.cpp i thinking of using array access these elements,but don't think work. int arr[6]; arr=get(); the first element number of test cases n,the sec , 3rd element dimensions of 2-d array , rest of elements values of 2-d array.so need input value of n,rows,columns , values 2d array arr[rows][columns] any ideas on how can accomplish this? edit: can't figure out why question getting downvoted. agree not implementation,but have been given input header file , can read info through header file!! if able compile programm file, not need read anything. array , values compiled programm , can access them right in place your xyz.cpp file should like: #include "abc.h"

javascript - On change select value update href link value -

javascript - On change select value update href link value - i have select below. below got link current eid value fixed session value. require alter dynamically when select eid value. know in getmlist function can value how update portion of codes window.open('addadselect.php?eid=' such select eid updated accordingly. <select class='select' id='eid' name='eid' onchange='getmlist(this.value)'> </select> <tr> <td> </td> <td> <a href='#' onclick="window.open('addadselect.php?eid=<?php echo $_session['eid']; ?>', 'ads','width=500, height=750,scrollbars=yes')">select list</a> </td> </tr> i go approach. alter link html one: class="lang-html prettyprint-override"> <a href="#" id="link" data

Pandas : Python how to do index Groupby with replicates -

Pandas : Python how to do index Groupby with replicates - i have dataframe similar this: list1 = [4656, 5455, 4545, 6992, 4233, 4596, 4699, 4899, 7896, 4526, 4872, 6952] list2 = [4466, 4899, 4554, 4771, 1477, 1445, 4523, 1456, 3695, 6258, 1452, 4878] index1= ['a50_c1','a50_c2','a50_i1','a50_i2','a50_n1','a50_n2','a60_c1','a60_c2','a60_i1','a60_i2','a60_n1','a60_n2'] s1 = pd.series(list1, index=index1, name='list1') s2 = pd.series(list2, index=index1, name='list2') pd.concat([s1, s2], axis=1) here looks like: list1 list2 test a50_c1 4656 4466 a50_c2 5455 4899 a50_i1 4545 4554 a50_i2 6992 4771 a50_n1 4233 1477 a50_n2 4596 1445 a60_c1 4699 4523 a60_c2 4899 1456 a60_i1 7896 3695 a60_i2 4526 6258 a60_n1 4872 1452 a60_n2 6952 4878 i create groupby index (test column) i'm usi

sql - MySQL UPDATE and DELETE Conundrum -

sql - MySQL UPDATE and DELETE Conundrum - i've got table 2 column: applicationid , studentid . want update applicationid new value applicationid equal old value , studentid not equal ( studentid applicationid equal new value). table looks this, , want update 2222222222222 applicationid 1111111111111, not always: --applicationid-- --studentid-- --1111111111111-- --111111111-- // right here! --1111111111111-- --555555555-- --2222222222222-- --666666666-- // here want update application id 1111111111111 --2222222222222-- --111111111-- // want delete row, because update result exists! ^^ --2222222222222-- --777777777-- // want row updated. this query i've got, update applicationid new value, if result exists: update students_applications set applicationid = 1111111111111 applicationid = 2222222222222 any thoughts? thanks in advance. something this? delete table studentid = '111111111' , applicationid <> '111111111111111'

How to write java RMI callbacks or RMI Listener or bidirectional RMI -

How to write java RMI callbacks or RMI Listener or bidirectional RMI - i writing rmi application. i able perform rmi. info transferring between client , server via rmi. client should receive/updates server side data. is possible have listener can transport or notify info updates/modification server clients. mean whenever data's updated/modified @ server side,client should automatically updated. please allow me know, if there exist rmi phone call listener can used task. also, security standards followed while performing rmi? how can update server side object via client? if need update server side instance, can update using client? please guide me accomplish this. an rmi callback no different rmi server object, except exported client instead of server. however it's infeasible architecture due client-side firewalls. , using remote callback listener has major overheads create typically infeasible within lan. don't want this. the lastly part

mysql - Explode prevsiouly rolled up data in SQL -

mysql - Explode prevsiouly rolled up data in SQL - i have info follows: product quantity 3 b 2 this info been rolled @ product level. assume there 2 columns of now. i want output follows: product quantity 1 1 1 b 1 b 1 you utilize trick this: select product, 1 quantity products inner bring together ( select 1 q union select 2 union select 2 union select 3 union select 3 union select 3 ) quantities on products.quantity = quantities.q of course, query limited quantity of 3, can add together more quantities subquery if of limited amount. mysql

javascript - google map api with street view in infowindow not working -

javascript - google map api with street view in infowindow not working - in link on bottom set google map, have problem because when i'm clicking on marker, take me lastly info localization string. http://bit.ly/1tyvidz can help me ? you need 1 var infowindow. should not declared within for(). notice: there can 1 id="content" (id unique). here how think it: when client clicks on marker, temporarily store marker var currentmarker; open infowindow. triggers infowindow.domready . when dom of infowindow ready, create new var pano, , give position of currentmarker (both position of window & coordinates of panoramic view). (notice other scripters: requires 'marker.png' in same folder index.php) code: <!doctype html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <meta charset="utf-8"> <title>complex icons</title>

Android: Check if file already exists in MediaStore -

Android: Check if file already exists in MediaStore - i'm storing image in media store (to enable sharing) using code below: public static uri storeinmediastore(context context, bitmap bitmap, string title) { contentvalues values = new contentvalues(); values.put(images.media.title, title); values.put(images.media.bucket_id, "xxx"); values.put(images.media.description, "shared via xxx"); values.put(images.media.mime_type, "image/jpeg"); uri uri = context.getcontentresolver().insert(media.external_content_uri, values); outputstream outstream; seek { outstream = context.getcontentresolver().openoutputstream(uri); bitmap.compress(bitmap.compressformat.jpeg, 70, outstream); outstream.close(); } grab (filenotfoundexception e) { } grab (ioexception e) { } homecoming uri; } which found in stackoverflow. code works problem is, every time user clicks share button, store new

scheduler - Hadoop YARN Default schedular -

scheduler - Hadoop YARN Default schedular - does hadoop yarn have default scheduler ? wondering if yarn.resourcemanager.scheduler.class not set in conf/yarn-site.xml? yarn-defualt.xml specifies value of property: yarn.resourcemanager.scheduler.class = org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.capacityscheduler. yarn-default.xml hence, if not specify scheduler property in yarn-site.xml capacityscheduler used default, default scheduler yarn

android - How to notify my main activity, that thread has finihed? -

android - How to notify my main activity, that thread has finihed? - i need create simple thing: from app have create photo, send server (in background) , show notification after sending. works, have wait end of sending file - activity photographic camera closing after that. don't want wait, want main activity right after taking image (but upload still going in thread, , send notification when finishes). the problem: don't know how allow know main activity, thread has finished uploading of photo. maybe passing context or handler photographic camera activity help, can't putextra() . any suggestions? some fragments of code: in mainactivity.java : intent intent = new intent(this, camera.class); startactivityforresult(intent, constants.requestcode_camera); in camera.java: @override protected void oncreate(bundle savedinstancestate) { //(...) intent intent = new intent(mediastore.action_image_capture); intent.putextra(mediastore.extra

c++ - How to parse a user's input and store each individual character as a string -

c++ - How to parse a user's input and store each individual character as a string - okay i'm working calculator programme takes in user input(ex. "(3+(4+12))"), , need parse user's input , store in array of strings having problem doing so. code this void parseinput(string input) { vector <string> input_vector; for(int = 0; < input.size(); ++i) { if(isdigit(input.at(i)) == 0 && isdigit(input.at(i + 1)) == 0) { ++i; input_vector.push_back((input.at(i) + input.at(i+1))); } else { input_vector.push_back(input.at(i)); } } for(int = 0; < input_vector.size(); ++i) { cout << endl << input_vector[i]; } } i know problem coming trying add together char vector of strings, how each char in string , maintain string store vector. or there improve way parse out?? edit okay having problem problems come 12 splitting 2 separate chars "1 * 2" how go represents 12 , doesn&

sqlite - Python SQlite3 syntax error - cant figure out whats wrong -

sqlite - Python SQlite3 syntax error - cant figure out whats wrong - i have variation of code below i've re-written several times , same error. operationalerror: near ".": syntax error googled , removed primary key , checked field names started lower case letter , had no spaces. i'm finish beginner sqlite help much appreciated. etf = {'': '1', '#_of_holdings': '31', '%_in_top_10': '46.32%', '1_week': '-2.14%', '1_year': '3.86%', '200-day': '10.53%', '3_year': '39.32%', '4_week': '-6.65%', '5_year': 'n/a', 'annual_dividend_rate': '$0.18', 'annual_dividend_yield_%': '0.49%', 'assets': '13770', 'avg._vol': '4233', 'beta': '0.99', 'commission_free': 'not available', 'concentration': 'c', 'dividend': 

angularjs - $rootScope.$broadcast vs. $scope.$emit -

angularjs - $rootScope.$broadcast vs. $scope.$emit - now performance difference between $broadcast , $emit has been eliminated, there reason prefer $scope.$emit $rootscope.$broadcast ? they different, yes. $emit restricted scope hierarchy (upwards) - may good, if fits design, seems me rather arbitrary restriction. $rootscope.$broadcast works across choose hear event, more sensible restriction in mind. am missing something? edit: to clarify in response answer, direction of dispatch not issue i'm after. $scope.$emit dispatches event upwards, , $scope.$broadcast - downwards. why not utilize $rootscope.$broadcast reach intended listeners? $rootscope.$emit lets other $rootscope listeners grab it. when don't want every $scope it. high level communication. think of adults talking each other in room kids can't hear them. $rootscope.$broadcast method lets pretty much hear it. equivalent of parents yelling dinner ready in house hears it. $sc

jquery - How to check what button is clicked in this case -

jquery - How to check what button is clicked in this case - i have html (generated dynamically) <button type="button" class="btn bluish savepopup t1">save changes</button> <button type="button" class="btn bluish savepopup t2">save changes</button> <button type="button" class="btn bluish savepopup t3">save changes</button> $(document).on("click", ".savepopup", function (e) { var tvalue= $(this).attr('class'); }); i need set status in javascript if(tvalue=='t1') { } else if(tvalue=='t2') { } else if(tvalue=='t3') { } http://jsfiddle.net/vz58n67r/ could please help me . thank much . this should trick: $(document).on("click", ".savepopup", function (e){ e.preventdefault(); if($(this).hasclass("t1")){ } else if($(this).hasclass("t2")) { } else i

r - Combine N matrices using loop funciton -

r - Combine N matrices using loop funciton - i have problem in combining 90 matrices single matrix using loop function. created matrix called "col", , created remaining 89 matrices using code below for (k in 1:89){ col[k,]<-row colk<-col } the dimension of col 90x4 . , since colk created replacing first k rows of col (0,0,0,0) . i.e drop first k rows. now want combine combine these 90 matrices single matrix of dimension 90x360 . code using is col0<-col for(k in 0:89) { matrixreview<-cbind(colk) } dim(matrixreview) ## [1] 90 4 however, can see, dimension of matrixreview 90x4 rather 90x360. there problem when utilize loop. since new r, don't know how solve problem. can give me help? in advance. r matrix

Why does the gsub function in R doesn't work on '.' operator? -

Why does the gsub function in R doesn't work on '.' operator? - i have array named myfile has dates in character format. eg - "2014.01.29" "2014.02.02" "2014.01.09" "2014.01.23" "2014.01.09" "2014.01.29" now, want replace '.' operator '-'. want "2014.01.29" "2014-01-29". when utilize code gsub('.' , '-' , myfile[1]) i output '----------'. command works absolutely normal when replace '.' in gsub else. help appreciated. you need escape . can done either putting in [.] or \\. . gsub('[.]', '-', myfile[1]) or gsub('\\.', '-', myfile[1]) r gsub

xml - JAXB - marshal with java comments -

xml - JAXB - marshal with java comments - i new jaxb , origin marshaling simple java files hello, world! . i want marshal whole file, comments lines placed this: /* * comment */ //another comment and them in xml in comment block: <!-- comment --> <!-- comment --> is there way marshal java files comments? there few hurdles overcome utilize case: the comments aren't stored in byte code class, need create them available else. the jaxb api doesn't provide way map content node. that beingness said, below approach may work using: stax jaxb , leveraging marshaller.listener . java model customer import javax.xml.bind.annotation.*; @xmlrootelement @xmltype(proporder={"name", "address"}) @xmlaccessortype(xmlaccesstype.field) public class client { private string name; private address address; public customer() { } public customer(string name, address address) { this.name = name;

EXCEPTION_ACCESS_VIOLATION by Java when installing MATLAB -

EXCEPTION_ACCESS_VIOLATION by Java when installing MATLAB - this total error message returned java run time environment when tried install matlab: # fatal error has been detected java runtime environment: # exception_access_violation (0xc0000005) @ pc=0x00000000776108c5, pid=5616, tid=7436 # jre version: 6.0_17-b04 # java vm: java hotspot(tm) 64-bit server vm (14.3-b01 mixed mode windows-amd64 ) # problematic frame: # c [ntdll.dll+0x508c5] --------------- t h r e d --------------- current thread (0x0000000000843000): javathread "main" [_thread_in_java, id=7436, stack(0x0000000000030000,0x0000000000130000)] siginfo: exceptioncode=0xc0000005, reading address 0xffffffffffffffff os: windows vista build 6000 cpu:total 2 (8 cores per cpu, 2 threads per core) family 6 model 42 stepping 7, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, ht memory: 4k page, physical 4092272k(1915924k free), swap 8182680k(3

svg - How to get group element render position? -

svg - How to get group element render position? - refer code below, position of bounding box not actual render position of grouping of elements. the grouping element can used build complicated unit tank / ship cannons. , grouping element doesn't have x or y property help move inner elements have utilize transform move tank / ship. however, realized when translate group, bounding box never reflect real render position more, 1 have thought how actual render position of group? http://jsfiddle.net/k4uhwlj4/ var root = document.createelementns("http://www.w3.org/2000/svg", "svg"); root.style.width = '500px'; root.style.height = '500px'; document.body.appendchild(root); var g = document.createelementns("http://www.w3.org/2000/svg", "g"); g.setattributens(null, 'transform', 'translate(50, 50)'); root.appendchild(g); var r = document.createelementns("http://www.w3.org/2000/svg", &q

c - How to go all reference of a text in whole project using vim -

c - How to go all reference of a text in whole project using vim - i know simple question , there huge source of info not able find solution question. i have tried cscope , got references 1 time in file not find way go go next occurrence. i know utilize of ctrl+] ctags not want.i want go reference of text 1 1 . like when want alter prototype of function , want go 1 one. hope there way it. you looking :tnext , :tprevious . read next help topics: :help tags :help ctags :help cscope but here generic "search/replace in project" method… search string in whole project , list matching lines in quickfix window: :vim foo **/*.py | cw record alter in simple macro: qq ciwbar<esc> :cnext<cr> q repeat alter every match in list: @q @@ @@ … skipping irrelevant matches :cnext . and one… open new tab: :tabnew<cr> populate local argument list files contain search pattern: :arglocal `grep -rl foo *.js`<

java 7 - Byteman JUnit Runner - impossible to trigger IOException on auto-closed InputStream#close -

java 7 - Byteman JUnit Runner - impossible to trigger IOException on auto-closed InputStream#close - i have got next code: collection<string> errors = ...; seek (inputstream stream = my.class.getresourceasstream(resource)) { // stuff } catch(ioexception ex) { errors.add("fail"); } i'm trying byteman junit runner trigger ioexception when (valid) input stream give supposedly closed: @runwith(bmunitrunner.class) public class mytest { private my = new my(); @bmrule( name = "force_read_error", targetclass = "java.io.inputstream", targetmethod = "close()", action = "throw new ioexception(\"bazinga\")" ) @test public void catches_read_error() throws ioexception { collection<string> errors = my.foo("/valid-resource-in-classpath"); assertthat(errors).containsexactly("fail"); } } my test fails: errors empty,

selenium - How can I contain test members, under a TestNG test, in their own thread? -

selenium - How can I contain test members, under a TestNG test, in their own thread? - i attempting run selenium tests in parallel using testng runner. parallel requirement set in testng.xml file so. <test name="smoke tests" parallel="methods" thread-count="2"> the problem have want "quit" browser after each test. start new browser , run next test. has worked me until tried run tests in parallel. seems methods share threads , if quit browser thread gone. testng tries run next test on thread quit , sessionnotfoundexception error. i have tried parallel="tests" doesn't work , tests run sequentially instead of in parallel. there way run each test in new thread , not reuse threads or out of luck? here @beforemethod private static threadlocal<webdriver> driverforthread; @beforemethod public static void setupmethod() { log.info("calling setup before method"); driverforthread = new threadloc

phantomjs - Execute JS File Outside Casperjs Folder -

phantomjs - Execute JS File Outside Casperjs Folder - i got problem... i'm using casperjs 1.1.0 beta3 set phantom , casperjs path in scheme variable in windows 8.1 seek run js code placed in different folder casperjs folder. got execution time takes long. when set js code in samples folder in casperjs folder, execution time takes fast. why happened? how if want execute js file casperjs command fastly without set js code casperjs folder? suggestion or explanation? in advance phantomjs casperjs

xcode - Get instance of main window controller in app delegate -

xcode - Get instance of main window controller in app delegate - i know that, ios, can reference root view controller app delegate so: var rootviewcontroller = self.window!.rootviewcontroller how 1 reference main window controller app delegate when targeting os x? pass variable (the managed object context) way, have read solution referencing moc. you can access nswindowcontroller instance of main nswindow this: nsapplication.sharedapplication().mainwindow?.windowcontroller xcode osx swift

mysql - Getting a Row in PHP -

mysql - Getting a Row in PHP - i'm having problem getting row table. i'm trying echo id column result in table. think i'm missing simple... //-select database utilize $mydb=mysql_select_db("table"); //-query database table $sql="select * contacts `email`= $email_user"; //-run query against mysql query function $result=mysql_query($sql); //-if email , email_user same if echo id if ($result=$name_user){ echo "hello id " $id; } else{ echo "sorry find user"; } ?> remember, mysql_query returns query resource handler, not result. you must phone call mysql_fetch_assoc($queryresource) results. in example: //-select database utilize $mydb=mysql_select_db("table"); //-query database table $sql="select * contacts `email`= '$email_user'"; //-run query against mysql query function $queryresource=mysql_query($sql); $result = mysql_fetch_assoc($queryresource); if ($result){

ios - UITextField set border color using storyboard -

ios - UITextField set border color using storyboard - i'd set border color using storyboard if possible. i've seen reply here: uitextfield border color and followed reply in storyboard: all properties set, textfield doesn't show border. suggestions? as bogdan pointed out it's true can't find layer.bordercolor property in storyboard it's run time thing. however still can set bordercolor without using ib_designable, on view(or uiview subclass) little bit of coding. below steps how accomplish it, create category on calayer class. declare property of type uicolor suitable name, i'll name borderuicolor . write setter , getter property. in 'setter' method set "bordercolor" property of layer new colors cgcolor value. in 'getter' method homecoming uicolor layer's bordercolor. p.s: remember, categories can't have stored properties. 'borderuicolor' used calculated property, reference accomplish we

c++ - template link list compile error -

c++ - template link list compile error - this question has reply here: why can templates implemented in header file? 9 answers i working on programme school. link list using templates. i have abstract base of operations class: #pragma 1 time #include <string> using namespace std; template<class t> class linkedlistinterface { public: linkedlistinterface(void){}; virtual ~linkedlistinterface(void){}; virtual void inserthead(t value) = 0; virtual void inserttail(t value) = 0; virtual void insertafter(t value, t insertionnode) = 0; virtual void remove(t value) = 0; virtual void clear() = 0; virtual t at(int index) = 0; virtual int size() = 0; }; and class derived it: /* linklist.h * * created on: oct 4, 2014 * */ #ifndef linklist_h_ #define linklist_h_ #include <iostream>

geometry - RegEx Pattern for Exactly Three Spaces and Comma Delimited Doubles -

geometry - RegEx Pattern for Exactly Three Spaces and Comma Delimited Doubles - this odd request, can't seem find examples helping me out. need regex pattern matches following: (0.0 0.0,1.0 1.0,2.0 0.0,0.0 0.0) it's triangle on geometric plane each point be: 0.0 0.0 1.0 1.0 2.0 0.0 0.0 0.0 the 4th point beingness original starting point. need regex patter parenthesis, integers, dots, commas , 3 spaces. use long pattern \((\d*(?:\.\d+)?\s\d*(?:\.\d+)?),(?!\1)(\d*(?:\.\d+)?\s\d*(?:\.\d+)?),(?!\1)(?!\2)(\d*(?:\.\d+)?\s\d*(?:\.\d+)?),(\1) demo regex geometry

jsf - Adding validators to UIInputs outside of tag -

jsf - Adding validators to UIInputs outside of <h:inputText> tag - is possible add together validators inputtext fields outside h:inputtext tag? <!-- instead of --> <h:inputtext id="field1" value="#{backingbean.field1}"> <f:validator validatorid="customvalidator" /> </h:inputtext> <!-- --> <h:inputtext id="field1" value="#{backingbean.field1}" /> <abc:validations> <abc:validation for="field1" validator="customvalidatorname" /> </abc:validations> the abc:validation short custom component <cc:interface componenttype="validation"> <cc:attribute name="for" /> <cc:attribute name="validator" /> </cc:interface> <cc:implementation> </cc:implementation> </ui:composition> and faces component class pac

android - What is the difference creating event callback or the activity itself within a fragment? -

android - What is the difference creating event callback or the activity itself within a fragment? - lets using several fragments( action1fragment , action2fragment etc.) within activity( actionactivity ). want access elements of activity object, or phone call methods of actionactivity . offered create event callback . if maintain reference actionactivity within action1fragment instead of keeping reference callbackinterface implemented actionactivity since using these fragments within particular activity. i kinda confused thought activity might dead while reference of interface might still alive(it sounds ridiculous when read 1 time again ok if managed explain myself). the android developer tutorials recommend utilize callback interface on fragments. activity hosts fragment must implement callback interface. fragment getactivity() , casts callback interface, , makes callback. this recommended way promote more modular design. not matter if fragments ever work

objective c - How to link a dynamic library Xcode 5 -

objective c - How to link a dynamic library Xcode 5 - can point me tutorial shows how link dynamic library. created dynamic library. i've got no clue how include project. what tried 1.i copied dylib , header folder project. 2. gave library search path $(project_dir) 3. gave header search path $(project_dir)/include. builds , links fine. when run it, gives me error .yld: library not loaded: /usr/local/lib/test_dynamic_lib.dylib now read in documentation have install library in path. how that? or can manipulate runpaths. didnt clue says. i'm beginner in cocoa development. can explain how that? or point tutorial. couldn't find any. i found answer. wrote build script on target. export dylib=mylibrary.dylib mkdir "$target_build_dir/$target_name.bundle/contents/frameworks" cp -f "$srcroot/$dylib "$target_build_dir/$target_name.bundle/contents/frameworks" install_name_tool -change @executable_path/$dylib @loader_path/../framewo

c# - Adding PCL library into Silverlight Application causes Error 2110 -

c# - Adding PCL library into Silverlight Application causes Error 2110 - i have library have converted pcl in visual studio 2012. have set target frameworks .net framework 4 , higher, silverlight 4 , higher, windows 8, , windows phone silverlight 7 , higher. library correctly compiles , able integrated visual studio project targeting .net framework 4.5. i add together pcl silverlight 5 project. before adding pcl, correctly builds. after adding it, continues build no problem. however, when launch in net explorer, next error: line: 56 error: unhandled error in silverlight application code: 2110 category: initializeerror message: ag_e_unknown_error ignoring error or opening in browser brings white screen. the error occurs before using library. adding reference dll seems cause problem. i have not been able find documentation or help regarding error means. c# silverlight visual-studio-2012 silverlight-5.0 portable-class-library

ios - Import own swift framework -

ios - Import own swift framework - i created swift framework , want import in application. i did import biometricaccesscontrol in viewcontroller xcode not recognizes classes. how can solved it? thanks maybe problem of access command policy. default, type(class,enum,struct) , member(property,subscript,method)'s access command level internal,which visible within framework,if want expose it(namely,api) other modules, seek add together public modifier class or member.for example: public class myswiftcomponent { public var publicint:int? private var privateint:int? internal var internalint:int? } totally, there 3 access level : public ,internal , private (internal default) ios swift

python - Matrix of labels to adjacency matrix -

python - Matrix of labels to adjacency matrix - just wondering if there off-the-shelf function perform next operation; given matrix x, holding labels (that can assumed integer numbers 0-to-n) in each entry e.g.: x = [[0 1 1 2 2 3 3 3], [0 1 1 2 2 3 3 4], [0 1 5 5 5 5 3 4]] i want adjacency matrix g i.e. g[i,j] = 1 if i,j adjacent in x , 0 otherwise. for illustration g[1,2] = 1, because 1,2 adjacent in (x[0,2],x[0,3]), (x[1,2],x[1,3]) etc.. the naive solution loop through entries , check neighbors, i'd rather avoid loops performance reason. you can utilize fancy indexing assign values of g straight x array: import numpy np x = np.array([[0,1,1,2,2,3,3,3], [0,1,1,2,2,3,3,4], [0,1,5,5,5,5,3,4]]) g = np.zeros([x.max() + 1]*2) # left-right pairs g[x[:, :-1], x[:, 1:]] = 1 # right-left pairs g[x[:, 1:], x[:, :-1]] = 1 # top-bottom pairs g[x[:-1, :], x[1:, :]] = 1 # bottom-top pairs g[x[1:, :], x[:-1, :]] = 1 print(g)

concurrency - Are C# structs thread safe? -

concurrency - Are C# structs thread safe? - is c# struct thread-safe? for illustration if there a: struct info { int _number; public int number { { homecoming _number; } set { _number = value; } } public data(int number) { _number = number; } } in type: class daddata { public info thedata { get; set; } } is property named thedata, thread-safe? no, structures in .net not intrinsically thread-safe. however, copy-by-value semantics structures have great relevance converation. if passing structures around , assigning them in way variables or pass-by-value parameters (no ref or out keywords) copy beingness used. of course, means changes made re-create not reflected in original structure, it's aware of when passing them around. if accessing construction straight in manner doesn't involve copy-by-value semantics (e.g. accessing static field type of structure, , marc gravel points out in answer, there many other ways) across

java - apache mina Custom editor configurer throws exception in spring 4 -

java - apache mina Custom editor configurer throws exception in spring 4 - i using spring 3 apache mina, , using spring 4 , trying integrate apache mina. when compile, exception in customeditorconfigurer . here bean: <bean class="org.springframework.beans.factory.config.customeditorconfigurer"> <property name="customeditors"> <map> <entry key="java.net.socketaddress"> <bean class="org.apache.mina.integration.beans.inetsocketaddresseditor" /> </entry> </map> </property> </bean> as said, throws next error: cannot convert value of type [org.apache.mina.integration.beans.inetsocketaddresseditor] required type [java.lang.class] property 'customeditors[java.net.socketaddress]': propertyeditor [org.springframework.beans.propertyeditors.classeditor] returned inappropriate value of typ