Posts

How to configure SSL termination on Nginx with a Rails application -

i ssl request through load balancer performing ssl termination , sending decrypted traffic server on port 81. i'm running nginx , have setup listener port 81 , tell rails app ssl request. here how nginx config looks like: server { listen 81; server_name server; root /var/www/app/current/public; error_log /var/log/nginx/app-error.log; access_log /var/log/nginx/app-access.log; passenger_enabled on; client_max_body_size 100m; location / { passenger_enabled on; proxy_set_header x-forwarded-proto https; } } it goes through ruby on rails doesn't detect header request.headers['x-forwarded-proto'], takes request non-https. should add in order rails thinking ssl request? so proxy_set_header not used passenger, need use passenger_set_cgi_param instead: passenger_set_cgi_param http_x_forwarded_proto https;

iPhone iOS how to implement a sequence of background network send operations in the fastest way possible? -

i'm trying stream data server @ regular intervals , in way fast , not block ui. ui pretty busy trying display data. implementation uses nstimer fires every 50ms, picks network packet out of circular array , sends over: //this timer networkwritetimer = [nstimer scheduledtimerwithtimeinterval:0.05 target:self selector:@selector(sendactivity:) userinfo:nil repeats:yes]; -(void)sendactivityinbackground:(id)sender { [[appconfig getinstance].activeremoteroom.connection sendnetworkpacket:[circulararray objectatindex:arrayindex%arraycapacity]]; } -(void)sendactivity:(nstimer*)timer { // send out [self performselectorinbackground:@selector(sendactivityinbackground:) withobject:nil]; } i'm not satisfied performance of method. time profiling has revealed there's overhead associated performing background selectors, , performance can quite choppy. i'm thinking of additional ways improve performance: improve p...

php - To link website logo to external url from backend interface in drupal 7 -

need link website logo external url backend interface in drupal 7. now hard coded page.tpl.php file. is there option add backend? there no default option linking website logo external url. we need create field in end theme settings. create page theme-settings.php inside theme folder following code function theme_form_system_theme_settings_alter(&$form, $form_state) { $form['theme_settings'] = array( '#type' => 'fieldset', '#title' => t('theme settings') ); $form['theme_settings']['theme_logourl'] = array( '#type' => 'textfield', '#title' => t('logo url'), '#default_value' => theme_get_setting('theme_logourl'), '#description' => t("logo url external linking"), ); return $form; } go , check theme settings page - appearance/settings/theme there new text filed ente...

jsf - Reference inputText value from link param -

i have p:inputtext component , h:link that navigate different view: <p:inputtext id="searchvalue" value="#{bean.searchvalue}"> <p:ajax event="keyup" update="search" /> </p:inputtext> <h:link id="search" value="search" outcome="ressearch"> <f:param name="searchvalue" value="#{bean.searchvalue}" /> </h:link> the ressearch page use searchvalue parameter , executes search based on it, after presents result: <f:metadata> <f:viewparam name="searchvalue" value="#{searchbean.searchvalue}" /> <f:event type="prerenderview" listener="#{searchbean.init}" /> </f:metadata> i'd rather not use ajax value of inputtext component. possible value inputtext directly (without using bean properties) , set value of param ? just use plain html form. <form action="ressearch.x...

java - Parallel prime factorization -

this question has answer here: parallel algorithms generating prime numbers (possibly using hadoop's map reduce) 1 answer does have idea what's approach parallel prime factorization algorithm ? i can't figure out @ stage of algorithm should divide threads .. how can think prime factorization in parallel way ? consider following 1 thread code: public static void primefactorization(arraylist<integer> factors, int num){ //factors array save factorization elements //num number factorized int limit = num/2+1; if(isprime(num)) factors.add(num); else{ while(num%2==0){ factors.add(2); num=num/2; } (int i=3; i<limit; i+=2){ while (isprime(i) && num%i==0){ factors.add(i); ...

css - create a grid with no spaces using table html -

i'm trying build grid in html want remove spaces between cels, , can't find. <table id="gamegrid" cellspacing="0" > <tr class="gridrow" > <td class="box" ></td> <td class="box" ></td> <td class="box" ></td> </tr> <tr class="gridrow" > <td class="box" ></td> <td class="box" ></td> <td class="box" ></td> </tr> <tr class="gridrow" > <td class="box" ></td> <td class="box" ></td> <td class="box" ></td> </tr> </table> and css #gamegrid{ border:1px solid black; border-collapse: collapse; padding:0; margin:0; border-spacing: 0; } #gamegrid .gridrow{ margin:0; padding:0; } #gamegrid .gridrow...

javascript - IF-statement stroke in a line diagram using d3.js -

i've drawn graph using data out of database, , want line turn red when number in database gets higher 500 (like below). unfortunately doesn't work way, , i've tried other stuff, no succes. though dashed line work using code .style("stroke-dasharray", ("3, 3")) my question: possible let stroke color turn red when y value gets higher point in d3.js? // adds svg canvas var svg = d3.select("body") // explicitly state svg element go on web page (the 'body') .append("svg") // append 'svg' html 'body' of web page .attr("width", width + margin.left + margin.right) // set 'width' of svg element .attr("height", height + margin.top + margin.bottom)// set 'height' of svg element .append("g") // append 'g' html 'body...