Posts

c - Why is my input delayed when sent to process via pipes? -

i'm writing program operating systems project meant modem keyboard in type key , outputs fsk-modulated-audio-signal corresponding ascii value of key. how i've set program forks process , execs program called minimodem ( see here info). parent set non canonical input mode , gets user input character @ time. each character sent child via pipe. i'll paste code now: #include <stdlib.h> #include <fcntl.h> #include <errno.h> #include <unistd.h> #include <stdio.h> #include <sys/ioctl.h> #include <string.h> #include <termios.h> extern char* program_invocation_short_name; static struct termios old, new; void init_termios(int echo); void reset_termios(void); int main(int argc, char* argv[]) { pid_t pid; int my_pipe[2]; char* baud = "300"; if (argc == 2) { if(atoi(argv[1]) == 0) { printf("use: %s [baud]\n",program_invocation_short_name); return exit_success; } baud = argv[1]; } i...

android - xml box layout or other suggestions -

i programming android app making work-fiches, main screen needs show summary of:working hours, parts used, remarks, ... , how can design in xml these boxes best way? need title, summary content, clickable,... android design guidelines doesn't give me solution it, difficult find example of know xml attributes use, frame layout helping me first seems give me problems now, thanks ideas in advance. i suggest go relative layout , best layout present requires minimum no. of lines compared other layouts , align views respect each other. if want views divided in proportion recommended use linear layout using weight concept.

python - bitwise NOR Gate - what does & mean? -

this question has answer here: how bitwise nor gate in python (editing python maths work me) 2 answers i'm trying understand code answer received yesterday: 2nd: how make bitwise nor gate 1st: how bitwise nor gate in python (editing python maths work me) a=0b01100001 b=0b01100010 bin((a ^ 0b11111111) & (b ^ 0b11111111)) i understand except: the & between 2 values and ^ 11111111 ( know 0b base 2 ) can please explain these? how nor works? the expression x nor y can broken using and , or , , not : x nor y == not(x or y) == not(x) , not(y) so, given values: a=0b01100001 b=0b01100010 a nor b not(a) , not(b) . think how not(a) ? need flip bits. way flip bits? xor(^) . how? 0 ^ 1 == 1 1 ^ 1 == 0 so, taking xor of bit 1 flip bit. i.e. not(somebit) == xor somebit . so, in case, take xor of each bits in a , b 1 not...

c++ - How to create a static constant member std::string array? -

i cannot believe sounds simple can hard. class outputhandler { private: static std::string const errorprefixes[] = {"info", "warning", "error", "crash"}; }; how do properly? various documentations understand cannot initialize static member objects, regardless of them being constant. write initialization outside class, definition: class outputhandler { private: static std::string const errorprefixes[]; }; std::string const outputhandler::errorprefixes[] = {"info", "warning", "error", "crash"}; (the definition of course subject one-definition-rule , must appear in 1 single translation unit, e.g. outputhandler.cpp .)

depth function usage in opengl es 2.0 -

i tried use gldepthfunc in opengl es 2.0 (at pc emulator) , don't understand behavior. in init function call define these values: glcleardepthf( 0.5f ); glclearcolor ( 1.0f, 0.0f, 0.0f, 0.0f ); and in drawing function code: glclear ( gl_color_buffer_bit | gl_depth_buffer_bit); glenable( gl_depth_test ); gldepthfunc(gl_lequal); gluniform4fv(unifcolor, 1, vercolor); gldrawarrays ( gl_triangle_fan, 0, 4 ); eglswapbuffers i'm drawing green square (half of screen size). when z value of drawn square 0.5. i expect depth test true , i'll see green square drawn, see red screen (the color used in clear color). when define clear depth value 1.0 receive expected behaviour: grren squar on red screen, think depth used needed (all initialzed defines depth). what can problem? thanks there things go wrong. there might precision issues. however, have guess here: i'm drawing green square (half of screen size). when z value of drawn square 0.5. wrrit...

vb.net - Complex MsgBoxResult.No function VISUAL BASIC -

i've made button1 if click on it starts timer. in timer_tick typed label7.text = "l o d n g". i've made exit (button2). want code if label7.text = "l o d n g" msgboxresult.no in button2 button1.enabled = true . here video how want that: http://www.youtube.com/watch?v=4uryhd0xa8i&feature=youtu.be here code button2 (exit) dim msg string dim title string dim style msgboxstyle dim response msgboxresult msg = "are sure want exit?" ' define message exit." style = msgboxstyle.defaultbutton2 or _ msgboxstyle.question or msgboxstyle.yesno title = "exit" ' display message. response = msgbox(msg, style, title) if response = msgboxresult.no if label7.text = "l o d n g" button1.enabled = true button5.enabled = false textbox1.enabled = true end if end if if response = msgboxresult.yes me...

jquery - Code is working fine in chrome, but not in IE and Firefox -

i have code here. working fine in chrome, not in ie , firefox. $(document).ready(function(){ $(".thumb").click(function(){ alert ("reached here."); var cat_id = $(this).attr('id'); // category id alert (cat_id); }); }); <a href="#" class="thumb" id = "20" name="df" > <img src="images/dry_fruits.png" alt="title #0" width="75" height="75"/> </a> its not hitting alert in firefox , ie. can please me identify issue. any highly appreciated. devesh keeping done in 1 call $(document).ready ensures no problems race-conditions etc in order functions added called. if 1 function adds element dom , require presence might conflicts , unexpected behavior due varying calling order...