Posts

mysql - php $_GET item to virtual subdomain with Htaccess -

mysql - php $_GET item to virtual subdomain with Htaccess - i have simple question related php , htaccess. just think have php code : if(isset($_get['word'])) { echo $_get['word']; } so have (for example) : example.com/?word=test and code echo out **test** , question that, how can alter $_get value, virtual subdomain ? for example, want have this, if below address opened : test.example.com then code gets run , echo out **test** . i need htaccess code thing, so, how can htaccess ? i have tried codes couldn't results . you can utilize code in document_root/.htaccess file: rewriteengine on rewritecond %{http_host} !^www\. [nc] rewritecond %{http_host} ^([^.]+) [nc] rewritecond %{query_string} !(?:^|&)word=[^&]+(?:&|$) [nc] rewriterule ^ %{request_uri}?word=%1 [qsa,l] %1 reference value captured in line: rewritecond %{http_host} ^([^.]+) [nc] first part of domain name before dot. php mysql .htacce...

c - Freeing array of struct -

c - Freeing array of struct - i've done research , couldn't find reply problem. i'm having problems freeing struct. this how create struct: struct construction * newstructure(int n) { struct construction * structure; int i; construction = (struct construction * ) malloc(n * sizeof(struct structure)); (i = 0; < n; i++) { structure[i].i_number = (int * ) malloc(sizeof(int)); structure[i].c_char = (char * ) malloc(sizeof(char)); structure[i].c_char[0] = '\0'; structure[i].d_float = (double * ) malloc(sizeof(double)); } homecoming structure; } everything works point. later fill every variable random values not empty. i phone call freememory function freememory(structure, amountofstructures); , here freememory function itself: void freememory (struct structure* structure, int n) { int i; for( i=0 ; i<n ; i++ ) { if (structure[i].i_number!=null) free(struc...

r - Change file name when using write.table() according to the name of the third column in data frame -

r - Change file name when using write.table() according to the name of the third column in data frame - i wrote script in r merges , modifies csv info , saves resulting info frame using write table(). when saves file adds current date name of file. 3rd column of resulting info frame country specific, wondering if there way include in file name using write.table name of country depending on country code (name of 3rd column). for example, if name of 3rd column "it", want add together "italy" name of csv file using write.table. import list of country names , codes r: (it wise @ top of script: outside processing loop dont read in info on , on each dataset beingness written out .csv. rest of code goes before current write.table command library(rcurl) csv_src <- geturl("https://raw.githubusercontent.com/umpirsky/country-list/master/country/cldr/en/country.csv") world <- read.csv(text=csv_src, header=t)` get name of 3rd c...

Assign Javascript popup HTML link to PHP variable -

Assign Javascript popup HTML link to PHP variable - i trying assign next php variable: [<a href='"'javascript:pop_booking_item_add({id})'"'>add new item</a>] i have tried this: $add_button = "[<a href='"'javascript:pop_booking_item_add({id})'"'>add new item</a>]"; but getting error message: error: syntax error, unexpected ''javascript:pop_booking_item_a' (t_constant_encapsed_string) i think need escape quotes i'm not sure how to? this should work: $add_button = "[<a href='javascript:pop_booking_item_add({id})'>add new item</a>]"; or $add_button = "[<a href=\"javascript:pop_booking_item_add({id})\">add new item</a>]"; javascript php html escaping variable-assignment

django - nginx + gunicorn 502 bad gateway -

django - nginx + gunicorn 502 bad gateway - i'm trying deploy django project on vps server via nginx , gunicorn, got nginx error '502 bad gateway' when seek open page rollservice-rostov.ru something wrong nginx configuration, can't figure out is. /etc/nginx/sites-enabled/rollservice.conf: upstream rollservice-rostov.ru { server 127.0.0.1:8010 fail_timeout=0; } server { hear 80; server_name www.rollservice-rostov.ru; rewrite ^/(.*) http://rollservice-rostov.ru/$1 permanent; client_max_body_size 4g; access_log /home/django/logs/rollservice/nginx.access.log; error_log /home/django/logs/rollservice/nginx.error.log; location /static/ { alias /home/django/projects/rollservice/static/; } location / { proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_set_header host $http_host; proxy_redirect off; if (!-f $request_filename) { proxy_pass http://rollse...

How to take a 5-day average around a specific date in r -

How to take a 5-day average around a specific date in r - so have dataset looks without weekends: x1 x2 3798 2009-12-29 0 3799 2009-12-30 0 3800 2009-12-31 0 3802 2010-01-02 0 3803 2010-01-03 2.1 3804 2010-01-04 0 3805 2010-01-05 0 3806 2010-01-06 0 3807 2010-01-07 0 3808 2010-01-08 0 3809 2010-01-09 0 3810 2010-01-10 6.8 3811 2010-01-12 0 3812 2010-01-13 0 3813 2010-01-14 17.7 3814 2010-01-16 0 3815 2010-01-17 0 3816 2010-01-18 1.5 3817 2010-01-19 0 3818 2010-01-20 0 3819 2010-01-21 0 3820 2010-01-22 0 3821 2010-01-23 0 3822 2010-01-24 0 3823 2010-01-25 0 3824 2010-01-26 0 3825 2010-01-27 4.5 3826 2010-01-28 0 3827 2010-01-29 0 3828 2010-01-31 0 3829 2010-02-01 0 3830 2010...

javascript - How to get form-field values on html-file where form was send -

javascript - How to get form-field values on html-file where form was send - i have html-file containing form (start.html). submitting it, navigates different html-form (result.html). how date-entries in result.html done in textfields of form in start.html? something like: $(document).ready(function () { var fww = 'what value fieldsindex.html?'; $('#div1').html(fww); }); </script> </head> <body> <div id="div1"> </div> any solution jquery or javascript appreciated. thanks you can form info using form elements id shown below, can not transfer info 1 form other form using js only, should utilize backend controller form.html <input type="text" id="formelement"> js $("formelement").val(); javascript jquery