Posts

angular - Exportable class with nested object as property -

i'm trying create exportable class has object property in angular 2. reason can bind form using ngmodel. for example, if have object: user: { name: string, address: { street: string, city: string, state: string } } currently have similar this: export class user { name: string; address: any; } is there way make address property same 'user' object without using 'any' tag? seems simple fix, can't seem find answer. thank you you can this: export class user { name: string; // can single object address: { city: string, street: string, state: string }; // can array addresses: { city: string, street: string, state: string }[]; }

ember.js - Get helper in hbs when getting nested object -

suppose have following objects: image: { size: { l: { url: 'l.jpg', }, m: { url: 'm.jpg', }, s; { url: 's.jpg', } } }, mysize: 'm' if want corresponding image url in template, how should that? tried: {{get image mysize 'url'}} but not work. i can url want typing this: {{get (get image mysize) 'url')}} however unintuitive , ugly workaround. there better way? thank you. you need use concat helper along it: {{get image (concat 'size.' mysize '.url')}} but sounds job computed property: imageurl: ember.computed('mysize', 'image.size', function() { let { image, mysize } = this.getproperties('image', 'mysize'); return ember.get(image, `size.${mysize}.url`); }) that way can use {{imageurl}} in template. ember twiddle

php - yii text field validtaion with ckeditor -

i have text field in have used ckeditor <div class="row"> <?php echo $form->labelex($model,'text'); ?> <?php echo $form->textarea($model, 'text', array('id'=>'editor1')); ?> <?php echo $form->error($model,'text'); ?> </div> <script type="text/javascript"> ckeditor.replace( 'editor1' ); </script> rules in model is public function rules() { return array( array('text', 'required'), array('text', 'validatewordlength') ); } public function validatewordlength($attribute,$params) { $total_words= str_word_count($this->text); if($total_words>4000) { $this->adderror('text', 'your description length exceeded'); } if($total_words<5) { $this->adderror('text', 'your description length small'); } } this works fine 1) whe...

android - Option Menu Animation -

Image
how can give slide down animation : <set xmlns:android="http://schemas.android.com/apk/res/android" > <translate android:duration="1000" android:fromydelta="0" android:toydelta="100%" /> </set> for " option menu " opening .like animation : just add line style.xml please add on application main style define in manifest <style name="apptheme" parent="theme.appcompat.light.noactionbar"> <item name="android:popupanimationstyle">@style/animation</item> </style> style.xml : <style name="animation"> <item name="android:windowenteranimation">@anim/your_specific_animation</item> <item name="android:windowexitanimation">@anim/your_specific_animation</item> </style>

winrt xaml - Can timer run in Background Task -

say have 3 pages: p1, p2 , p3 user can navigate p1 -> p2 -> p3 at p3 , need timer keep running , trigger call function @ interval. say, timer call function in every 1 minute interval. 1) timer function: tick = 60; if (_fixedtick > 0) { _fixedtick--; } else { call func(); } the problem: if user navigate p3 p2 , stop timer. i come across background task question a)how build timer call function @ fixed interval. ie: tick =60. b) above (1) timer function way handle timing? c) can some1 show me how create background timer in background task. can use above (1) timer function in background task timer keep running whether user navigate p3 p2. namespace mytimertask { public sealed class firsttask : ibackgroundtask { public void run(ibackgroundtaskinstance taskinstance) { } } appreciate help. thanks no, background task not way go. create simple dispatchertimer in global location static class, static p...

javascript - How to remove blank slide on different devices on flexslider? -

i have created responsive slider using flexslider ipad , iphone. slider have different content on 2 device. let have 1 slide on ipad , 2 slides on iphone. blank slides on ipad, automatically. there magical way remove blank slide on ipad? my css: iphone-only{display:none !important;} ipad-only{display:none !important;} @media (max-width: 320px){ iphone-only{ display:block !important} } @media (min-width:768px) , (max-width:1024px){ ipad-only{ display:block !important} } my html: <div class="flexslider"> <ul class="slides"> <li> <div class"ipad-only"> ipad slide 1 </div> <div class"iphone-only> iphoneslide1 </div </li> <li> <div class"iphone-only"> iphone slide 2 </div> </li> </ul> </div>

javascript - Is it possible to upload multiple files using module "multiparty" in node? -

was using multiparty node module in node app uploading single file. now, want upload multiple files using same multiparty module.i googled not find solution , ended finding 'multer' module in link giving issue existing application. so, there way achieve uploading of file using 'multiparty' ? after many failed attempts , experimentation got answer, have sent form object server client. have check of below code on server side app.post('/multifileupload', function(req, res) { var singlefile; var form = new multiparty.form(); form.parse(req, function(err, fields, files){ var filearry=files.uploadfiles; if(filearry == null ){ res.send('no files found upload.'); return; } for(i=0; i<filearry.length; i++) { newp...