Posts

c# - Function Running Sync When VS Says it should be running async -

why b run sync? vs says ."because call not awaited, execution of current method continues before call completed." ; a) task.factory.startnew(() => funcation(1, 1)); //runs async b) funcation(1, 1); // says runs async in vs, runs sync. c) var handleone = task.run(() => { funcation(1, 1); }); // runs async d) await task.factory.startnew(() => funcation(1, 1)); //awaits correctly e) await funcation(1, 1); //awaits correctly static private async task<int> funcation(int x, int y) { task.delay(1000).wait(); } the funcation using async keyword not await in it's body run synchronously. function not compile. a) task.factory.startnew(() => funcation(1, 1)); //runs async here create thread , on thread call function asynchrounsly because running on thread. b) funcation(1, 1); function marked async not await ed invoked. in case compiler not check whether function using await in it's body...

express - How to check & confirm if dropzone is actually sending file to server -

i using dropzonejs , using following code initialize dropzone: var mydropzone = new dropzone("div#myid", { url: "/file/post"}); on server side, using expressjs\nodejs & using following code: fs.readfile(req.files.displayimage.path, function (err, data) { // ... var newpath = __dirname + "/uploads/uploadedfilename"; fs.writefile(newpath, data, function (err) { res.redirect("back"); }); }); problem req.files coming undefined. i want know when upload file, there way through developertoolbar check payload & confirm whether file been sent or not?

ExpressJS Fetching value from nested JSON Object -

i using expressjs..when trying fetch value req.body, in console.log(req.body[ndx])(it prints { " c o..... single character) for (var ndx in req.body){ console.log(req.body[ndx]); } my req.body has below nested json object: how extract count? req.body["count"] outputs undefined {"count":1,"totalcount":38,"node":[{"categories":[],"foreignsource":null,"foreignid":null,"label":"172.20.96.20","assetrecord":{"description":null,"operatingsystem":null,"category":"unspecified","password":null,"id":2655,"username":null,"vmwaremanagedentitytype":null,"vmwaremanagementserver":null,"numpowersupplies":null,"hdd6":null,"hdd5":null,"hdd4":null,"hdd3":null,"hdd2":null,"hdd1":null,"storagectrl":null,"thresholdcateg...

android - Why doesn't the subtype of this custom MIME type specify the particular row (from Content URI) in the table? -

at end of the developer guide , have described vnd.android.cursor.dir type part of every custom mime type, multiple rows; , vnd.android.cursor.item single row. then there example of content provider contains train timetables. it's authority com.example.trains , has tables line1 , line2 , , line3 . , it's content uri content://com.example.trains/line2/5 which pointing " 5th row in line2 table ", mime type returned be: vnd.android.cursor.item/vnd.example.line2 which not indicate row is. questions: i think should be like: vnd.android.cursor.item/vnd.example.line2.5 because type part describe mime type particular row, subtype should describe row is. isn't it? if vnd.android.cursor.item/vnd.example.line2 correct, means not matter if mime type of particular row. does mean rows in table have same mime type? because mime type type of files on internet. ( reference ) think since rows have same "types" of data (or in other words r...

php - How to add an image in a section of a one-page website -

Image
this question has answer here: php parse/syntax errors; , how solve them? 11 answers i'm building one-page theme on wordpress. i have text on left hand side , insert picture on right when tried add picture in through code error message: parse error: syntax error, unexpected 'template_directory' (t_string), expecting ',' or ';' in /var/www/wordpress/wp-content/themes/cvtheme2015/front-page.php on line 21 is there forums or video tutorials me ? <div class="indent"> <section id="meet"> <?php $query = new wp_query('pagename=about-us-single'); //the loop if ($query ->have_posts()){ while ($query->have_posts() ) { $query->the_post(); echo '<h1 class="section-title"...

c++ - Why do the const accessors of std::string return a reference? -

the std::string accessors ( back , front , at , , operator[] ) have const , non- const overloads, below: char& x(); const char& x() const; why second version return const reference , opposed returning char by value (as copy)? according rules of thumb on how pass objects around , shouldn't small objects passed value when there's no need modify original? because caller might want reference char, reflects changes made through non-const avenues. std::string str = "hello"; char const& front_ref = static_cast<std::string const&>(str).front(); str[0] = 'x'; std::cout << front_ref; // prints x

Xml Configuration File Reader in Java -

i wanted read xml configuration file in java , found library - commons-configuration . task me. wondering why implementations tries use either jaxb or stax parse xml , reinvent wheel above library task easily. i wanted know pros of using jaxb or stax against library read xml configuration file.