Posts

ruby - Am I doing it wrong or is it a bug in net/http? -

i'm using ruby net::http under nginx/phusion passenger server, attempting post json string server. appears post, when sending 'application/json', prematurely closes session server. i.e.: on server side: 127.0.0.1 - - [03/sep/2013 07:47:14] "post /path/to/submit " 200 45 0.0013 pid=12893 thr=47197563169088 file=ext/nginx/helperagent.cpp:933 time=2013-09-03 07:47:14.830 ]: uncaught exception in passengerserver client thread: exception: cannot read response backend process: connection reset peer (104) backtrace: in 'void client::forwardresponse(passenger::sessionptr&, passenger::filedescriptor&, const passenger::analyticslogptr&)' (helperagent.cpp:698) in 'void client::handlerequest(passenger::filedescriptor&)' (helperagent.cpp:859) in 'void client::threadmain()' (helperagent.cpp:952) a client side debug session is: opening connection hostname.com... opened <- "post /path/to/submit http/1.1\r\ncontent-typ...

mysqli - PHP - is it recommended to use mysqli_data_seek within a loop -

when looping through mysqli query usual way be: $res = $db->query($sql); while($rs = $res->fetch_assoc()) { echo $rs['field']; } i found out use mysqli_data_seek setting internal result pointer, change loop following: $res = $db->query($sql); $records = $res->num_rows; ($i = 0; $i <= $records-1; $i++) { mysqli_data_seek($res,$i); // set result pointer $rs = mysqli_fetch_assoc($res); echo $rs['field']; } i benchmarked both ways , couldn't see difference wondering - there drawbacks using second method? thanks php - recommended use mysqli_data_seek within loop of course not. are there drawbacks using second method? sure. takes as twice more code first one.

listview - jquery plugin to toggle list view and column view for bootstrap -

i'm trying put script toggle grid , list group views. want keep code light possible utilizing bootstrap classes. i'll add additional classes col-lg-* etc... , work on cookie script now, i'm trying wrap classes using wrapall, wrap nwrapper . first time click grid view button, works fine , everytime after list view i'm stuck trying fix grid view after second click. perhaps set of eyes can me see doing wrong. here demo of i'm working on: toggle list grid view . this script far: $(document).ready(function() { $('#grid').click(function() { $('#products').fadeout(300, function() { $(this).addclass('row-group').fadein(300); $(this).removeclass('list-group').fadein(300); $('#grid').addclass('disabled'); $('#list').removeclass('disabled'); $('.item').removeclass('list-group-item row'); $('.item').wrap( '<div class=...

css - Border inside an image with margin -

Image
this question has answer here: inner border on images css? 5 answers how can achieve effect css: do need smaller div margin , border or somehow possible using box-shadow you need single element :before or :after the demo : http://jsfiddle.net/6a95a/1/ the markup: <figure></figure> the style figure{ width:200px; height: 180px; position:relative; background-image:url(http://24.media.tumblr.com/tumblr_m2scelxyga1qbmtexo1_500.jpg); background-size:cover; background-position:50%; } figure:before{ content:''; position: absolute; left: 2%; top: 2%; width: 95%; height: 95%; border: 1px solid white; }

python - Organizing pyramid / paster config files in a modular way -

i have pyramid application using paster ini file, hosted via uwsgi. want host different instances (i.e. development, staging, production), ideally without having touch config file @ all. different instances need different settings. approach like: [app:base] sqlalchemy.url = some/connection/string/%(instance)s [app:development] instance = development [app:production] instance = production that not work, because instance not yet defined, when sqlalchemy.url defined. tried inject instance somehow outside, without success. i'm not able access environment variables. tried pass values via uwsgi_param nginx, not work. how organize paster ini files in modular way, not have duplicate settings? you can use "config:" url include settings file. in "shared.ini" [app:myapp] use = egg:myapp in "development.ini" [app:main] use = config:shared.ini#myapp = 2 in "production.ini" [app:main] use = config:shared.ini#myapp = 3 ...

angularjs - ng-repeat not working, am I missing something? -

i've set : $scope.privates = [ {value:'private'}, {value:'public'} ]; and in view : %h2 etablissement %div{"data-ng-repeat" => "private in privates"} %input{"data-ng-model" => "filterprivacy[private.value]",:type => "checkbox"} {{private.value}} and renders : <h2>etablissement</h2> <div data-ng-repeat-start='private in privates'> <input data-ng-model='filterprivacy[private.value]' type='checkbox'> </div> the {{private.value}} isn't showing anywhere , should have 2 inputs cause i've got 2 values. missing ? cordially, rob p.s : when test {{privates}} renders me <div ng-repeat='private in privates'> [{"value":"private"},{"value":"public"}] </div> there issue in rendered code, should use data-ng-repeat ...

Difference between CLASS and By processing in SAS STAT Procs? -

i wondering if there major difference between using class or statements in sas stat procs. take proc means example. suppose have 2 group/categorical variables, x1 , x2. want compute summary statistics variable (x3) each level combination of x1 , x2. example, using class x1 x2 gives me summary stats x3 @ x2=1 @ x1=1 , summary stats x3 @ x2=2 @ x1=1, , on. below example output. x1=1 x2=1 x3 mean std x2=2 x3 mean std x1=2 x2=1 x3 mean std ... if use by x1 x2 get x1=1 x2=1 x3 mean std (new page) x1=1 x2=2 x3 mean std (new page) .... if use class x1 , by x2 get x1=1 x2=1 x3 mean std x2=2 x3 mean std x1=2 x2=1 x3 mean std x2=2 x3 mean std ...... this sample data x1 x2 x3 1 1 3 1 1 4 1 2 6 1 2 2 2 1 5 2 1 1 2 2 2 2 2 6 3 1 10 3 1 2 3 2 1 3 2 8 the best can tell, there no difference in output, except manner in displayed. example may simplistic show differences. beyond bob noted (the sorting requirement), important, there differ...