Posts

python - How to specify constraints in statsmodels OLS? -

i using statsmodels ols run linear regression on data. problem coefficients add 1 (i plan not use constant parameter). is possible specify @ least 1 constraint on coefficients in statsmodels ols. see no option so. thanks in advance. coder.

bash - Seeing shell commands as they are being executed including variables -

this question has answer here: difference between single , double quotes in bash 3 answers i can do bash -x mysellh.sh to see commands being executed, don't see variables replaced values. instance, if have in shell script: screen -d -m sh -c 'rails_env="$r_env" bundle exec rake sunspot:solr:reindex[500] > "$project_dir"/solr/indexing_out.txt' i see: + screen -d -m sh -c 'rails_env="$r_env" bundle exec rake sunspot:solr:reindex[500] > "$project_dir"/solr/indexing_out.txt' even though i've declared earlier: r_env=test is there option want? in case, doing asked: command line "word" $r_env in have enclosed in single quotes, inhibit expansion. -x output showing non-expansion. if want variables expanded, enclose first "word" in double quotes , use single qu...

PHP SQLITE - How to insert new records and update existing records conditionally -

trying wrap head around this. posting data sqlite db , insert records if not exist, , update existing records if requirements met (basically if 1 field has changed values). not sure how this. i've seen examples using on duplicate key, updates records when there duplicate. need check change before updating. any ideas?

html - Is it safe to only redirect non logged users on php? -

i'm creating little website , i'm wondering since had lessons on http headers if it's safe use such logging algorithm : if(! isset($_session["user"]) { header("location : logout.php"); } // , here start web page if conditin above not satisfied <html> ........ i think it's not because redirection can ignored web client isn't ? its better add 'else' statement prevent bugs trolling :) if(!isset($_session["user"]) { header("location : logout.php"); exit("you not authorized!"); } else { ?> <html>...</html> <?php } ?>

css3 - How to align html div elements horizontaly in popover bootstrap? -

Image
i using bootstrap 3. want align 2 div elements horizontaly in popover dont know exact class apply style setting property display: inline-block; . idea how can achieve ? tried wrapping them div , setting property inline-block parent div did not work. $('#tag-input').popover({ container: 'body', trigger: "manual", html: "true", animation: true, content: "<div>first row</div><div>second row</div>" }); just wrap 2 divs in div class="row" . can add class="col-xs-6" each of them, each take 50% width of popover. demo here $('#tag-input').popover({ container: 'body', trigger: "hover", position: "bottom", html: "true", animation: true, content: "<div class='row'><div class='col-xs-6'>first row</div><div cla...

sas - Logistic regression Macro -

%macro intercept(i1= ,i2= ); %let n = %sysfunc(countw(&i1)); %do = 1 %to &n; %let val_i1 = %scan(&i1,&i,''); %let val_i2 = %scan(&i2,&i,''); data scores; set repeat_score2; /* segment 1 probablity score */ p1 = 0; z1 = &val_i1 + * 0.03 + r * -0.0047841 + p * -0.000916081 ; p1 = 1/(1+2.71828**-z1); /* segment 2 probablity score */ p2 = 0; z2 = &val_i2 + r * 0.09 + m * 0.012786245 + c * -0.00179618 + p2 = 1/(1+2.71828**-z2); logit_score = 0; if max(p1,p2) = p1 logit_score = 1; else if max(p1...

c++ - Trap cursor in Window -

i wrote own cameraclass in c++ using dx11. @ moment use wm_mousemove events around in scene. prevent cursur out of window, call function setcursorpos center mouse whenever wm_mousemove event occurs. if move mouse fast, cursor gets out of window. solution using function clipcursor, leads falter rotation of camera when cursor hits border of rect. clipcursor solved original problem, ended in another. do guys have solution that? the regular windows message not best solution drive precise controls. inherit os acceleration system, clipping , depends on other shenanigans can see. the best api receive mouse inputs raw input. has advantage expose better dpi , polling rate hardware can provide , free of under hood manipulation. once read mouse this, free use setcapture , clipcursor prevent unwanted click other window. you can find documentation here : https://msdn.microsoft.com/en-us/library/windows/desktop/ms645536(v=vs.85).aspx