Posts

Joining numbers in array javascript -

i got different buttons looks down below (ranging 1 9) <button type="button" onclick="calculatornumber(1)"> it leads following function: function calculatornumber(i) { mynumbers.push(i); var x = document.getelementbyid("screen").innerhtml = mynumbers.join(""); but not working quite i'd to. if press number 3 once , number 4, 3 & 4 stored in array @ [0] , [1] them stored @ same place , 34. ideas? i've tried enhance function following code not seem work: function calculatornumber(i) { mynumbers.push(i); var x = document.getelementbyid("screen").innerhtml = mynumbers.join(""); //joining them without comma mynumbers = []; //then empty array altogether mynumbers.push(x); // , push new value in you don't need array of numbers. it's 1 number: theonenumber = theonenumber * 10 + i; so start 0. press 3 => number 3 press 4 => number 34 press 5 =...

android - How to sort LinearLayout's children programatically -

i have linear layout horizontal orientation has few imageviews in (hardcoded in xml). have sort them based on multiselectlistpreference (all checked first , unchecked later). put checked ones in beginning tried ((linearlayout)imageview.getparent()).removeview(imageview); ((linearlayout)imageview.getparent()).addview(imageview,0); and did nothing unchecked. gives me "the specified child exists. must call removeview(view) on view's given parent" though i've called it. may because imageviews present in xml. how can obtain desired arrangement of child imageviews. if @ linearlayout not suffice, should use recyclerview here , heavier? cast parent view viewgroup removeview method work. ((viewgroup)imageview.getparent()).removeview(imageview);

debian - Using Puppet do deploy Apt-Dater -

i configured puppet apt-dater-manager using following description: node 'puppet' { class { 'apt_dater': role => 'manager', manager_ssh_key => template('site/apt-dater.priv.key'); } } then added host class { 'apt_dater': customer => 'test', ssh_key_type => 'ssh-rsa', ssh_key => template('site/apt-dater.pub.key'); } well, works - apt-dater , apt-dater-host being installed - if want start apt-dater i'm getting error: error on loading config file /root/.config/apt-dater/hosts.conf the file exists: -rw------- 1 root root 0 jan 11 22:00 /root/.config/apt-dater/hosts.conf but file empty how can add configured hosts automatically? so collect resources clients first. class apt-dater::client { @apt-dater::register{ "$hostname": } } # collect hostnames: apt-dater::client <<| |>> this on apt-dater/manifests/client.pp , include on client nodes. then...

api - Implementing Two-Legged Oauth2 in ZendFramework 2 with Apigility -

i trying build zendframework2 rest api , want implement two-legged oauth2 authentication. i have been looking around , can not find resources point me in right direction this. has done before or know of source missing? in oauth can make access tokens client specific assigning client_id . client_id can stored in local storage on client side , reused on next user login client. when user logs in first time new client (no client_id in storage user) new client_id created , 2nd verification step can added part of authentication process. example sending text message phone number. add expires_at field client table can repeat process if client_id has expired.

How to make a simple timer image slideshow using HTML and CSS -

i'm trying make simple timer slideshow. image visible amount of seconds (lets 5) , switches image, , repeats. i've searched can't seem work me. amazing here's tried far. tried 2 images fading in, thing not overlap. 1 above other, , fading animation works, both fade @ exact same time, instead of 1 fading image. <style> @keyframes cf3fadeinout { 0% {opacity:1;} 45% {opacity:1;} 55% {opacity:0;} 100% {opacity:0;} } #cf { animation-name: cf3fadeinout; animation-timing-function: ease-in-out; animation-iteration-count: infinite; animation-duration: 10s; animation-direction: alternate; } </style> <div id="cf"> <img class="bottom" src="12289696_1526730367649084_3157113004361281453_n.jpg" /> <img class="top" src="11406788_1433347623654026_6824927253890240539_n.jpg" /> </div> with 2 image , can @ low cost css animation: @keyframes cf { 50% {/* @ 50%, avoids alternat...

c# - Security of displaying ID's in Hidden fields -

i trying understand proper way handle following scenario. wish learn more acceptable passed on page in terms of security. lets take tournament scenario. have list of teams signed displayed on page. in order report result of game, have click on team , select win or lose. posted server in return records in database. the dilemma know team have clicked , game. there many rounds, 1 team can displayed many times. such need have hidden field on page has id of team , id of game can record result. what wondering is, how secure me create hidden field holds id. there better way handle such scenario? giving out information hacker if print out id in hidden field? some of answers have found through research "may" ok long authorize request. user reporting score has enough privileges report score. wished ask of experts here @ stackoverflow further support research. edit: this web application. if printing out id no go, how else determine team selected round? need h...

jquery - Disabling javascript in a child window, from the parent -

bit of weird request, i'd able have parent window: create new child window on same domain (using window.open ) prevent javascript running in child window currently, can within in child window including following @ top of page: <script> function.prototype.call = function() {}; function.prototype.apply = function() {}; </script> this pretty stops javascript in child page running. there way me from parent window ? can somehow inject code child page before scripts have chance run? or there other way this? any appreciated you can use bit of server side remove <script> tags , inline event handlers onclick . edit using client side can try grab whole page using ajax remove scripts there , write content newly created window. don't think able use $.get('page.html', function(html) { var html = $(html).find('script').remove().html(); }); because scripts may executed when added dom, maybe need use parser or rege...