Posts

php - Rewrite URL from my form using get request in htaccess -

i want rewite url example.org/search.php?by_what=date&keywords=sample example.org/search/date/sample . here code : in search.php <form name="frmsearch" action="search.php" method="get"> <div class="row searchbox-container"> <div class="twelve columns"> <div class="row collapse"> <div class="nine columns"> <input type="hidden" name="by_what" value="manning_agency"> <center> <input type="text" placeholder="type agency name here" name="keywords" id="keywords" size="40" class="small-txtbox-search-inner" value="<? echo $keywords; ?>" /> </center> ...

setting "server name" when using kestrel with dotnet core -

i writing app using asp.net mvc right runs against microsoft's kestrel server. works fine, , pass values @ startup using hosting.json file defined follows; { "server": "microsoft.aspnet.server.kestrel", "server.urls": "http://localhost:5000;https://localhost:5001" } is there way give "server" name, isn't reporting localhost or undefined time? please replace localhost * . give below benefits: if give localhost , can access application through http://localhost:5000 , not using ip [ http://192.168.1.2:5000 , example]. using * , can access through ip. you can connect server other pcs or mobile devices. a few days back, had same requirements yours , got solution from: docs.asp.net . [the comments section hidden default. please click show comments , search localhost .] tip 1: view application mobile device, please check: viewing localhost website mobile device . tip 2: question , answer ha...

c# - MVC4 Razor template like -

hello have simple question think, i have cshtml like: <div id="box"> @if (model.view == "item1") { <div id="item1"> ... </div> } else { <div id="item2"> ... </div> } <div id="itemdescription"> ... </div> </div> where pass parameter via model display content depending on parameter, because rest of document same in both cases. is there better way achieve this? thanks! not really; way of doing things. if div id matches value of model.view , shorten this: <div id="box"> <div id="@(model.view)"> ... </div> <div id="itemdescription"> ... </div> </div> otherwise, approach fine. per von v's comment, might want partial views if contained markup long-winded (or need repeat ...

machine learning - How to change threshold for precision and recall in python scikit-learn? -

i have heard people saying can adjust threshold tweak trade-off between precision , recall, can't find actual example of how that. my code: for in mass[k]: df = df_temp # reset df before each loop #$$ #$$ if 1==1: ###if == singleethnic: count+=1 ethnicity_tar = str(i) # fr, en, ir, sc, others, ab, rus, ch, it, jp # fn, metis, inuit; algonquian, iroquoian, athapaskan, wakashan, siouan, salish, tsimshian, kootenay ############################################ ############################################ def ethnicity_target(row): try: if row[ethnicity_var] == ethnicity_tar: return 1 else: return 0 except: return none df['ethnicity_scan'] = df.apply(ethnicity_target, axis=1) print '1=', ethnicity_tar print '0=', 'non-'+ethnicity_tar # random sampling ...

Creating a schema in Cassandra using Phantom Scala DSL -

i have written code case class user(id: int, gender: string, age: int, occupation: string, zipcode: string) object defaults { val hosts = seq("172.17.0.9") val connector = contactpoints(hosts).keyspace("movies") } class mydatabase(val keyspace: keyspacedef) extends com.websudos.phantom.db.databaseimpl(keyspace) { object users extends users keyspace.connector } object mydatabase extends mydatabase(defaults.connector) class users extends cassandratable[users, user] { object id extends intcolumn(this) partitionkey[int] object age extends intcolumn(this) index[int] object gender extends stringcolumn(this) index[string] object occupation extends stringcolumn(this) index[string] object zipcode extends stringcolumn(this) index[string] def fromrow(row: row) : user = { user( row(id), row(gender), row(age), row(occupation), row(zipcode) ) } } object users extends users rootconnector { def store(user: user)...

c - "ld returned 1 exit status" and "incompatible implicit declaration of built-in function 'exit' " -

i bored, started study new, in case, c. i trying basic script in c i'm having error, , don't know wrong. //tablas #include <stdio.h> int main() { double i, j, p; int x, y; printf ("tablas del: "); scanf ("%i", &x); printf ("hasta el: "); scanf ("%i", &y); file *f; f = fopen("tablas.txt", "w"); if (f == null) { printf("no se ha podido abrir/crear/reemplazar el archivo\n\a"); exit(1); } printf ("espere mientras se calcula los resulatdos.\n"); system ("del tablas.txt"); (i = x ; <= y ; i++) { (j = x ; j <= 10 ; j++) { fprinf(f, "%f x %f = %f\n", i, j, i*j); } } printf ("\nfin\n\a"); system ("pause"); return 0; } you need #include <stdlib.h> exit work.

reusability - How to reuse form in codeigniter for update and add -

hello want reuse form in codeigniter problem update form populated 1 page has load. here sample form. <?php $attributes = array('class' => 'form-horizontal', 'id' => 'addpersonnel'); echo form_open($form_submission, $attributes); ?> <input type="text" name="name" value="<?php echo set_value('name')?"> > <input type="text" name="rank" value="<?php echo set_value('rank')?"> > <button type="submit" class="btn btn-primary">save</button> <?php echo form_close()?> my problem here lies in set_value() method of form_validation class since have conflict populating form if updating. in controller update function add condition like: if ($this->input->server('request_method') === 'post') { $th...