Posts

javascript - setting selected value inside combobox using its name not index -

if i'm rendering combobox this $('#mycombo').html('<option value=""></option>'); $.each(mydata, function (i, v) { $('#mycombo').append('<option value="' + v.personid+ '">' + v.personname + '</option>'); }); how can set selected value inside combobox if v.personname == 'john' p.s. know can set value using it's index $('#mycombo').prop('selectedindex', 2); but in case don't know index, know name. one simple answer $('#mycombo').html('<option value=""></option>'); $.each(mydata, function (i, v) { if (v.personname== 'john') $('#mycombo').append('<option selected value="' + v.personid+ '">' + v.personname + '</option>'); else $('#mycombo').append('<option value="...

Will Python execute finally block after receiving Ctrl+C -

if stop python script ctrl+c, execute blocks, or literally stop script is? well, answer it depends . here happens: python executes code in try:... finally: block a ctrl-c emitted , translated in keyboardinterrupt exception processing interrupted , controls passes block so @ first sight, works expected. but... when user (not you, others...) wants interrupt task hits multiple times ctrl-c. first 1 branch execution in finally block. if ctrl-c occurs in middle of block because contains slow operations closing files, new keyboardinterrupt raised , nothing guarantees whole block executed, , have like: traceback (most recent call last): file "...", line ..., in ... ... keyboardinterrupt during handling of above exception, exception occurred: traceback (most recent call last): file "...", line ..., in ... ... file "...", line ..., in ... ... keyboardinterrupt

javascript - Three.js play multiple animation in same time -

my problem following one: i export blender 3d model in json, animations concatenated on frame, i've succeed play animation want, can't stop @ end, know if there way separate frame multiple animations in order play multiple animations in same time? actually play animation want in frame, search in object , beginning of animation , play that: if ((begintime = this.hasanim(object.parent.animations[0], object.name)) !== false) { var action = object.parent.mixer.clipaction(object.parent.animations[0], object.parent); action.time = begintime; action.play(); } where hasanim find if object or it's children has anim , , begintime in frame of animation in order play after. i assume way not clean , bit disorder, didn't found other way ... add 3d model has not skinned animations.

javascript - How to make specific validation for an input using jquery? -

i'm trying validate input time 00:00 pm or am. have done 00:00 mask() validation, i'm unable extend validation 00:00 or pm. i tried below code validation. $("#phone").mask("00:00"); but want give permission user put value in (00:00 or pm) format. appreciate if help. thank use selector inputmask validate input $("#phone").inputmask({ mask: "h:s t\\m", placeholder: "hh:mm xm", alias: "datetime", hourformat: "12" }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://rawgit.com/robinherbots/inputmask/3.x/dist/jquery.inputmask.bundle.js"></script> <input type="text" id="phone"/>

android - How to know Vendor ID for Ark Benefit S502Plus smartphone? -

in this tutorial tried connect smartphone android studio on linux mint. how can know vendor id? this page hasn't id ark. sorry bad english , help! :) you can vender id through command lsusb list usb buses , device details, or discover command open terminal , run: lsusb or: discover --vendor-id --model-id usb

php - Insert and select data from MySQL in WordPress Page -

i designing wordpress website, thorough design part, next phase database related things. 1. insert data database. 2. select data , display in page. 3. need create php page if dont want install widget.? need place code? i have googled plugin , got php code widget plugin , inserted 1 of pages widget i tried installing insert_php plugin not working continuing php_code_widget pages-> pages-> home page -> add row -> add widget -> php code widget. now in mysql database have simple table called rituals having 3 columns ritual id-> int -> auto increament. ritual_name-> varchar ritual_active-> varchar. now need insert ritual name database, , reference got code , have put in php code widget window. <?php require_once('../../../wp-load.php'); function insertuser(){ if(isset($_post['submit']){ global $wpdb; $rname=$_post['rname']; $ractive=$_post['ractive']; $table_name = $wpdb->prefix . "mahathiw...

c# - About Resizing Buttons on PictureBox -

Image
i have project using a map animation(gif file) on picturebox . on map, have 4 buttons should on main streets. i have problem resizing form. in example, when resize: as can see, button locations incorrect. form layout order : mainform > tablelayoutpanel > panel > picturebox > buttons is there suggestion ? in advance note : when use static image panel instead of picturebox, works. must use gif image. ok if suggest also.