Posts

internet explorer - Selecting an html radio button dynamically through javascript does not work in IE -

i want select radio button javascript. using simple html file test issue. code below works correctly on firefox , chrome, not work in ie (no version works). know why supplied code not work on ie, , how select radio button in ie? <html> <head> <script type="text/javascript"> function chooseone() { var randomchoice = math.round(math.random() * 2); if(randomchoice == 0) { document.getelementbyid("test0").checked = true; } else if (randomchoice == 1) { document.getelementbyid("test1").checked = true; } else { document.getelementbyid("test2").checked = true; } } </script> </head> <body> <input type="radio" id="test0" name="test" value="a" /> a<br /> <...

big o - C++ - Big-O Notation -

for reason im unable solve this. big-o notation for (int = 0; < n; i++) (int j = 0; j < n; j++) { c[i][j] = 0; (int k = 0; k < n; k++) c[i][j] += a[i][k] * b[k][j]; } for (int = 0; < n; i++) (int j = 0; j < n; j++) { c[i][j] = 0; (int k = 0; k < n; k++) c[i][j] += a[i][k] * b[k][j]; } it looks it's o(n^3) because has 3-level loops.

Good book for Unix Internals -

am interested in unix. want learn in , out. can guys me listing books can make me wizard? want become unix programmer. i not novice user in unix. you want system administration knowledge, or programming knowledge? for programming: advanced programming in unix environment unix network programming the art of unix programming for system administration: automating linux , system administration unix , linux administration handbook

c++ fraction class. overloading operators? -

i making fraction class school project, , brain frying. told overload << , >> operators through friend keyword. i'm getting errors this. i've posted relevant code here: http://pastebin.com/ngcabgj2 the errors include: error c2270: '<<' : modifiers not allowed on nonmember functions (this error ones declared friends) this @ operator< definition. error c2333: 'fraction::operator <' : error in function declaration; skipping function body there's 46 in all... nightmare. edit: thanks, solved errors, there's still 3 error c2664: 'fraction::fraction(const fraction &)' : cannot convert parameter 1 'int' 'const fraction &' occurs @ statement: fraction<int> test1, test2, test3(10); error c2248: 'fraction::operator ==' : cannot access private member declared in class 'fraction' error c2248: 'fraction::operator <' : cannot access private member declared in ...

Why are main runnable Python scripts not compiled to pyc files like modules? -

i understand when import module, file compiled .pyc file make faster? why main file not compiled .pyc ? slow things down? better keep main file small possible then, or not matter? when module loaded, py file "byte compiled" pyc files. time stamp recorded in pyc files. this done not make run faster load faster. hence, makes sense "byte compile" modules when load them. http://docs.python.org/tutorial/modules.html#compiled-python-files [edit : include notes, references] from pep 3147 on "byte code compilation": cpython compiles source code "byte code", , performance reasons, caches byte code on file system whenever source file has changes. makes loading of python modules faster because compilation phase can bypassed. when source file foo.py, cpython caches byte code in foo.pyc file right next source. how byte code compiled files tracked respect python version , "py" file changes: it inserts m...

string - How to replace repeated instances of a character with a single instance of that character in python -

i want replace repeated instances of "*" character within string single instance of "*" . example if string "***abc**de*fg******h" , want converted "*abc*de*fg*h" . i'm pretty new python (and programming in general) , tried use regular expressions , string.replace() like: import re pattern = "***abc**de*fg******h" pattern.replace("*"\*, "*") where \* supposed replace instances of "*" character. got: syntaxerror: unexpected character after line continuation character. i tried manipulate loop like: def convertstring(pattern): in range(len(pattern)-1): if(pattern[i] == pattern[i+1]): pattern2 = pattern[i] return pattern2 but has error prints "*" because pattern2 = pattern[i] redefines pattern2 is... any appreciated. the naive way kind of thing re is re.sub('\*+', '*', text) that replaces runs of 1 or more asterisks 1 asterisk. runs...

php - What is wrong with this MySQL Query? -

it's 12:30am , have been coding 9 hours straight. need project done, mysql messing deadline. examine snippet me , see if can find out wrong? php/mysql query $q = $this->db->query("select * bans ip='".$ip."'"); keeps returning following error... mysql error [oct 6th, 2010 11:31pm cdt] have error in sql syntax; check manual corresponds mysql server version right syntax use near '* bans ip='206.53.90.231'' @ line 1 (1064) i not see wrong query. i've tried different methods of including variable $ip no avail. edit: add in here, ip column in database varchar(255). edit 2: here whole affected code. keep in mind in class. if i'm missing something, let me know. line function if($this->isbanned($_server['remote_addr'])===true) { return json_encode(array('error'=>'you banned shoutbox.')); } affected function function isbanned($ip) { $q = $this->db->query(...