Posts

Showing posts from April, 2014

javascript - setTimeout is not working correctly inside "for loop" -

now of course, code make do. but i'm confused why in following code: var = { 0: "hi", 1: "bye" } (var b in a) { settimeout(function () { console.log(b); }, 1000); } instead of consoling "0" , "1" i "1" twice. i'm not sure why happens. need setup script making same issue. it because usage of closure wrong. in case using closure variable b inside settimeout callback, value of variable b not looked until callback executed, value of updated last value in object. one of solution in such case create local closure given below for (var b in a) { (function(c){ settimeout(function () { console.log(c); }, 1000); })(b) } demo: fiddle

c++ - How can I make an object immutable in the Google V8 Javascript engine? -

is possible make object immutable in v8 javascript engine? v8 embedded in c++ application. in case i've created , populated array (code simplified) auto arr = v8::array::new(isolate, 10); (auto = 0; < 10; ++i) { arr->set(context, i, v8::integer::new(isolate, i)); } i'd make resulting object "read-only" (as might calling object.freeze ) before passing script. 1 of script authors got in confusing situation trying re-use object convoluted way, , i'd make harder happen making object immutable. i understand can in javascript ( object.freeze ), able in c++ if possible. this approach works, although it's little inelegant. essentially, i'm calling "object.freeze" directly in javascript, couldn't find way invoke functionality c++. i'm less fluent in v8, code may unnecessarily verbose. /** * make object immutable calling "object.freeze". * https://developer.mozilla.org/en-us/docs/web/javascript/reference

java - ArrayList size() method crashing program -

