Search Results

Search found 2 results on 1 pages for 'shams'.

Page 1/1 | 1 

  • servlet resopnse data for autocomplete

    - by shams haque
    Hello experts, Following code is in php. i want to do same in java. Please tell me how do i generate this type of array or collection in java. I need this to response to json autocomplete. <?php $q = strtolower($_GET["q"]); if (!$q) return; $items = array( "Peter Pan"=>"[email protected]", "Molly"=>"[email protected]", "Forneria Marconi"=>"[email protected]", "Master Sync"=>"[email protected]", "Dr. Tech de Log"=>"[email protected]", "Don Corleone"=>"[email protected]", "Mc Chick"=>"[email protected]", "Donnie Darko"=>"[email protected]", "Quake The Net"=>"[email protected]", "Dr. Write"=>"[email protected]" ); $result = array(); foreach ($items as $key=>$value) { if (strpos(strtolower($key), $q) !== false) { array_push($result, array( "name" => $key, "to" => $value )); } } echo json_encode($result); ?>

    Read the article

  • Using C struct without including header file

    - by shams
    My basic problem is that I want to use some structs and functions defined in a header file by not including that header file in my code. The header file is generated by a tool. Since I don't have access to the header file, I can't include it in my program. Here's a simple example of my scenario: first.h #ifndef FIRST_H_GUARD #define FIRST_H_GUARD typedef struct ComplexS { float real; float imag; } Complex; Complex add(Complex a, Complex b); // Other structs and functions #endif first.c #include "first.h" Complex add(Complex a, Complex b) { Complex res; res.real = a.real + b.real; res.imag = a.imag + b.imag; return res; } my_program.c // I cannot/do not want to include the first.h header file here // but I want to use the structs and functions from the first.h #include <stdio.h> int main() { Complex a; a.real = 3; a.imag = 4; Complex b; b.real = 6; b.imag = 2; Complex c = add(a, b); printf("Result (%4.2f, %4.2f)\n", c.real, c.imag); return 0; } My intention is to build an executable for my_program and then use the linker to link up the executables. Is what I want to achieve possible in C?

    Read the article

1