Posts

python - Speeding up Loading of Pandas Sparse DataFrame -

i have large pickled sparse dataframe generated, since big hold in memory, had incrementally append generated, follows: with open(data.pickle, 'ab') output: pickle.dump(df.to_sparse(), output, pickle.highest_protocol) then in order read file following: df_2 = pd.dataframe([]).to_sparse() open(data.pickle, 'rb') pickle_file: try: while true: test = pickle.load(pickle_file) df_2 = pd.concat([df_2, test], ignore_index= true) except eoferror: pass given size of file(20 gb), method works, takes really long time. possible parallelize pickle.load/pd.concat steps quicker loading time? or there other suggestions speeding process up, on loading part of code. note: generation step done on computer less resources, that's why load step, done on more powerful machine, can hold df in memory. thanks! don't concat in loop! note in docs, maybe should warning df_list = [] open(data.pickle, 'rb...

xcode/ios/coredata: Last record in tableview displays twice when after adding new record -

i having strange problem. when add record entities i.e. core data screens, table view instead of showing new record, repeats previous record. it happens entities , screens, i.e. if add records, 1,2,3 etc. display 1,1,1. other screens , entities use identical code, happens, after 8 through tenth record. in these cases, if add records named 1,2,3…10, display 1,2,3,4,5,6,7,8,8,8,8,8,8 etc. has ever encountered strange/spooky behavior? why think new record same previous record either right away or @ point i.e. when number of records hits 8 or so? note, saves fine in core data when close simulator , rebuild, shows right records. the delegate pattern seems working—somewhat—as shows new record when 1 added, shows copy of last record , record on got stuck, i.e. 8,8,8 etc. thanks suggestions. has been driving me crazy week now. am posting without code not accept code posted reason... happy post code requested. edit: #pragma mark - table view data source - (uitablev...

javascript - Bootstrap Image Gallery with MixItUp Filtering -

i'm using bootstrap image gallery plugin mixitup filtering. image gallery contains on 150 images , want if thumbnail of selected filter clicked cycle through images selected filter , not images in gallery. tried create div each filter it's not working. each filter wrapped in div javascript work, don't know how. here html & js of stripped down sample , link see online: html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <title>gallery sample</title> <!-- bootstrap core css --> <link href="css/bootstrap.css" rel="stylesheet"> <!-- custom css --> <link href="css/style.css" rel="stylesheet"...

PHP Built-In Server Can't cURL -

i have relatively simple script following: <?php $url = "localhost:2222/test.html"; echo "*** url ***\n"; echo $url . "\n"; echo "***********\n"; echo "** whoami *\n"; echo exec('whoami'); echo "* output **\n"; $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_returntransfer, 1); $output = curl_exec($ch); curl_close($ch); echo $output; when execute on command line, works - meager results within test.html. when run script loading built-in php server , browsing script, hangs. no output screen, nothing written logs. i read user permissions can in way, tried doing whoami ensure user ran built-in php server same 1 executed script on command line; are. safe_mode off, disable_functions set nothing. can exec other commands (like whoami). what else should check for? built-in php server count other user when fulfills request perhaps? to make comment answer:...

angularjs - Passing scope object to Angular Directive via $compile -

i know if have directive in html, can pass objects $scope it: <mydirective some-data="somedata"></mydirective> ...where somedata might json object. is possible pass reference somedata if create directive dynamically , use $compile ? $scope.somedata = { firstname: 'john', lastname: 'doe' }; var link = $compile("<mydirective some-data='???'></mydirective>"); var content = link($scope); $(body).append(content); yes can pass object to var myapp = angular.module('myapp',[]); myapp.directive('passobject', function() { return { restrict: 'e', scope: { obj: '=' }, template: '<div>hello, {{obj.prop}}!</div>' }; }); myapp.controller('myctrl', function ($scope) { $scope.obj = { prop: "world" }; }); <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.12/angular...

Assignment in anonymous inner class Java -

here have class contains anonymous inner class: public class example { int value; example(int value) { this.value = value; } void bumpup() { value++; } static example makeexample(int startval) { return new counter(startval) { int bumpvalue = 2; // value = startval; void bumpup() { bumpvalue = (bumpvalue == 2) ? 1: 2; value+= bumpvalue; } }; } } if uncomment line says value = startval , eclipse throws error saying above line error. why can't put value = startval there? thanks! first of all, putting line there syntax error, because cannot have instructions outside of method. , you're attempting put instruction within body of anonymous inner class. but above all, don't need line, neither in constructor (which impossible anonymous inner class), nor in initializer block. the constructor of superc...

sql server - Sharing data between stored procedures -

i have stored procedure called dbo.match . looks : create procedure [dbo].[match] @parameterfromuser nvarchar(30), @checkbool int begin --some code select rowid, percentmatch @matches end this procedure being called stored procedure : create procedure matchmotherfirstname @motherfn nvarchar(20) , @checkbool int begin select @constval = functionweight dbo.functionweights functionweights.functionid = 20; /* code execute `dbo.match` procedure in above procedure called `matchmotherfirstname` , retrieve `rownumber` , `percentmatch`, insert #temp in respective fields , , calculate `percentmatch * constval`, , insert in corresponding column called `percentage` in `#temp` */ end i need execute dbo.match stored procedure in above procedure, retrieve rowid , pecrntmatch value, @constval value have above, multiply @constval , percentmatch , store in percentage column of #temp , insert results dbo.match procedure in temporary table. dbo.match ...