Posts

Featured post

c# - How can I have the VS Debugger break in the correct location for exceptions thrown in Async methods in a Console App? -

i'm writing console app uses lots of async methods; i've made async main method can await in: static void main(string[] args) { mainasync(args).wait(); } static async task mainasync(string[] args) { // can use await here } however, when exception occurs; debugger break me on .wait() call. not experience. is there can debugger breaks exception occurs rather here? i'm using vs2015 , targeting .net 4.6 if influences answer.

php - Issues outputting data after prepared statement with loops -

i having major difficulties figuring out doing wrong in while , foreach loops in code below. having tendency mix object-oriented , procedural mqsqli, everytime think have right, error. what doing wrong in loops have in code? right error warning: mysqli::query() expects parameter 1 string, full code try { $con = new mysqli("localhost", "", "", ""); if (mysqli_connect_errno()) { throw new exception("connect failed: %s\n", mysqli_connect_error()); exit(); } $cid = $_get['cid']; $tid = $_get['tid']; $userid = ( isset( $_session['user'] ) ? $_session['user'] : "" ); echo $cid . "<br>"; echo $tid; //prepare if ($stmt = $con->prepare("select * forum_topics `category_id`=? , `id`=? limit 1")) { $stmt->bind_param("ii", $cid, $tid); //$stmt->fetch(); if (!$stmt) { throw new exception($con->error); } } ...

c# - Why Does .NET 4.6 Specific Code Compile When Targeting Older Versions of the Framework? -

this question has answer here: does c# 6.0 work .net 4.0? 3 answers i have project targets older versions of .net framework (.net 4.5.2). installed visual studio 2015 (and therefore .net 4.6 on machine). noticed if use c# language features released in .net 4.6/c# 6, still compiles. if project's target framework < .net 4.6, shouldn't not compile: public string myexpressionbodyproperty => "1"; //auto properties new in c# 6 public string myautoproperty { get; } = "1"; private static void methodthatusesnameof(string filename) { if (filename == null) { //nameof released in c# 6 throw new argumentexception("the file not exist.", nameof(filename)); } } how can ensure i'm using .net language features work framework version i'm targeting? ...

javascript - How to pass a property by reference -

is there way pass object property function reference instead of value? es5 properties can have getters , setters. how pass variable uses getters , setters instead of result of getter? right have pass reference whole object, not single property want. is there way pass object property function reference instead of value? no. in fact doesn't make lot of sense "pass object property", notion of "property" doesn't exist without entity property of. if matter of encapsulation , not wanting leak full control, can creative. e.g., var obj = { sensitive: 'do not share me!', public: 'hi there', setpublic: function(val) { this.public = val; } }; function somefunction(setter) { setter('new value'); } somefunction(obj.setpublic.bind(obj));

computer vision - How to match orientation and scale of two different image of the same object in OpenCV? -

i have 2 images of printed circuit boards (pcb) both showing same pcb. differences between them lighting, scale , orientation (because take pcb images phone camera). now want use 1 image of pcb check if components of circuit assembled on identical pcb. is there convenient way check differences between 2 images of 2 identical pcb? btw, can add marks on pcb in opencv can correct orientation , scale of image. pcb = printed circuit board, right?!? you compute projective projective transformation or homography between matched points in both images. transformation can used match planes (like pcbs) , considers scale, rotation, shear , projective changes between images. it's simple method: select @ least 4 points , solve system of linear equations. take @ answer question on math se explains that. this opencv example uses (automatic) feature matching find corresponding image points , computes homography. the interesting derivation of transformation can found ...

html - Add copy button in Javascript -

i'm trying add button copy text textarea using zeroclipboard, however, when click button, nothing happens , when paste nothing has been added clipboard. var clip = new zeroclipboard( document.getelementbyid("btn4"), { moviepath: "https://rawgit.com/zeroclipboard/zeroclipboard/master/dist/zeroclipboard.swf" } ); clip.on( "load", function(client) { // alert( "movie loaded" ); client.on( "complete", function(client, args) { // `this` element clicked this.style.display = "none"; } ); } ); <div id ="right" style = "float:left; width: 10%; margin-left:185px; margin-top:35px"> <button id="btn4" data-clipboard-target="block2" name ="btn4" type="button" class="btn btn-success"><i class="icon-white icon-file"></i> copy</button> <script src="https://rawgit.com/zeroclipboard/zeroclipboard...

How to make Wordpress custom field input text translatable with qTranslate X? -

i have wordpress custom fields (i'm not using acf or other plugin this) , need translate them using qtranslate x in wp-admin. the fields created wp_editor working, don't know how make work default <input type="text"> other custom fields have. below, piece of code i'm using set variable , show field: $services = isset( $values['services'] ) ? esc_attr( $values['services'][0] ) : ''; wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' ); ?> <table> <tr> <td> <input type="text" name="services_title" value="<?php echo !empty($services_title) ? $services_title : ''; ?>" style="width: 100%" /> </td> </tr> </table> then, i'm saving with: add_action( 'save_post', 'hotelsavedata' ); function hotelsavedata( $post_id ) { // bail if we're doing a...