Posts

Showing posts from March, 2014

linux - AWS Opsworks: logrotate it runs automatically? -

i have configured own logrotate(app logs) , editing(nginx logs), created in recipes(chef). question is: logrotate runs automatically? i ask because have configurations in logs can not exceed 5mb in size, , have logs sizes of 100mb. show crontabs root: crontab -l no crontab root /etc/logrotate.conf weekly su root syslog rotate 4 create include /etc/logrotate.d /var/log/wtmp { missingok monthly create 0664 root utmp rotate 1 } /var/log/btmp { missingok monthly create 0660 root utmp rotate 1 } usually, logrotate run daily cron job. add size 5m , daily logrotate config logs you're interested in. there potential log grow past 5m between daily logrotate runs. tuned lowering size value and/or running logrotate more often. check man logrotate more details.

c# - Complex MultiBinding validation -

i have form has multiple fields. have "validate" button action db input. button activated if bare minimum fields defined user. so far quite simple fields text: <button x:name="manage" content="manage"> <button.isenabled> <multibinding mode="oneway" converter="{staticresource fieldsfilledintovisible}"> <binding elementname="name1" path="text"/> <binding elementname="name2" path="text"/> </multibinding> </button.isenabled> </button> converter being: public class allvaluesdefinedconverter : imultivalueconverter { public object convert(object[] values, type targettype, object parameter, cultureinfo culture) { bool isenabled = false; (int = 0; < values.length; i++) { isenabled = isenabled || string.isnullorempty(values[i].tostring()); }

Cygwin commands don't work -

i'm sorry question seems rather vague entire problem i'm facing. tried installing rpm package on cygwin after downloading website same error -bash: rpm: command not found and have reinstalled twice, same problem, , it's not that, can't use simple commands ls. if write ls no output. screen looks like. user@user-pc ~ $ rpm -ivh avr-binutils-2.17tinyos-3.cygwin.i386.rpm -bash: rpm: command not found user@user-pc ~ $ locate rpm | grep bin user@user-pc ~ $ user@user-pc ~ $ ls user@user-pc ~ $ what do fix this? first, locate not auto-update itself; must run updatedb periodically current list of files. optimal speed , usability, add --prunepaths , --prunefs switches. second, try echo $path see current path, , call ls fully-qualified pathname: /bin/ls -l i suspect ls set invalid alias or internal function (bad command parameters). check contents of ~/.bash_profile, ~/.bashrc, , ~/.profile .

python - How to remove punctuation in between words -

i use code strip line of text punctuation: line = line.rstrip("\n") line = line.translate(none, string.punctuation) the problem words doesn't turn doesnt want remove punctuation between words can't seem figure out way so. how should go this? edit: thought using strip() function take effect on right , left trailing of whole sentence. for example: isn't ., stackoverflow - best ? should become: isn't stackoverflow best instead of current output: isnt stackoverflow best assuming consider words groups of characters separated spaces: >>> string import punctuation >>> line = "isn't ., stackoverflow - best ?" >>> ' '.join(word.strip(punctuation) word in line.split() if word.strip(punctuation)) "isn't stackoverflow best" or >>> line = "isn't ., stackoverflow - best ?" >>> ' '.join(filter(none, (word.strip(punctuati

javascript - How to overwrite element style so it cannot be changed? -

i writing chrome extension , need make of elements' position relative. i've tried add position: relative !important; body 's style. when scrolling page, js inside page changes style of body child element position: fixed , becomes fixed. don't want happen, so, there way make of elements relative once , all? i've tested behaviour on page: http://sandesh.epapr.in/709519/ahmedabad/02-02-2016#dual/4/3 , want header , footer not fixed, no luck. you cannot, change style more specificity or javascript.

python - Switching environments within a fabric script -

i want try execute this env.host_string = "server1.com" cd("/tmp"): run("some command) #switch servers env.host_string = "server2.com" cd("/home"): run("some other command") the issue commands need executed sequentially , not in parrelel. can't figure out way in fabric. i've tried with env("hostname"): not work. use @serial decorator avoid parallel execution of tasks. try @hosts decorator (see same page) limit each task subset of hosts, , argue hosts when call fabric.

selenium - Setting up Microsoft Edge with Protractor (JS), Cucumber JS and Gulp - (no Java, no C#) -

does know how setup microsoft edge browser protractor? i'm using protractor (javascript) , gulp; not java or c#. here's protractor config file: exports.config = { framework: 'cucumber', seleniumargs: ['-dwebdriver.ie.driver=node_modules/protractor/selenium/microsoftwebdriver.exe'], multicapabilities: { 'browsername': 'microsoftedge', javascriptenabled=true, //'platform': 'windows', // 'version': '11' } , { 'browsername': 'chrome', loggingprefs: { driver: 'debug', server: 'info', browser: 'all' } }], } 1. specify browser name 'microsoftedge' then 2. thought point edgedriver.exe did , worked ie browser. what else missing, opens edge browser fails navigate url error var template = new error(this.message); ^ unknownerror: null (warning: server did not provide stacktra

windows batch errorlevel with if -

in below script if errorlevel 0, going if condition "if errorlevel 1" @echo off if exist servers.txt goto :continue echo servers.txt file missing exit :continue set instance=%username:~2% setlocal enabledelayedexpansion /f "delims=" %%i in (servers.txt) ( pushd \\%%i\d$\%instance%\hyperion\oracle_common 2>nul if not errorlevel 1 ( echo %%i echo ********************************** set oracle_home=!cd! echo oracle_home !oracle_home! d: /d /r d:\%instance%\hyperion %%a in ("jdk160_*") cd %%a set java_home=!cd! echo java_home !java_home! echo d:\%instance%\hyperion\oracle_common\oui\bin\setup.exe -jreloc !java_home! -silent -attachhome oracle_home=!oracle_home! oracle_home_name="remote_epm" d:\%instance%\hyperion\oracle_common\oui\bin\setup.exe -jreloc !java_home! -silent -attachhome oracle_home=!oracle_home! oracle_home_name=remote_epm echo error code is:%errorlevel% if errorlevel

javascript - Objective c - How to autoplay Vimeo videos using JS -

everyone tried make youtube/vimeo videos start play automatically on ios knows painful task. apple blocked 'autoplay' parameter right reasons, still need functionality working. i had same issue auto playing youtube videos , apparently, autoplay work, need javascript magic, listen player's 'onready' event, when player loaded , ready play call 'player.play()' start without user intervention. vimeo got javascript api, , i'm pretty sure can autoplay trick it, can't figure how use it. they have js mini-library called froogaloop make things easier, saw this answer @ila use in conjunction following html string: nsstring *htmlstring = [nsstring stringwithformat: @"<html><head>" "<script src=\"froogaloop.js\"></script>" " <script>&quo

ruby on rails - Allow only the registration form -

how can create method navigate visitors registration path before (s)he signs in or signs up? use before_filter on controllers ensure users signed in, default action of redirect registration if not. there gem called devise useful authentication , worth effort of learning it. another place go http://ruby.railstutorial.org/ruby-on-rails-tutorial-book this give excellent grounding in rails

java - How to get client list using SOAP Web Services in Netsuite ERP? -

i new soap web services , netsuite erp , trying generate report in company need obtain clients , invoices using data available in netsuite erp. followed java , axis tutorial offer sample app erp , created java project in eclipse consumes wsdl netsuite 2015-2 , compiles needed classes run sample app. so, followed example found in crm exapmle app obtain client's information problem example method needs introduce client's id. here sample code: public int getcustomerlist() throws remoteexception, exceededusagelimitfault, unexpectederrorfault, invalidsessionfault, exceededrecordcountfault, unsupportedencodingexception { // operation requires valid session this.login(true); // prompt list of internalids , put in array _console .write("\ninternalids records retrieved (separated commas): "); string reqkeys = _console.readln(); string[] internalid

Return single view on every controller action in asp.net mvc3 -

i want return same view every controller action request in asp.net mvc3 .what best possible way achieve this. dont want write view name in every controller action you use return redirectoaction(actionname) so may have like <actionname("pagex")> _ function pagex() actionresult return redirecttoaction("commonview") end function <actionname("pagey")> _ function pagey() actionresult return redirecttoaction("commonview") end function <actionname("pagez")> _ function pagez() actionresult return redirecttoaction("commonview") end function <actionname("commonview")> _ function commonview() actionresult return view() end function

xml - Whats the difference between # and $ in ELs in ADF -

have basic question on difference between # , $ while evaluating els. ex. <c:if test="#{bindings.value == true}"> and <c:if test="${bindings.value == true}"> the $ called immediate evaluation syntax, while # called deferred evaluation syntax check out reference http://docs.oracle.com/javaee/5/tutorial/doc/bnahq.html#bnahr

Can't get emulator to work in Android Studio -

Image
i installed tools needed in sdk manager when create new avd can't run. i'm new android. ideas on need emulator run on computer?

Deploy app with .NET 2.0 SP2 framework packaged -

i want package .net 2.0 installer .net app, installer use latest .net 2.0 sp 2? assuming target machine xp/vista/7, , assuming has no .net framework installed. netfx 2 (2006, size 23 mb) netfx 2 sp 1 (2007, size 24 mb) netfx 2 sp 2 (2009, size 25 mb) do need latest sp 2 installer? or need 3 installed in sequence? or need 3 installed in sequence? no, service pack versions complete installers don't require previous version of .net 2 present. can tell file size.

awk: send results to file named using bash variable -

i have bash variable log_filename stores name of log file. want launch iostat -xnmp , fields 9, 10 , 11 of every record of every iteration matching pattern stored in bash variable device . number of iterations stored in time bash var. trying is: iostat -xnmp 5 $time | awk -v log=$log_filename "/$device/" '{print $9" "$10" "$11}' input >> $log and lots of variations environ , others...but still couldn't figure out wrong. getting syntax error of time. there no particular requirements yet, solution suitable. my take on (one liners okay easier humans read separate lines): iostat -xnmp $time | awk -v dev=$device 'index($0,dev)>0 {print $9,$10,$11}' >> $log you read stdin. index($0,dev)>0 used because think have 1 disk device in mind. index($0,dev)>0 can shortened index($0,dev) less clarity folks learning awk.

ruby - rails 4 redirecting to most recent created record? -

building simple messaging app, using tutorial , , wanted know if it's possible me redirect recent updated record in database? application.html.haml : = link_to 'messages', :conversations i want able change localhost:3000/messages , it'll automatically gets redirected recent message recorded. routes.rb resources :conversations resources :messages end conversation.rb class conversation < activerecord::base belongs_to :sender, :foreign_key => :sender_id, class_name: 'user' belongs_to :recipient, :foreign_key => :recipient_id, class_name: 'user' has_many :messages, dependent: :destroy validates_uniqueness_of :sender_id, :scope => :recipient_id scope :between, -> (sender_id,recipient_id) where("(conversations.sender_id = ? , conversations.recipient_id =?) or (conversations.sender_id = ? , conversations.recipient_id =?)", sender_id,recipient_id, recipient_id, sender_id) end end messange.rb c

jquery - Show widget under accordion class only when user clicks on heading? -

i have accordion working fine. content of accordion shown default , when user clicks on heading goes away. want is, doesn't show content @ first when page loads , shown , hide when user clicks on heading. how can that? <div class="accordion" id="accordion2"> <div class="accordion-group"> <div class="accordion-heading"> <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseone"> video tags </a> </div> <div id="collapseone" class="accordion-body collapse in"> <div class="accordion-inner"> <table class="table table-bordered"> <thead> <tr> <th>time code</th> <th>tag name</th> </tr> </thead> <tbo

Android - Layout not in uniform -

Image
i have horizontal list of images in android application. problem of images seems not follow layout i've defined in xml. this: my layouts this: mainlayout.xml <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/back_shop_list" android:orientation="horizontal"> <com.devsmart.android.ui.horizontallistview android:id="@+id/shop_hlist_view" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingleft="5dp" android:paddingright="5dp" android:scrollx="1dp" android:scrolly="1dp" android:overscrollmode="always" > </com.devsmart.android.ui.horizontallistview> </linearlayout> then listlayout.xml <l

user interface - Executing .bat file remotely from Linux box -

i'm trying execute .bat file on windows box remotely linux box connecting via ssh, obtaining windows command prompt , executing batch file. when connect windows machine can see process running graphical interface not being invoked. regards rahul probably, need install x server on windows? consider xming 1 option. assuming have installed ssh-server on windows system. note: need login on windows box (once, after windows login), start x server on windows & onwards should able ssh system & start gui application. another possible issue: the ssh-server binary should executed user, after logging in once after windows system boot. ssh windows box, export display=:0 & run gui app. note: have not tested of above 2 solution, these think possible solutions. one more solution: create dedicated tcp based server (on windows) client (on linux) model & send commands on channel. dirty way & able give limited functionality, tested working.

c# - Search Server XML response format -

i wrote small program - makes requests microsoft search server (_vti_bin/search.asmx) web service, receives answers , display them. format of request string. query packet here: @"<querypacket xmlns='urn:microsoft.search.query'> <query> <supportedformats> <format revision='1'> urn:microsoft.search.response.document:document</format> </supportedformats> <context> <querytext language='en' type='string'>{0} </querytext> </context> <resultprovider>default</resultprovider> <range> <count>10</count> </range> </query> </querypacket>" and making request code: var queryservice = new querywebserviceproxy.queryservice(); queryservice.credentials = system.net.credentialcache.de

Can't insert some special characters into mysql -

the value cut off after character 💀 why happening? create table tmp2(t1 varchar(100)); insert tmp2 values('before💀after'); mysql> select * tmp2; +--------+ | t1 | +--------+ | before | +--------+ 1 row in set (0.01 sec) i ran followed commands , returned useful information mysql> show full columns tmp2; +-------+--------------+-----------------+------+-----+---------+-------+---------------------------------+---------+ | field | type | collation | null | key | default | | privileges | comment | +-------+--------------+-----------------+------+-----+---------+-------+---------------------------------+---------+ | t1 | varchar(100) | utf8_general_ci | yes | | null | | select,insert,update,references | | +-------+--------------+-----------------+------+-----+---------+-------+---------------------------------+---------+ 1 row in set (0.00 sec) and this, mysql> select character_set_name

angularjs - Angular - Cannot read property '$invalid' of undefined -

i creating login page using angular , typescript. when submit button clicked, login function in controller fire, if form invalid returns. this first time using typescript, every time try put in if statement check if form invalid throws error cannot read property '$invalid' of undefined . here html: <form class="login-form" name="loginform" ng-submit="vm.login()" novalidate> <input type="email" name="email" placeholder="email" required ng-model="vm.email" ng-class="{true: 'input-error'}[submitted && loginform.email.$invalid]"/> <input type="password" name="password" placeholder="password" required ng-model="vm.password" ng-class="{true: 'input-error'}[submitted && loginform.password.$invalid]"/> <input type="submit" id="submit" ng-click="submitted=t

sql server - Alternative to cursor pivot split function? -

so i'm making stored procedure end-goal being dynamic etl solution. company deals lot of third-party data , times not know number of columns, data types, format of data, etc... such, i've put number of temporary tables dynamic sql , bulk insert statements data sql server. currently, data comes single column nvarchar field tab or pipe separated, , there's upwards of 100k rows per txt or csv file. example of aforementioned csv/txt format below: rawsingleline 9xx01 no cancelled inadvertent approval 1/12/2015 432115.2 99 480x1 no cancelled pending processing 1/7/2014 5060 27.5 my current solution use cursor , below split function loop through single rows, split them, pivot them, , insert 1 of dynamic temporary tables. however, i'd avoid cursor because they're expensive, , set based operation preferred. create function [dbo].[udf_split] ( @string nvarchar(4000), @delimiter nchar(1) ) returns table return ( split(stpos,endpos) as(

r - Selecting From Data Frame Using Shiny App -

i wanting select values 2 columns of data frame using selectinput. create data frame using file called kenpomeroyanalysis.r. store data frame in variable called pom. library(xml) library(dplyr) # parse kenpom data ------------------------------------------------------- pom <- "http://kenpom.com/" %>% readhtmltable() %>% data.frame() #columns keep vars <- c(2,5,6,8,10) pom <- pom[,vars] #change name of columns names(pom) <- c("team","pyth","adjo","adjd","adjt") #make rows numeric pom <- data.frame(pom$team, sapply(pom[,c("pyth","adjo","adjd","adjt")], function(x) as.numeric(as.character(x)))) names(pom)[1] <- "team" #delete rows nas pom <- na.omit(pom) #remove data set rm(list=setdiff(ls(), "pom")) i wanting create 2 different selectinput boxes choosing pom$team. first selectinput selecting "home_team" , other sel

vim - How to mange language syntax/indent configuage by vundle? -

i start using vundle, i'm curious should place language(may python, ruby, php) syntax/indentation configuration file. when put these configuration file in normal place .vim/syntax , .vim/indent , worked, didn't work when put them under .vim/bundle . i wondering suppose in somewhere under .vim/bundle if want vundle me manage these configuration scripts? thanks. regrads. the best place put custom scripts .vim/after . the reason may want custom scripts take last effect. example, vim has default actions on python files, installed plugins add more. may not satisfied them roll out own, last call in loading. you can either version control /after folder or whole ./vim folder.

jquery - ASP.NET MVC - JSON response sends me a file instead of updating the jqueryUI -

i'm returning json data, , can confirm bringing data client. instead of updating jqueryaccordion, asks me save or open file. below script , controller. have used jquery modal dialog edit employee details through partial view, , clicking on update button should update respective employee in accordion list.any appreciated - thanks update when debugging through ie tools, noticed when 'update' button clicked, 'initiator' in 'request' tab shows 'click'. guessing should 'xmlhttprequest' instead. hope information helps. thanks main view @html.actionlink("edit employee", "editemployees", "home", new { id = item.id } , new { @class = "editlink" }) partial view edit employee form - editemployee.cshtml @using (ajax.beginform("editemployees", "home", new ajaxoptions { insertionmode = insertionmode.replace,

string - Android: how do I use Save button click in one Activity to add a CardView item in Recyclerview Activity? -

i have ui screen (cardviewactivity) bunch of edittext lines data input user. when user done click "save" button on ui save string data input cardview added recyclerview list. when tried add save button reference (r.id.savebuttonrv) in recycler activity (listcontactsactivity), app crashed due button click. listcontactsactivity ... public class listcontactsactivity extends appcompatactivity { private listcontactsadapter mcontactsadapter; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); final recyclerview mrecyclerview; ... button savebutton = (button) findviewbyid(r.id.savebuttonrv); // below line caused app crash npe savebutton.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { contact contact = new contact("", ""); mcontactsadapter.additem(contact); mrecyclerview.scrollto

java - How to check if String contains value ".5"? -

this question has answer here: check if arraylist<string> contains part of string 5 answers list<string> list has value [standard .5"] i doing if (list.contains(".5\"")) { } - returning false - not sure why you have check items in list not list itself for(string s : list) { if (s.contains(".5\"")) { } }

mysql - Getting empty migration when II try and create a unique index in my rails project -

i’m using rails 4.2.3 mysql 5.5.37. want create unique constraint on table, involving multiple columns, ran … rails generate migration add_index :user_objects, [:day, :object, :user], :unique => true however, produces file, db/migrate/20160203003708_add_index.rb, had nothing in … class addindex < activerecord::migration def change end end so nothing happens when run “rake db:migrate”. i’m doing wrong in attempt create unique index across multiple columns , what’s right way on command line? according migrations guide , migrations api docs generating migrations command line supports creating new tables , adding new columns. table needs created or column(s) added determined name of migration using part after _to_ . e.g. running command like: rails generate migration add_username_to_user_objects username:string:uniq would generate migration adds unique username column (even if exists) user_objects table. now, if command supported adding indexes etc.

android - How to select picture from gallery? -

iam trying select picture gallery in emulator. when clicks browse eclipse shows w/iinputconnectionwrapper: showstatusicon on inactive inputconnection in logcat emulator takes me gallery. when chose 1 picture not getting selected.iam using below code: package com.textapi; import android.app.activity; import android.content.intent; import android.database.cursor; import android.net.uri; import android.os.bundle; import android.provider.mediastore; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.toast; public class sendmmsactivity extends activity { private static final int select_picture = 1; private string selectedpath, extension = ""; uri selectedvideouri; button btnbrowse; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.send_mms); btnbrowse=(button)findviewbyid(r.id.bnbrowse);

php - Match pattern and exclude substrings with preg_match_all -

i need find strings placed between start , end, escluding padding substring matched string. best way i've found is $r="stuffstartthispaddingisendstuffstuffstartwhatpaddingiwantpaddingtopaddingfindendstuff" ; preg_match_all('/start(.*?)end/',str_replace('padding','',$r),$m); print(join($m[1])); > thisiswhatiwanttofind i want smallest code size possible: there shorter preg_match_all , no str_replace, returns directly string without join arrays? i've tried lookaround expressions can't find proper one. $r="stuffstartthispaddingisendstuffstuffstartwhatpaddingiwantpaddingtopaddingfindendstuff"; echo preg_replace('/(end.*?start|padding|^[^s]*start|end.*$)/', '', $r); this should return thisiswhatiwanttofind using single regular expression pattern explanation:- end.*?start # replace occurrences of end start padding # replace padding ^[^s]*start # replace character until first start (inclus

ecmascript 6 - How to use ES6 module system in my case? -

all: i pretty new es6 module system, have files like: cmod.js export var name = "hello2"; main.js import name './cmod.js'; console.log(name); after run transpile : babel ./*.js --out-dir js/ --watch i wonder why result undefined? tried find answer from: https://developer.mozilla.org/en-us/docs/web/javascript/reference/statements/import https://developer.mozilla.org/en-us/docs/web/javascript/reference/statements/export but seems complicated me match case. thanks you exporting named export, importing default one. should using either // cmod.js export var name = "hello2"; // useful multiple exports // main.js import { name } './cmod.js'; console.log(name); or // cmod.js export default "hello2"; // useful single-value exports // main.js import name './cmod.js'; console.log(name);

eclipse - Executing .java in MS Window -

i beginner in java. used eclipse in mac build project output below .class in bin folder of workspace: main.class mianwindow.class paintpanel.class ... i can exexute jframe appl'n when double-click main.class file in bin of mac pc. however, when copy stuff in bin folder window pc , tried run below command, failed execute it: command prompt used: c:\program files\java\jre6\bin>java c:\temp\bin\main.class error msg: exeception in thread "main" java.land.noclassdeffinderror: c:\temp\bin\main/class ... not find main class...program exit. any step(s) missed when executing program? one more question java applet... if allow new client's pc run java applet, everytime when there new client, have compile java project on client's pc before can run applet? you not need specify extension of java application i.e remove .class . try this: java c:\temp\bin\main also if have packaged java file have first in package , run. exampleif h

node.js - for a service that has a ​*lot*​ of video uploads, how do i chose between clojure v/s clojurescript + nodejs? -

i need build new system (service) scratch talk multiple frontends (web, mobile (android, ios), etc) , have majority of time spent on video uploads for service, how decide between 1. clojure 2. clojurescript + node.js (since node.js heavy io) any general / specific pointers helpful thanks! any general / specific pointers helpful ok, here few: 1) jvm available platform? if not, can't use clojure, try clojurescript. 2) how important access multithreading? javascript not multithreaded, , clojurescript doesn't have multi-threaded core.async, agents, refs. 3) heavy multimedia io need, libraries going you? sure not doing low-level work yourself, leverage existing toolkits. toolkits java-based or node/js-based? if java, use clojure. if js, use clojurescript. 4) mobile. javascript more candidate ios since not jvm platform (see point 1 above). folks using clojurescript on mobile.

asp.net - Model mismatch error when posting form -

i working on simple image upload site in users have ability post comments on images uploaded site, whenever posting comment given error : the model item passed dictionary of type '<>f__anonymoustype1`1[system.int32]', dictionary requires model item of type 'silkmeme.models.meme'. i know has model being defined @ top of view being different 1 sending post request i'm not entirely sure how fix it view @model silkmeme.models.meme .... @using (html.beginform("comment", "memes", new { id = model.silkid })) { <label for="thought">thoughts?</label> <input type="text" name="thought"/> <label for="rating">rating?</label> <input name="rating" type="range" min="0" max="10" step="1" /> <input type="submit" value="post thoughts" /> } <div class="thoughts"

javascript - Limit number of boxes checked when arrays are involved -

i'm pretty amateurish when comes javascript stuff, apologize if question comes off bit dumb. i'm trying code involves forms limit on how many checkboxes can selected. method i've come across has worked best purposes far 1 detailed here: http://www.javascriptkit.com/script/script2/checkboxlimit.shtml it works part run issue when checkboxes need output array. example, if write input line as: <input type="checkbox" name="choice[]" value="one" /> one<br /> <input type="checkbox" name="choice[]" value="two" /> two<br /> <input type="checkbox" name="choice[]" value="three" /> three<br /> i've tried quite few things can't figure out how change code works brackets in input's name field. using script above , can change using .elements group of elements , applying same custom function: <script type="text/javascript

javascript - Perform a single function on multiple object -

is possible perform single function on multiple objects e.g. grouping them. want like: {object1, object2, object3}.tofront(); while you've accepted answer, possible in similar manner either natively through javascript 1.6/ecmascript 5 th edition: function logelementid(element, index, array) { var el = array[index], prop = el.textcontent ? 'textcontent' : 'innertext'; el[prop] = el.id; } [document.getelementbyid('one'), document.getelementbyid('two')].foreach(logelementid); js fiddle demo . or extending object prototype: function dostuff (el) { console.log(el); }; object.prototype.actongroup = function(func){ var els = this.length ? : [this]; (var = 0, len = els.length; i<len; i++){ func(els[i]); } return this; }; document.getelementsbytagname('div').actongroup(dostuff); document.getelementbyid('one').actongroup(dostuff); js fiddle demo . or by, similarly, e

javascript - How to upload a photo but a different folder? -

i have code <div class="item1"> <form action="" method="post" enctype="multipart/form-data"> <label>white</label> <input type="file" name="files[]" multiple="multiple" accept="image/*"> <label>black</label> <input type="file" name="files[]" multiple="multiple" accept="image/*"> <label>red</label> <input type="file" name="files[]" multiple="multiple" accept="image/*"> <input type="submit" value="upload"> </form> </div> and want php this, not know how set up $namewhite = $_files['photoimg']['name'][white]; $sizewhite = $_files['photoimg']['size'][white]; $nameblack = $_files['photoimg']['name'][black]

Nexus 4 not recognised in Ubuntu 12.04 for file transfer -

nexus 4 ubuntu 12.04 os . tried downloading mtp packages , installing them did not work. you may select "camera (ptp)" connection type, @ least allows transfer image files. mtp not work me either on stock ubuntu 12.04. alternatively can install app "file expert manager explorer" or "wifi file explorer pro". allow wireless transfer of files. finally possible transfer files adb (part of android sdk package). see this details.

How do I add multiple hours in php to have the total hours? -

i'm working on time in , time out system, editing codes. format of time being recorded in h:i:s. system allows user see time in office in table. in table, first row: have date-in, time-in, date-out, time-out , number of hours employee stayed in office. example, time 09:00:00 18:00:00 hours shown 9.00 hours because made in decimal format. if 09:20:00 18:00:00 hours of should in decimal also. example: 8.70 hours. that. now, table being shown whole month. below table, there total hours in format hours , mins (ex. 77 hours , 6 mins) , in decimal (77.10 hours). how compute total hours? the code below computation of hours. getting hours of time-in , out. $n = $totalmins/60; $whole = floor($n); // 1 $fraction = $n - $whole; $totalhrs += $whole; $totalmins = round($fraction*60); $totalmins = sprintf("%02d", $totalmins); $elapseddeci = round($fraction, 2); $elapseddeci += $totalhrs; $elapseddeci = number_format($elapseddeci, 2); $elapsed = "$elapseddeci"