Posts

c++ - Array size at run time without dynamic allocation is allowed? -

i've been using c++ few years, , today saw code, how can legal? int main(int argc, char **argv) { size_t size; cin >> size; int array[size]; for(size_t = 0; < size; i++) { array[i] = i; cout << << endl; } return 0; } compiled under gcc. how can size determined @ run-time without new or malloc ? just double check, i've googled , similar codes mine claimed give storage size error. even deitel's c++ how program p. 261 states under common programming error 4.5: only constants can used declare size of automatic , static arrays. enlight me. this valid in c99. c99 standard supports variable sized arrays on stack. compiler has chosen support construct too. note different malloc , new . gcc allocates array on stack, int array[100] adjusting stack pointer. no heap allocation done. it's pretty _alloca .

embedded linux - Yocto recipe : how to install in specific folder -

i have created yocto recipe program. default folders building image recipe ? @ time of building image, want move files folder like "/opt/xyz". should "mv" or there other options ? thank you i guess want copy compiled program folder such ${bindir} : quote yocto ref-manual 1.1: when specifying paths part of conffiles variable, practice use appropriate path variables. example, ${sysconfdir} rather /etc or ${bindir} rather /usr/bin. can find list of these variables @ top of meta/conf/bitbake.conf file in source directory . you can copy files working directory directory in target filesystem. see hello-world example instance (note example taken 1.1 reference manual, haven't found yet in newer version): description = "simple helloworld application" section = "examples" license = "mit" lic_files_chksum = "file://${common_license_dir}/mit;md5=0835ade698e0bcf8506ecda2f7b4f302" pr = "r0...

php - How to call procedure with select command using PDO? -

i have below procedure purpose of selecting base column contains parameter: create procedure getmap(p_team varchar(100) charset 'utf8') begin select base map map.base = p_team or ver1 = p_team or ver2 = p_team or ver3 = p_team or ver4 = p_team or ver5 = p_team or ver6 = p_team or ver7 = p_team or ver8 = p_team or ver9 = p_team or ver10 = p_team or ver11 = p_team or ver12 = p_team; end // when try call procedure php : function getmap($data){ $query = $this->pdo->prepare("call getmap(:data)"); $query->bindparam(':data', $data); $ex = $query->execute(); $res = $ex->fetchcolumn(); echo $res; if($res){ return $res; } else { return $data; } } it returns exception: call member function fetchcolumn() on non-object how can base column variable select procedure? you calling fetchcolumn on return value execute , that, can see here , boolean value. the method needs cal...

php - redirecting a survey user to last page that he/she was on -

i have been working on survey , done, there's 1 requirement has eaten me up. a user can take survey, , there 6 different sets of questions , each set of questions in question group 1-6. when user question group 1-4 , logs out, he/she should log in , redirected question group 5. far code working , redirecting first 3 pages (questions1.php, people.php , environment.php), refusing rest. i think problem if elseif statement. achieve desired result appreciated. cheers! here code if ($row['userid']==$user){ while($row = mysql_fetch_assoc($result_set)){ if($row['question_group_id']==1 && $row['choosen']==1){ header("location:people.php"); } elseif($row['question_group_id']==2 && $row['choosen']==1){ header("location:environment.php"); } elseif($row['question_group_id']==3 && $row['choosen']==1){ header("location:widerorganization.php"); } elseif($row...

javascript - jQuery .css property not working on scroll function -

i learning jquery implementing properties. having difficulties when i'm trying make div stick top of page when scrolled to. html div: <div class="col span_1_of_2 poll_div" id="poll-div"> <p>poll of week</p> <p>best pakistani singer?</p> <table> <tr> <td width="100%"> <input type="submit" id="op1" onclick="load(this.id);" class="options option1" value="option # 1"/> </td> <td class="numb"> <div id="votes1"><?php $conn = mysql_connect('localhost', 'root', ''); mysql_select_db('poll'); ...

ios - Trying to display image of tableView in circular form but its not showing it at the first time -

- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { sublisttableviewcell *cell = [self.tvfestivallist dequeuereusablecellwithidentifier:@"sublisttableviewcell" forindexpath:indexpath]; cell._img.layer.cornerradius = cell._img.frame.size.width / 2; cell._img.clipstobounds = yes; cell._img.layer.borderwidth = 3.0f; cell._img.backgroundcolor=[uicolor redcolor]; return cell; } i trying display image of tableview in circular form not showing @ first time. when scroll tableview image in cell appearing in circular form

Add multiple columns in custom WordPress table if it does not exist -

this question has answer here: add new column wordpress database 3 answers i make plug-in in word press , create tables, during upgrading plug-in need add columns existing table, want add columns table if not exist in table.how can ? you can use query (change table name , column name) $row = $wpdb->get_results( "select column_name information_schema.columns table_name = 'wp_customer_say' , column_name = 'say_state'" ); if(empty($row)){ $wpdb->query("alter table wp_customer_say add say_state int(1) not null default 1"); }