Posts

.net - What is the proper way to manually check and uncheck a RadioButton when the AutoCheck property is set to false in C#? -

i have set of radio buttons, , 2 of them need prompt user confirmation dialog before allowing value change. this, handle click event , set autocheck property false on each of these radio buttons. however, selected radiobuttons no longer unchecked when set check property true on clicked radiobutton. right i'm looping through controls on panel , making sure none of other radiobuttons checked, there more efficient way this? you can use variable store last checked radiobutton: //first, have set lastchecked = radiobutton1 (or of radiobuttons) radiobutton lastchecked; //click event handler used radiobuttons private void radiosclick(object sender, eventargs e) { radiobutton radio = sender radiobutton; if (radio != lastchecked){ radio.checked = true; lastchecked.checked = false; lastchecked = radio; } //else radio.checked = !radio.checked; } if want allow user uncheck radio (a strange behavior), remove // before else clause in code ...

c++ - "printf" appears to be non-deterministic in Qt? -

i know "printf" standard-c , should deterministic. when run in qt see more non-deterministic response(clock cycles). due qt adding "pork" response? i have multiple threads make call function uses mutex. when 1 thread enters set switch others can't until done. things appeared work ok acouple seconds , threads appeared killed off 10 1 thread. tried adding delay: (k=k+1: no help), (looping k=k+1: no help), (usleep works), , (printf) work @ creating random delay , allowing threads continue running. void ccb::write(int ithread) { static bool buse = false; bool bdone = false; char cstr[20]; int poswrite;// = *m_poswrite; // issue of poswrite altered next extrance long k = 0; long m = 0; m_threadcount++; while(bdone == false){ if(buse == false){ buse = true; poswrite = *m_poswrite; memcpy(m_cmmessagecb + poswrite, &m_cmmessagewrite, sizeof(typecanmessage)); me...

jQuery width toggle moves the div to the left -

i have script http://jsfiddle.net/z8cuz/2/ code: $('.list').hide(); $('.close').hide(); var widthval = false; $('#left').click(function () { if (widthval == false) { $('#middle').hide('fade', 300); $('#right').hide('fade', 300, function () { $('#left').find('.list').show(); $('#left').find('.close').show(); $('#left').animate({ width: "96%", opacity: 1 }, 1000); }); widthval == true; } }); $('#middle').click(function () { if (widthval == false) { $('#left').hide('fade', 300); $('#right').hide('fade', 300, function () { $('#middle').find('.list').show(); $('#middle').find('.close').show(); $('#middle').animate({ ...

regex - tcl: parse string into list -

i'm trying parse string flat list in tcl. the string has format of name1='value1',name2='value2',name3='value3' i'm wondering if there's way capture names , values list looks this: {name1 value1 name2 value2 name3 value3} note name or value may contain includes characters ' or = or , well, possible set data {name1='value1',name2='value2',name3='value3'} foreach {- key value -} [regexp -all -inline {(.*?)='(.*?)'(,|$)} $data] { lappend result $key $value } note : if key occurs once, suggest using dicts ( dict set result $key $value ).

asp.net mvc - ExactTarget - How to add dynamic user created content in an Email Template -

we have email being created in end code (c#) , sent through exacttarget api. want move template in exacttarget don't have maintain html written in stringbuilder() in c#. issue content of email determined user inputs. user fills out form of samples want email sent person fulfill order. so example be: <tr> <td>product number</td> <td>quantity</td> </tr> <tr> <td>product number</td> <td>quantity</td> </tr> the maximum number of samples can ordered 16. there way loop through content posted exacttarget create correct number of rows instead of hard coding 16 rows template , half of them being blank. please let me know if need more specific anything you try creating partial view below, @model ienumerable<cartitems> <table> @foreach(var item in model) { <tr> <td>@item.number</td> <td>@item.quantity</td> <tr> } </ta...

loops - Populating Bash array fails -

here simple command running in bash, array won;t populated reason. array=() && sudo iwlist wlan0 scan | grep 'address'| while read line; array[${#array[@]}]=$line; done i have tried populate array way: array=() sudo iwlist wlan0 scan | grep 'address'| while read line; array+=($line); done but gives me same result. know works because when this: sudo iwlist wlan0 scan | grep 'address'| while read line; "echo $line"; done it print every line piped grep while loop. when check size of array " echo ${#array[@] " show 0 , if print array prints nothing. see errors in line? **update. got working using loop so: for line in $(sudo iwlist wlan0 scan | grep 'address' -a5); array+=($line); done bash faq entry #24: "i set variables in loop that's in pipeline. why disappear after loop terminates? or, why can't pipe data read?" the while loop [...] executed in new subshell own copy of varia...

java - Append an element in a XML using DOM keeping the format -

i have xml this <?xml version="1.0" encoding="utf-8" standalone="no"?> <empleado> <consultortecnico> <nombre>pablo</nombre> <legajo antiguedad="4 meses">7778</legajo> </consultortecnico> <cnc> <nombre>brian</nombre> <legajo antiguedad="1 año, 7 meses">2134</legajo> <sueldo>4268.0</sueldo> </cnc> </empleado> what want read xml , append "sueldo" @ same level "nombre" , "legajo" in element "cnc". "sueldo" must "legajo" x 2 the code have appends "sueldo" can see in xml above not indent should, im using propierties indent (this xml created same way, using dom) public class main { public static void main(string[] args) { try { file xml = new file("c:\\empleado.xml"); if (xml.exists()...