Posts

php - Code Works on Server not on Xampp: json_encode -

hi have piece of code works on uberspace server doesn't work on xampp (mac). the code database request: get_all_experts($errors, $rows, ' active < curdate() , active not null'); echo count($rows);//is 14 in example echo json_encode($rows);//doesn't return $arr = array (1,'b'=>'2','c'=>3,'d'=>4,'e'=>5); echo json_encode($arr);//works function get_all_experts(&$errors, &$rows, $selector) { $result = mysql_query('select * experts'.$selector); if (!$result) { $errors['sql_experts'] = 'kein ergebnis: '.mysql_error(); } else { while($r = mysql_fetch_assoc($result)) { $rows[] = $r; get_expert_tags($errors, $rows, $r); get_last_expert_experience($errors, $rows, $r); } } }; the 2 inner functions database requests , add nested values. e.g. 1 expert has more 1 experience. edit: $conn = mysql_connect('localhost', ...

javascript - Is there a way to test the name of downloaded file in protractor? -

is there way test name and/or extension of downloaded file application in protractor? using node.js filesystem, can read files in directory , verify them in protractor test. there nothing special provided protractor emulate functionality.

javascript - Get text of option before the currently selected option of a dropdown -

i'm working on form need validate textbox field between selected dropdown item, , item before selected. example dropdown: <select>select</option> <option value="57">25</option> <option value="58">28</option> <option value="59" selected>30</option> <option value="60">32</option> <option value="61">33</option> <option value="62">35</option> </select> given selected item, 59, need jquery give me value previous item, in case 58. note example, values not sequential this. i can item after selected item in jquery using: $("#sealshaftsizeid option:selected + option").text(); i unable find jquery reverse of that. you can resolve this: $("option[selected]").prev().css( "background-color", "red" ); <script src="https://ajax.googleapis.com/ajax/libs/jquer...

c - Printing content of 2D array (pointer of pointer) -

i defined function initialising 2d array through pointers , @ same time fell random values. then print , don't see expected values. bug in code? i've been looking hours. #define matrix_size 3 int **initialize_matrix(size_t m, size_t n){ int i1,i2; int **ptr1=(int **)malloc(sizeof(int *)*m*n); int *ptr2=(int *)malloc(sizeof(int)*m); srand(time(0)); for(i1=0;i1<matrix_size;i1++){ for(i2=0;i2<matrix_size;i2++){ ptr2[i2]=rand()%10; printf("%d ",ptr2[i2]); } } for(i1=0;i1<matrix_size;i1++){ ptr1[i1]=ptr2+m*i1; } printf("\nfinished generating\n"); return ptr1; } void print_matrix(int** matrix_to_print){ int i1,i2; for(i1=0;i1<matrix_size;i1++) for(i2=0;i2<matrix_size;i2++){ printf("%d ",matrix_to_print[i1][i2]); if(i2==matrix_size-1) printf("\n"); } } this prints: 2 4 8 0 6 ...

trying to addFile in plupload using input field of type file -

i've used plupload browse button option successfully, trying use utility resize files within existing web page user individually selects files. understood documentation uploader addfile method work input fields i'm having no success. the field defined as: <input id="selectuserfile1" name="userfile1" type="file" accept="image/gif,image/jpeg" aria-labelledby="selectuserfile1-arialabel" title="browse file on computer" /> and add file with: uploader.init(); uploader.addfile(document.getelementbyid('selectuserfile1')); alert('files total: ' + uploader.files.length); uploader.start(); it seems fail though, filesadded method not called , uploader.files.length 0. uploader defined follows: var filecount = 1; var uploader = new plupload.uploader({ runtimes : 'html5,flash,silverlight,html4', url : 'test_file_upload.php', flash_swf_url : '../testjs/moxie.swf...

vb.net - writing content of listbox to a txt file and then opening it -

i trying save contents of 1 listbox txt file , open , printing second listbox. have done of this, actual file not txt file. can u show me how make file txt file using code? if not possible can u show me code can? private sub loadbutton_click(byval sender system.object, byval e system.eventargs) handles loadbutton.click if openfd.showdialog() = dialogresult.ok dim lines = file.readalllines(openfd.filename) listbox2.items.clear() listbox2.items.addrange(lines) end if end sub private sub savebutton_click(byval sender system.object, byval e system.eventargs) handles savebutton.click if savefd.showdialog() = dialogresult.ok using writer = new streamwriter(savefd.filename) each o object in listbox1.items writer.writeline(o) next end using end if end sub you can use file.writealltext method (along string builder). opinion, it's cleaner code. private sub savebutton_click(byva...

java - Servlet not directing to JSP page -

Image
we required write web application using java, html, beans, , jsps. problem have never taken html or css course. i have base html page called index.html takes user's first , last name in text field submit button. when press submit "page cannot displayed error." have compared code instructors , similar unsure doing wrong. appreciated. also, not mind horrible formatting. index.html <!doctype html> <html> <head> <title>final project</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <h1>welcome banking tyler weaver</h1> <h4>please enter first , last name</h4> <form action="bankingcontrol" method="post"> <input type="hidden" name="action" value="menu"> ...