i developing game using lwjgl 3.0.0b , strange occurrence has come up. background: i have custom entity class , entity manager store entities in. when entity updated method gets called named " ticktrail " adds in trail entity make graphics visually better , entertaining. already have simplified down entities.size() function, yes try solve myself :p a solution have replacing methods similar this: for (int = 0; < entities.size(); i++) { //calls method drawing, updating, or input } to replace every single entities.size() size . size being variable changed upon when entity added, removed, list cleared, or enemies removed. this method work 100%, window dragging not crash program using method. question so sum up, final question why occur? haven't determined why dragging window , using arraylist's size() method crashes program, yet storing variable in place fine. any or explanation strange phenomenon highly appreciated :) edit last edit pro

Excel VBA: Error in file format when saved using VBA -

Image
i trying format contents of excel file, , automatically save in specified location specified name via dialog box. have codes below, experiencing issues file format after save file. issue excel prompts me: this code allows me format excel file format require, , automatically shows location , file name want save in. codes allows me save me excel file successfully. however, when try open it, tells me file corrupted, or extension wrong. does know why experiencing error? thanks! code: option explicit sub externalratingchangefile() 'declare data type of variables dim wks worksheet dim lastcol integer dim lastrow long dim icol integer dim irow long dim sfilename string dim fdlg filedialog dim xlsxfileformat xlfileformat 'set wks current active worksheet set wks = activeworkbook.activesheet set fdlg = application.filedialog(msofiledialogfilepicker) 'set location save file variable sfilename = "h:\testing file\rating change - " + format(date, "yyyymm

javascript - Dropdown Menu not working on Index.html after adding java script -

i creating personal website can not drop down work on desktop when on mobile devise hide nav , click(using js) show nav. not working on index.html <div class="content"> <div class="header"> <div class="logo"><a href="assets/img/logo.png" alt="gm">gm</a> </div> <span class="menu-trigger">menu</span> <nav class="nav clearfix"> <ul class="clearfix"> <li><a class="active" href="index.html">home</a> </li> <li><a href="about.html">about</a> </li> <li><a href="#">portfolio <i class="fa fa-angle-down fa-1"></i></a> <ul class="sub-nav">

apache spark - How to declare Iterator and DenseMatrix type variable in operation mapPartition of RDD? -

i have double array in mappartition of rdd,and when declare iterator or densematrix double array.i found iterator , matrix empty.my test codes below: val randxts = data.map{ line => val fields = patterns.findallin(line).toarray.map(_.todouble) fields(fields.length-1) }.repartition(2) val res = randxts.mappartitions(x=>{ val matrix = new densematrix(x.length,1,x.toarray) val arr = matrix.toarray println(k.length) (matrix::list[densematrix[double]]()).iterator }) as shown above,the line declare matrix cause error.the error message below: java.lang.indexoutofboundsexception: storage array has size 0 indices can grow large 124 how can fix problem? your code calls x.length , passes x again densematrix constructor. since x iterator, calling length "consumes" iterator, hence passing again result in empty collection. to fix - scan iterator once (by converting array): val res: rdd[densematrix] = randxts.mappartitions(x => { val arr = x.to

PHP mail reply to sender instead of server email -

can point out getting form wrong? instead of being able reply " email " sender server email. here php code: <?php $name = $_post['name']; $email = $_post['email']; $message = $_post['message']; $from = 'from: business.com'; $to = 'anyone@gmail.com'; $subject = 'a new message website business.com'; $human = $_post['human']; $headers = 'from: info@business.com' . "\r\n" . 'reply-to: ' . $email . "\r\n" . 'x-mailer: php/' . phpversion(); $body = "from: $name\n e-mail: $email\n message:\n $message"; if ($_post['submit']) { if ($name != '' && $email != '') { if ($human == '4') { if (mail ($to, $subject, $body, $from)) { echo '<p>your message has been sent!</p>'; } else { echo &#

sorting - unit test for Perl's sort -

i try use (class) method in object sorting object instances. package something; use strict; use warnings; use data::dumper; sub new { ($class, $date) = @_; $self = bless{}, $class; $self->{date} = $date; return $self; } sub _sort($$) { print stderr dumper($_[0], $_[1]); $_[0]->{date} cmp $_[1]->{date}; } package somethingtest; use base 'test::class'; use test::more; __package__->runtests() unless caller; sub sorting : test { $jan = something->new("2016-01-01"); $feb = something->new("2016-02-01"); $mar = something->new("2016-03-01"); is_deeply( sort something::_sort [$feb, $mar, $jan], [$jan, $feb, $mar]); } i've seen snippet in perldoc -f sort , hence prototype _sort . # using prototype allows use comparison subroutine # sort subroutine (including other package's subroutines) package other; sub backwards ($$) { $_[1] cmp $_[0]; } # $a , $b

javascript - using ajax to get data from database -

everyone. trying use ajax data server , not work. got stacked on problem couple days , have no idea how handles. point out how can solve problem? thanks function loadxmldoc() { user_input = document.getelementbyid('u_name').value; var url_s = url_seller + user_input; var url_b = url_bidder + user_input; var req = new xmlhttprequest(); req.onreadystatechange = function() { if (req.readystate == 4 && req.status == 200) { var res = json.parse(req.responsetext); } }; req.open("get", url_s, true); req.send(); } i call function using button submit

c# - Multiple models in one view ASP.Net -

i new asp.net mvc. have 3 models employee , address , store . structures follows... employee:- empid(pk), empname, rank, storeid, addid store:- storeid(pk), branchname, addid address:- addid(pk), address, phone, id(fk employee.empid, fk store.storeid) how use 3 models in 1 controller , how perform crud operations in controller. in view of employee , want show fields of 3 of models, e.g. empid, empname, rank, store.branchname, address, phone when update these fields in view, models should updated. know if how use multiple models without relationship between them. thanks. this view model comes in handy. allows separate database layer fields , logic presentation layer fields. you can combine several database entities , expose elements of each want display on front end. for example, might define view model like: public class employeeinfo { public string employeename {get;set;} // other properties public employeeinfo(employee emp, store st

ios - Universal Link opens wrong bundle ID -

background: our app uses different bundle ids development builds vs beta builds vs production (app store) builds i implementing universal links in our development builds our production build in app store not support universal links i experiencing crazy issue not universal links not opening development version of app, launching production version instead, despite production version not having proper entitlements . my apple-app-site-association file has been validated using both https://branch.io/resources/universal-links/ , https://search.developer.apple.com/appsearch-validation-tool/ , looks so: { "applinks": { "apps": [], "details": [ { "appid": "dy74r9xxxx.com.myapp.consumer.debug", "paths": [ "/profiles/*", "/messages/*"] }, { "appid": "dy74r9xxxx.com.myapp.consumer", "paths": [ "/profiles/*&

Website on Ajenti V with Node.JS content always throw 404 -

i install ajentiv manage website. have webapp on nodejs , want use ajentiv. follow simple tutorial setting node.js website ajenti v (keystone example) . config content of website node.js, provide script , config port 8080. use port 8080 node app, there no error try webapp throw 404 - not found result, in both port 80 , 8080. has met problem before? how can make works? thank in advance! :) sorry, bad. there no problem ajentiv , node.js content. problem our webapp throw 404 due fault config.

postgresql 9.4 - Building a primary key with Json columns -

i trying set unique constraint across rows, in of them json data types. since there's no way make json column primary key, thought maybe can hash desired columns , build primary key on hash. example: create table petshop( name text, fav_food jsonb, md5sum uuid); i can following: select md5(name||fav_food::text) petshop; but want performed default and/or trigger insert md5 sum column md5sum . , build pkey on column. but really, want know if json object unique, , not restrict keys in json. if has better idea, helps!

php - Error while requiring a file situated in another folder in Yii -

when trying refer file named androidnotificationpush.php using require in file. why getting error: require_once(/home/abhi/mango/siweb/protected/modules/rest/v10/components/helpers/androidpushnotification.php): failed open stream: permission denied ?

c# - Binding selected items to list<t> in viewmodel -

i have following property in view model: public list<departments> departmentlist { { return newtechnician.departmentlist; } set { newtechnician.departmentlist = value; onpropertychanged("departmentlist"); } } i have datagrid bound list, following values public class departments { public int departmentid { get; set; } public string departmentdescription { get; set; } public int requestaccess { get; set; } public int queueaccess { get; set; } public int departmentstatus { get; set; } public bool selected { get; set; } } i need able insert departmentid selected rows database. how can bind values departmentid based on selected rows in either existing list or new list. (the selection mode set extended) foreach (departments department in createnewtech.selecteddepartments) { if (department.selected == true) { sql = @"insert tech_department_link values(@techid,@departmentid)";

swift - Most performant method of processing video and writing to file - ios AVFoundation -

i want read in video asset on disk , bunch of processing on it, things using cicropfilter on each individual frame , cutting out mask, splitting 1 video several smaller videos, , removing frames original track "compress" down , make more gif-like. i've come few possible avenues: avassetwriter , avassetreader in scenario, read in cmsamplebuffer s file, perform desired manipulations, write new file using avassetwriter . avmutablecomposition here, given list of cmtimes can cut out frames , rewrite video or create multiple compositions each new video want create, export of them using avassetexportsession . the metrics i'm concerned about: performance , power. i'm interested in method offers greatest efficiency in performing edits while giving me flexibility want. i'd imagine kind of video editing i'm describing can done both approaches want performant/with best capabilities. in experience avassetexportsession more performant usi

How to mark the peak with Matlab? -

how can use plot function mark peak? example: a = [0 1 3 23 3 9 10 28 2] [p,locs] = findpeaks(a) result: p = 23 28 locs = 4 8 you dont provide x range create 1 (you can change want). figure x = [1:length(a)]; plot(x,a,'k'); the above plots original data points following will hold on plot(locs,p,'ro'); plot peaks red circle points on top of original series. if need non-integer x-range need calculate appropriate values correspond indices in locs array , use x values instead.

.net - What is the fastest method to merge a number of files into a file in c#? -

i handle big files(of capacities minimum 500mb) split , merge c#. i have split file thousands of files, sort these files groups, , merge these each group. the minimum number of files 10,000. i implement merge function using method stream.copyto(). here main part of that. using (stream writer = file.openwrite(outputfilepath)) { int filenum = filepaths.count(); (int = 0; < filenum; i++) { using (stream reader = file.openread(filepaths.elementat(i))) { reader.copyto(writer); } } } i've tested program split 500mb 17000 files of 2 groups , merge each group of 8500 files 1 file. the merging part takes 80 seconds. think pretty slow compared splitting same file takes 15~20 seconds is there method faster code? your code looks fine elementat code smell. convert array , use [i] instead. if have 10k elements i'm positive you're wasting lot of time.

xamarin.forms - Xamarin- How to make expand the listview programmatically? -

i using xamarin form code project, encounter issue is, when using listview , deploy android, android showed hamburger icon ios not exist. intend create icon in ios ios user know there listview. when find listview function, there no function expand or close listview. how expand listview programmatically? <listview x:name="campaignlist" itemssource="{binding campaigns}" itemtapped="onitemselected"> <listview.itemtemplate> <datatemplate> <textcell text="{binding name}" detail="{binding description}" textcolor="#000" detailcolor="#999"/> </datatemplate> </listview.itemtemplate> </listview> assuming mean opening master page (which contains listview ) of masterdetail page, exapnding listview (nb: if so, please edit question accordingly of use others in future) public class mypage : masterdetailpage {

validation - Symfony2 backend datetime yml validatiion -

i've been trying validate datetime field using yml (validation.yml) file. though validates "datetime type" doesn't validate "null" or "blank". i've tried using notblank , notnull. expirationstartdate: - datetime: ~ - notblank: ~ expirationenddate: - datetime: ~ - notblank: ~

python - Spacing inbetween letters and numbers -

so basically, i'm trying write filter can separate numbers , letters dictionary , have space inbetween them. instance 12346 s 12346 q . def check_if_works(): dict_info = {} dict_info['1234'] = "test" dict_info['12456s'] = "test" dict_info['12456q'] = "test" dict_info['12456b'] = "test" dict_info['123456'] = "test" dict_info['asdftes'] = "test" dict_info['asdftess'] = "test" dict_info['asdftessd'] = "test" arr = [] key,value in dict_info.iteritems(): if key.isalpha() or key.isdigit(): pass #print key else: print key no need list of dictionaries, want fill , dump new_dict directly. also, there's no need try/except (which not work because str.isalpha() never throw exceptions), should combine checks test contains letters or numb

playback - HTML Audio Play/Stop -

i'm making chat application , 1 of features sending sound. html gets sent following: <p> <audio autoplay> <source src="sounds/lol.mp3" type="audio/mpeg"> </audio> lol <a href="#" id="soundstop">stop</a> <a href="#" id="soundplay" style="display:none;">play</a> </p> the 'autoplay' works fine when sent first time. need play/stop link hear sound again many times want. have following javascript: $(document).on('click', '#soundstop', function(e) { $(this).hide(); $(this).next("a").show(); $('audio').each(function(){ this.pause(); this.currenttime = 0; }); e.preventdefault(); }); $(document).on('click', '#soundplay', function(e) { $(this).hide(); $(this).prev("a").show(); $(this).closest("audio").play(); //

python - What is wrong with this alternative bitwise operator function? -

n1 = "0b1110" n2 = "0b101" def bitwise_or(num1, num2): diff1 = "" new_num1 = [] new_num2 = [] new_num = [] c in num1: new_num1.append(c) c in num2: new_num2.append(c) if len(num1) != len(num2): if len(num1) > len(num2): diff1 = "0" * (len(num1) - len(num2)) c in diff1: new_num2.append(c) if len(num1) < len(num2): diff1 = "0" * (len(num2) - len(num1)) c in diff1: new_num1.append(c) in range(len(new_num1)): if new_num1[i] == "1" or new_num2[i] == "1": new_num.append("1") else: new_num.append(new_num1[i]) final = "".join(new_num) return final print(bitwise_or(n1,n2)) i made function should replicate | operation, it's not working correctly. correct answer suppose print out 0b1111, don't unde

Get access token from dropbox api wihout user interaction -

i read dropbox core api authentication , in documentation written user must open link, copy authorization code, paste , api change access token. there way avoid that? example when opening dropbox chooser , authenticating using email , password how can access token result? updates on that? note : purpose access token result after user signs in using dropbox chooser api. of course user interaction required, user needs log in (if not logged in) , click "allow" button grant app access. might want take @ sample web apps (and not command-line examples). e.g. give https://mdwebhook.herokuapp.com/ try , take @ the code . note chooser won't give access token; gives access specific file chosen user. access token, you'll need take user through oauth flow. perhaps dropbox's oauth guide help.

java - Unity Ads Android Integration - Reloading Video Ad issue -

i have integrated unity ads android library android project. @ beginning, after calling init unityads.init(this, consts.unity_game_id, this); onfetchcompleted method of callback called , can show video , callback completion on activity. i want reload video after completion , looking method "reload", "fetch" etc. on unityads class. seems there no way this. so, have tried call unityads.init again, couldn't callback or error on logs. how can reload video ad? 1 . don't call init twice. 2 . not using isready check if ad read shown before calling advertisement.show() function. copied directly unity website, code below should show ad , wait show ad, call showad() again. [serializefield] string gameid = "33675"; void awake() { advertisement.initialize (gameid, true); } void start() { showad();//show ad } public void showad(string zone = "") { #if unity_editor startcoroutine(waitforad ());

signal processing - Matlab Power Spectrum Plot -

Image
i want make plot of power spectrum of particular .wav sound file, on frequency range -2000 +2000 hz. attempt: this code far: [s, fs] = wavread('chord.wav'); hs=spectrum.periodogram; psd(hs,s,'fs',fs) i tried using periodogram algorithm. resulting plot ranged 0 20,000 hz. so, how can modify code plotted on -2000 +2000 hz instead? any appreciated. i modified 1 of examples in support page fs = 32e3; t = 0:1/fs:2.96; x = cos(2*pi*t*1.24e3)+ cos(2*pi*t*10e3)+ randn(size(t)); nfft = 2^nextpow2(length(x)); pxx = abs(fft(x,nfft)).^2/length(x)/fs; hpsd = dspdata.psd(pxx(1:length(pxx)/2),'fs',fs); plot(hpsd) figure plot(hpsd) axis([9.8 10.2 -90 0]) %change axis range

node.js - Passport authenticate is always executing failureRedirect -

i using passport.js authenticate users node.js backend app. following code performing failureredirect , not able find reason it. there no error message. router.post('/login', passport.authenticate('local', { failureredirect: '/users/login', failureflash: 'invalid email or password' }), function(req, res) { console.log('authentication successful'); req.flash('success', 'you logged in '); res.redirect('/'); }); i copied code passport website , not working: router.post('/login', passport.authenticate('local', { successredirect: '/', failureredirect: '/users/login' })); the following code not starting: passport.use(new localstrategy({ email: 'email',

c++ - Optimized code for two string compare in if condition -

i want 2 string compare , used 2 different if condition. there better way string compare in 1 if condition if (strcmp(buff1(), config1) == 0) { if (strcmp(buff2, config2) == 0) { // code goes here } } the equivalent code is: if ((strcmp(buff1(), config1) == 0)) && (strcmp(buff2, config2) == 0)) { // code goes here } note: compiler should generate same machine code both code samples. difference cosmetic , aimed @ reader of code. you difference when add else clauses: if (strcmp(buff1(), config1) == 0) { if (strcmp(buff2, config2) == 0) { // code goes here } else { // else 1 } } else { // else 2 } compared to: if ((strcmp(buff1(), config1) == 0)) && (strcmp(buff2, config2) == 0)) { // code goes here } else { // single else clause }

Angularjs - detect when ng-repeat inside ng-repeat finish repeating -

i using angularjs 4.2 website. i detect when ng-repeat finish repeating using directive if use ng-repeat inside ng-repeat, can not scope repeat outside check $last. any idea problem. simple answer use $parent.$last check parent's last iteration <div ng-repeat="item in outerlist"> <div ng-repeat="item in innerlist"> <span ng-if="$last && $parent.$last"> last iteration of both list </span> </div> </div>

bootstrapping - how to select desired country in bootsratp country picker? -

Image
the below code shows flag , selected when drop down loaded. <div class="bfh-selectbox bfh-countries" data-country="us" data-flags="true"></div> i want selecte uk in form , iraq in form when tried below not show flags of country , country name. <div class="bfh-selectbox bfh-countries" data-country="uk" data-flags="true"></div> <div class="bfh-selectbox bfh-countries" data-country="irq" data-flags="true"></div> the above code selected blank default. how can show uk , iraq flag how name , flag selected on <div class="bfh-selectbox bfh-countries" data-country="us" data-flags="true"></div> to make work should add links css , js files of bootstrap form helpers library should downloaded on server <link href="css/bootstrap-form-helpers.min.css" rel="stylesheet"> <scr

zip - Android expansion (obb) patch file version number -

i have uploaded application play store huge expansion (obb) file. everything's working fine, no problem that. have upload small update expansion file. want use patch expansion file because don't want force users download big main expansion file again. in theory it's seems easy task. from developer page: // zipresourcefile representing merger of both main , patch files zipresourcefile expansionfile = apkexpansionsupport.getapkexpansionzipfile(appcontext, mainversion, patchversion);` i have used in form: zipresourcefile expansionfile = apkexpansionsupport.getapkexpansionzipfile(appcontext, 14, 0);' with no patch file , no problem. but if try modify code, got problems. my current version 19 , still use main expansion file 14 version. when tested app used 14 version number of patch file (patch.14.com.exaple), copied patch file directly phone , used code: zipresourcefile expansionfile = apkexpansionsupport.getapkexpansionzipfile(appcontext, 1

angularjs - A simple directive to show name of user not working -

i have made simple example of custom directive show name of person. still not showing it. can help? <html> <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.8/angular.min.js"></script> </head> <body ng-app="myapp" ng-controller="myctrl"> <person></person> <script> //module declaration var app = angular.module('myapp',[]); //controller declaration app.controller('myctrl',function(){ $scope.name = "peter"; }); //directive declaration app.directive('person',function(){ return { restrict: 'e', template: '<div>' {{ name }} '</div>' }; }); </script> </body> </html> you need use proper javascript syntax. i'm talking string concatenation (which don't need). forgot inject $scope controller. correct

c# - Bold a part of string in generated barcode -

Image
i generating barcode image. barcode consists of few different values, such amount, length, width , m2. these numbers displaying below barcode summary of user entries. there way either bold or underline m2 (square meters) in summary under barcode? please see below sample of needed: here's code use generate barcode: private void generate_click(object sender, eventargs e) { string barcode = summary.text; bitmap bitmap = new bitmap(barcode.length * 40, 150); using (graphics graphics = graphics.fromimage(bitmap)) { font ofont = new system.drawing.font("idautomationhc39m", 20); pointf point = new pointf (2f, 2f); solidbrush black = new solidbrush(color.black); solidbrush white = new solidbrush(color.white); graphics.fillrectangle(white, 0, 0, bitmap.width, bitmap.height); graphics.drawstring("*" + barcode + "*&

javascript - Get url parameter with jquery -

i want read out url parameter using jquery , bind 1 in variable. i've seen lot of ways solve no 1 worked me. http://relaunch.headonline.de/projekte/#filter=kataloge-database -> i'm using '#' instead of '&' or '?'! this current javascript: function $_get(param) { var vars = {}; window.location.href.replace( location.hash, '' ).replace( /[?&]+([^=&]+)=?([^&]*)?/gi, // regexp function( m, key, value ) { // callback vars[key] = value !== undefined ? value : ''; } ); if ( param ) { return vars[param] ? vars[param] : null; } return vars; } var filter = $_get('filter'); var url = window.location.href; var arguments = url.split('#')[1].split('='); arguments.shift(); working example var url = "http://relaunch.headonline.de/projekte/#filter=kataloge-database"; var arguments = url.split('#&

linux - Using Shell, How can I read one text file's value and enter it into running crontab as input? -

i want run 1 cronjob in need supply input. input have 1 text file. how can read text file data , supply input cronjob? i running 1 cron job .sh file. needs input data 2-3 times while running. data stands text1.txt, text2.txt, etc. now, want read data these text files , insert input in running cronjob. crontab file execution waits "expect" command. , expects data go ahead, , data residing in text file. so if understand correctly, run script cronjob; somewhere in script can say: x=`cat file` or can add cat file | grep something 1 line file and later use $x expected input.

swift - Trouble adjusting constraints programmatically -

Image
hey have setup this: the left constraint constant 111. want change constraint 20 , increase length of box. have: @ibaction func didtapbutton(sender: anyobject) { view.removeconstraint(leadingconstraint) leadingconstraint = nslayoutconstraint(item: view.superview!, attribute: .leading, relatedby: .equal, toitem: greenview, attribute: .leading, multiplier: 1.0, constant:20) view.addconstraint(leadingconstraint) } i had error leadingconstraint = nslayoutconstraint(item: view.superview!, attribute: .leading, relatedby: .equal, toitem: greenview, attribute: .trailing, multiplier: 1.0, constant:20) . changed .leading , .leading both attributes. rectangle stretching it's not correct size, it's going off screen: what doing wrong here? (note: want change these constraints adding new constraint not changing constant value. i'm trying better understanding!). pointers on appreciated! thanks the way should is: storyboard: creat

css - How to scale images to the size of an existing div while you change them dynamically with onClick? -

what trying following. i have list of hidden images. i have button activated jquery onclick replaces html of div include images the button functions cycle button , gets big list of images. my problem images not scale size of parent div. if give them .horizontal , .vertical class ideas? i want keep format of hidden list of images inside div because other things lists. thought having 2 classes images work , finishing realised whole idea has problem ! http://jsfiddle.net/alexnode/ttqht/ html <div id="artdiv2"> <div id="artslide1nextbutton">></div> <div id="artslide1"></div> </div> <div class="hidden"> <div id="1slide1"> <img class="horizontal" src="http://farm8.staticflickr.com/7366/9160515864_7dc851a598.jpg" alt="rezando los antiguos dioses - praying old gods"> </div> <div

How to make an image viewer like Facebook or Twitter ? iOS -

i make image viewer facebook or twitter user can pinch zoom , slide or down dismiss current image viewer. when image press want present image viewer facebook enlarge become image viewer. know how can ? here control can use: https://github.com/bogardon/ggfullscreenimageviewcontroller preview video: https://www.youtube.com/watch?v=jdks985ey1q&feature=youtu.be

DIANA TNO - Python - Matlab -

i have model in diana tno , , wondering if perhaps exist way execute software python (more information click here ) or matlab? the final idea able create projects / create , run analysis / process results matlab and/or python. honestly haven't found helpful information it, contribution welcome. thanks in advance! i found answer, , hope helpful whatever purposes. there steps: create .bat next information (for creating .bat, open notepad file , after save it, change extension .bat): rem === diana environment setup === call "c:\program files\diana 9.6\dialogin.bat" diana q8axi create .dat, has information of model, here example. create .dcf, specified detail of analysis want perform. here , example. in matlab, create script next information: clc, clear all, close dos('name.bat') note: it's important take account previous files (.bat .dat .dcf) got have same name. finally, save , run matlab file in same folder located

streaming - Media link of a video available on OTT platform -

i looking integrate videos freely available on ott platforms in india. for example http://www.sonyliv.com/details/full%20movie/4709492313001/the-butterflies-in-my-head-%7c-short-film however web link video file. not able fetch media link , such videos. possible trying , if should direction of implementation i think if @ terms of use on site (which @ bottom , are, not helpfully, hidden every time scroll down) conditions don't allow proposing, other linking site link above does, or sharing via share options (google + , facebook example show above). so can solve technically varying degrees of ease, depending on whether source sites hide media manifest url's or use dynamically generated url's etc, it's worth making sure not going issues on rights first.

how to avoid repetition and zero's with java random function? -

i have array contains 100 elements, want print out 20 random elements without repetition or having zeros. i have printed random set of 20 numbers out of 1000 cannot stop printing out repetitions and/or zeros. help?! here code :- import java.util.random; public class myclass { public static void main(string args[]) { int[] persons = new int[1000]; int[] person = new int[20]; random random = new random(); (int = 0; < person.length; i++) { person[i] = random.nextint(persons.length); system.out.println(person[i]); } } } how using hashset ? import java.util.hashset; import java.util.random; import java.util.set; public class nonrepeatrandom { public static void main(string[] args){ final int low = 1; set<integer> set = new hashset<integer>(); random rand = new random(); while (set.size() < 20) { set.add(rand.nextint(10

xsl fo - XSL-FO page-master-alternatives sometimes exhausted -

i have bit robust stylesheet books. @ moment, can’t figure out problem. stylesheet works, not, depending on toc’s lenght, can change dynamically number of levels want include in it. my stylesheets work way (my intention is): let imprints part starts on title-page , ends on page, if last page of toc odd, put there blank page after it: <fo:page-sequence-master master-name="imprints"> <fo:repeatable-page-master-alternatives> <fo:conditional-page-master-reference master-reference="pagemaster.blank" blank-or-not-blank="blank" page-position="any"/> <fo:conditional-page-master-reference master-reference="pagemaster.title-page" odd-or-even="odd" page-position="first"/> <fo:conditional-page-master-reference master-reference="pagemaster.copyright-page" odd-or-even="even" page-position="rest"/&

android - Install referrer receiver was accidentally left in the manifest file after I removed the referrer SDK -

i have removed appnext sdk project. however, forgot remove appnext install referral receiver. version passed gradle build without error or warning though should have failed build! (since referenced sdk no longer part of project). question why android studio/gradle didn't @ least warned me @ build time? here relevant code snippet manifest file: the appsflyer install receiver first , broadcast receivers placed below it. although library provides additional services, if use proguard part of build process, has light footprint. use ads packages google services. if want optimize size of project can exclude other packages. more details see: https://support.appsflyer.com/hc/en-us/articles/207032126-appsflyer-sdk-integration-android --> <receiver android:name="com.appsflyer.multipleinstallbroadcastreceiver" android:exported="true"> <intent-filter> <action android:name="com.android.vending.install_referrer" />

objective c - Variadic method in Swift -

objective c code: - (instancetype)initwithints:(int32_t)int1, ... { va_list args; va_start(args, int1); unsigned int length = 0; (int32_t = int1; != -1; = va_arg(args, int)) { length ++; } va_end(args); ... ... return self; } this code used count numbers of method's parameters. swift code: convenience init(ints: int32, _ args: cvarargtype...) { var length: uint = 0 self.init(length: args.count) withvalist(args, { _ in // how increase length' value in loop? }) } what's best practise use withvalist loop through argument list cvalistpointer ? appreciated. how just convenience init(args: int...) { return args.count }

javascript - Nav show on scroll up -

i copied script website, , i'm not sure i'm doing wrong here. script suppose remove / add class, reason not working. i tested on url, , here working http://rubenkoops.nl/script_library/cms/content/01-home/nav_hide_on_scroll_html_preview/ for reason nog working on url http://18493.hosts.ma-cloud.nl/ i got feeling i'm missing dumb, can figure out? <style type="text/css"> header { background: #f5b335; height: 40px; position: fixed; top: 0; left: 0; transition: top 0.2s ease-in-out; width: 100%; } .nav-up { top: -40px; } </style> <script type='text/javascript'>//<![cdata[ $(function(){ // hide header on on scroll down var didscroll; var lastscrolltop = 0; var delta = 5; var navbarheight = $('header').outerheight(); $(window).scroll(function(event){ didscroll = true; }); setinterval(function(