Posts

visual c++ - Array allocation in C++ on stack with varying length -

this question has answer here: c++: why int array[size] work? 3 answers i surprised find out possible allocate varying-length array on stack in c++ (such int array[i]; ). seems work fine on both clang , gcc (on os/x) msvc 2012 don't allow it. what language feature called? , official c++ language feature? if yes, version of c++? full example: #include <iostream> using namespace std; int sum(int *array, int length){ int s = 0; (int i=0;i<length;i++){ s+= array[i]; } return s; } int func(int i){ int array[i]; // <-- feature i'm talking (int j=0;j<i;j++){ array[j] = j; } return sum(array, i); } int main(int argc, const char * argv[]) { cout << "func 1 "<<func(1)<<endl; cout << "func 2 "<<func(2)<<endl; cout << ...

Python - read from file skip lines starts with # -

try read file , make dictionary lines, skippipng lines starts # symbol file example: param1=val1 # here comment my function: def readfromfile(name): config = {} open(name, "r") f: line in f.readlines(): li=line.lstrip() if not li.startswith("#"): config[line.split('=')[0]] = line.split('=')[1].strip() return config i list index out of range error but! if try skip lines starts with, example, symbol "h" - function works well... try with: def readfromfile(name): config = {} open(name, "r") f: line in f.readlines(): li = line.lstrip() if not li.startswith("#") , '=' in li: key, value = line.split('=', 1) config[key] = value.strip() return config you maybe have blank line breaks split()

MYSQL datetime to mongoDB -

i have converted mysql db mongodb. one field, publish_datetime mysql datetime field. in mongo, need todo ordering datetime field. is possible without converting seperate field timestamp? it not matter type is, sorting either datetime value or integer value happens with: db.collection.find().sort( { field_name: 1 } ); however, helpful if showed sample document has "datetime" value in there.

onclick - VBA - populate cell from different sheet on mouse click -

the problem facing is, require cell autopopulate cell reference in different sheet within same workbook when user clicks cell. e.g. 1) user clicks a1 on sheet 1 2) cell a2 on sheet 1 populates value cell a1 in sheet 2 i need function span approximatly 80+ references, in other words have list of on 80 project names in sheet 1 a1= projectname 1 a2= projectname2 , on. sheet 2 has of project descriptions...a1 project1 descroption..a2 project2 description , on. i believe looking worksheet_selectionchange event. in sheet selecting add following: private sub worksheet_selectionchange(byval target range) if target.column = 1 ... end if end sub this method gets called anytime select new cell.

php - How to find storage location of images in tiny mice -

i'm in process of migrating data k-ecommerce platform magento ecommerce platform. stuck getting product images k-ecommerce platform. in backend, using tiny mce editor upload images , direct uploads there. find of product images in shown image folder. others not found. suspect, 'shown images' direct upload images , 'not found images' uploaded through tiny mce editor. tiny mce store images in database? can give me clue find images uploaded through tiny mce editor. 'filesystem.rootpath' configuration in config.php sets upload folder edit image path of in tiny mce popup this. again suspect data database. ../../stream/index.php?cmd=im.streamfile&path={0}/product_folder/image_name.jpg thanks. well, not familiar tinymce uploadmanager, think images stored here: tiny_mce/plugins/imagemanager/files/

html - Make a Menu div spread in the middle and work in smaller screens -

i'm building website client, , 1 of last problems can't solve menu issue. believe might helpful other people. the menu has 3 div s inside (the parent div ) . here code, bit shortened: <div id="header"> <div id="logo"><img src='logo.png' /></div> <div id='languageselect'>language select</div> <div id="menu"> <ul id="menu_noya"> <li class="head_item"> <a href="index.php?page=women">{$language["menuwomen"]}</a> <ul> <li><span style='color:#352618;font-family:tahoma;font-size:11px;font-weight:bold;'>{$language["inmenuwomen"]}</span></li> <li><a href='index.php?page=women'><img src='/styles/images/women1.jpeg' style='height:170px;width:120px;...

asp.net - Getting Error while adding new MVC 4 Project -

Image
i new mvc. have installed nuget extension when had installed mvc 4. after had run cleaner because of think temp files have been deleted. when trying add new mvc 4 project shows me following error : i have uninstalled nuget still facing same problem, please me how can come out of this. for reason, nuget package manager not installed default. came across problem few times already. what want this. first : need unistall npm(nuget package manager) , did already, can try again, sure :) visual studio -> tools -> extensions , updates -> npm -> unistall second : after unistall npm, need install again use (ofc). there several ways install npm: 1) install under visual studio -> tools -> extenstions , updates> npm -> install 2) goto http://nuget.org , search install nuget link , click on it, downlaod .vsix file , install in on visual studio third : after installation, close , re-open visual studio, never error again.