Posts

Showing posts from June, 2015

java - How to Find All Resource IDs in Android -

i know how find resource given id (e.g. getresources().getstring(r.string.mystring ), if want list of id names, how do that? it r.resource.class.getfields() for instance field[] fields = r.id.class.getfields(); for(int z = 0; z < fields.length; z++){ somearray[z] = fields[z].getint(); }

jasper reports - How to print Page Footer on a new page in iReports Designer? -

my report consists of page header, detail band, column footer, page footer, last page footer , summary page. i want content of page footer (contains static text ) printed on next page (after column footer page). have tried using page break before page footer , after column footer not work. any ideas?!?!

javascript - How To Create Non Removable Css Styles -

i wondering if there way create non removable css style user can't disable css style inspect element, looking forward helpful answer! you cant stop disabling css element

c# - Textblock as Link conditionally -

i have label text property bound class: <textblock visibility="hidden" texttrimming="wordellipsis" grid.row="0" grid.column="0" verticalalignment="center" text="{binding displaytext}" textwrapping="wrap" fontsize="10"></textblock> if displaytext link hyperlink should used. class binding provides uri , boolean islink . tried putting hyperlink element inside of textblock , set navigateuri uri class did not work me. have clean solution this? i think can bind template according property. <contentcontrol> <contentcontrol.style> <style targettype="contentcontrol"> <style.triggers> <datatrigger binding="{binding islink}" value="true"> <setter property="contenttemplate" >

Delete SQL rows from Excel -

i trying use excel macro delete specific rows sql table, have script insert , tweaked little no avail. can 1 out please. here im trying sub button1_click() dim conn adodb.connection dim cmd adodb.command dim strsql string strsql = "delete dbo.associateinfo" & _ " (id, firstname, lastname, hiredate) " & _ " = (?,?,?,?);" set conn = new adodb.connection conn.open "provider=sqloledb;data source=blank;initial catalog=blank;user id=blank;password=blank;" 'skip header row irowno = 2 sheets("sheet1") 'loop until empty cell in firstname until .cells(irowno, 1) = "" set cmd = new adodb.command cmd.activeconnection = conn cmd.commandtype = adcmdtext cmd.commandtext = strsql cmd.parameters.append _ cmd.createparameter("pid", advarchar, adparaminput, 8, .cells(irowno, 1)) cmd.parameters.append _ cmd.createparameter("pfirstname", advarchar, adparaminput, 30, .cells(irow

amazon web services - docker swarm and aws ecr authentication using api keys -

i'm having trouble pulling docker images aws ecr when deploying stack docker swarm cluster runs in aws ec2. if try ssh of nodes , authenticate manually , pull image manually, there no issues this works: root@manager1 ~ # `aws ecr get-login --no-include-email --region us-west-2 ` login succeeded root@manager1 ~ # docker pull *****.dkr.ecr.us-west-2.amazonaws.com/myapp:latest however, if try deploying stack or service: docker stack deploy --compose-file docker-compose.yml myapp the image can't found , on node authenticated on other manager/worker nodes. error docker service ps myapp : "no such image: *****.dkr.ecr.us-west-2.amazonaws.com/myapp:latest" os: rhel 7.3 docker version: docker version 1.13.1-cs5, build 21c42d8 anyone have solution issue? try command docker login -u username -p password *****.dkr.ecr.us-west-2.amazonaws.com && docker stack deploy --compose-file docker-compose.yml myapp --with-registry-auth

python - How to Lengthen the Username Field on Django User Model? -

i have django web application deployed on heroku. i'm using django's user model authentication. goal lengthen username field 30 characters 100 characters. i overrode default user model own abstractuser model: class abstractuser(abstractbaseuser, permissionsmixin): username = models.charfield( _('username'), max_length=30, unique=true, help_text=_('required. 100 characters or fewer. letters, digits , @/./+/-/_ only.'), validators=[ validators.regexvalidator( r'^[\w.@+-]+$', _('enter valid username. value may contain ' 'letters, numbers ' 'and @/./+/-/_ characters.') ), ], error_messages={ 'unique': _("a user username exists."), }, ) first_name = models.charfield(_('first name'), max_length=30, blank=true) last_name = models.charfiel

sql - Django complex model - matching events with where clause -

in existing database have table tracking , correlating events , need ideas on how in django. intent query table sets of events occur @ same time. (this used things create scatter-plot graph 1 type of event on x-axis , type of event on y-axis each data point matched time occurred). the db schema looks this. table: event eventtime, eventtype, eventvalue 2017-08-01 10:00, type1, 100 2017-08-01 11:00, type1, 200 2017-08-01 12:00, type1, 300 2017-08-01 10:00, type2, 10 2017-08-01 11:00, type2, 20 2017-08-01 12:00, type2, 30 2017-08-02 14:00, type3, 20 2017-08-02 16:00, type3, 30 a sample query might (yes, ms-access - won't after porting django): select xaxis.eventtime xeventtime, xaxis.eventtype xeventtype, xaxis.value xvalue, yaxis.eventtype yeventtype, yaxis.value yvalue, event xaxis, event yaxis xaxis.eventtime = yaxis.eventtime , xaxis.eventtype='type1' , yaxis.eventtype='type2' , xaxi

javascript - add youtube comments with youtube API and node.js -

i managed fetch video data channel when try add comments video, fail. @ point can read data successfully. i have read docummentation: https://developers.google.com/youtube/v3/docs/commentthreads/insert and im not sure if did parameters correctly. besides node.js , express im using request-promise package promises if thats worth mention. const optionscomment = { method: 'post', uri: 'https://www.googleapis.com/youtube/v3/commentthreads', qs: { part: 'snippet', 'snippet.channelid': 'a channel id', 'snippet.videoid': 'some video id', 'snippet.toplevelcomment.snippet.textoriginal': 'a nice message', key: "my key" }, json: true }; rp(optionscomment) .then(result=>{ console.log("result of adding comment:", result); }) .catch(function(err){ console.log("error during add comment"); conso

algorithm - DP with Segment Tree and Lazy Propagation -

i read simple problem, , tried complex further , further , included other concepts along that. got stuck @ 1 point , cannot resolve further now. problem 1: given array, there q queries have find out next greater element of element in array. ex: array: 1,2,4,3,5 next greater element of 2 4, next greater element of 4 5 5 not have next greater element. solution: can use stack , can solved in o(max(n,q)). can find out here . problem 2: have find out next ith greater element, when saying next ith greater element, mean, make strictly increasing array greedily, starting given element , tell me ith element in that. (if see closely it's related problem 1). ex: next 2nd greater element of 2 in 1,2,4,3,5 5 , not 3. because increasing array 2,4,5 starting 2 , made greedily. solution: can solved using dp, make array of n x log(n) , i,j element of table store next 2^j th greater element index of ith element. table can filled column wise this: dp[i][j] = dp[dp[i][j-1]][j-1

c# - Pass Data from Child Window to MainWindow TextBlock -

Image
in example, mainwindow has button opens window2 . window2 has button writes "hello, world!" mainwindow textblock. project source: https://www.dropbox.com/s/jegeguhycs1mewu/passdata.zip?dl=0 what proper way pass data window2 mainwindow ? private mainwindow mainwindow; public mainwindow mainwindow { get; private set; } public window mainwindow { get; set; } private object mainwindow { get; private set; }; private mainwindow mainwindow = ((mainwindow)system.windows.application.current.mainwindow); this.mainwindow = mainwindow; mainwindow public partial class mainwindow : window { public mainwindow() { initializecomponent(); } // open window 2 private void buttonwindow2_click(object sender, routedeventargs e) { window2 window2 = new window2(this); window2.left = math.max(this.left - window2.width, 0); window2.top = math.max(this.top - 0, 0); window2.showdialog(); } } window 2 publi

Terraform common variable usage in modules -

i writing terraform script create asg on aws. tried create terraform module have more reusable code. problem when want use variable common-variable.tfvars on module tf files, keeps saying undefined , need declared. way, module less reuseable . here example root | |___project 1 | |_____ main.tf | |_____ common-variable.tfvars | |___ modules | |_____ a-module |______ main.tf so inside project 1 common-variable.tfvars, looks this variable "a" { description = "a variable" default = "a" } variable "b" { description = "a variable" default = "b" } inside a-module / main.tf looks variable "name" {} resource "aws_autoscaling_group" "asg-1" { name = "${var.a}" ... } when terraform init, says resource 'aws_autoscaling_group.asg-1' config: unknown variable referenced: 'a'. define 'variable&

zoo - R - rollapply with multiple "by" values -

i have trying find efficient way code below: library(zoo) maprice <- function(x,n) { mavg <- rollapply(x, n, mean) colnames(mavg) <- "maprice" mavg } price.ma.1hr <- maprice(out, 12) price.ma.2hr <- maprice(out, 24) price.ma.4hr <- maprice(out, 48) price.ma.6hr <- maprice(out, 72) the solution came following: maprice <- function(x,n) { ma <- matrix( ,nrow = nrow(x), ncol = length(n)) (i in 1:length(n)) { ma[,i]<- rollapply(x, n[i], mean) } ma } n <- c(1,2,4,6,8,12) price.ma <- maprice(price, n) price vector (ncol = 1) this still provides answer looking for, looking see if there alternate maybe efficient way. appreciated. note: looked @ question " rollapply multiple time diffrent arguments " on so. didnt understand process. assuming input vector v gives zoo object zz ith column formed using w[i] . as.data.frame(zz) or coredata(zz) used produce data.frame or ma

python - Merge multiple DataFrames in an efficient manner -

i have plenty of dataframes need merged axis=0 , it's important find fast way op. so far, try merge , append , these functions need assignment after merging df = df.append(df2) , become slower , slower, there method can merge in place , more efficient? assuming dataframes have same index, can use pd.concat : in [61]: df1 out[61]: 0 1 in [62]: df2 out[62]: b 0 2 create list of dataframes: in [63]: df_list = [df1, df2] now, call pd.concat : in [64]: pd.concat(df_list, axis=1) out[64]: b 0 1 2

ios - how to Unit test using XCTest for bluetooth peripherals -

i developing static library(objective c) find near bluetooth peripherals using 'centralmanager:diddiscoverperipheral' in corebluetooth framework. im new unit test , want unit test(check retrieved peripheral list correct) using xctest. understanding can't test bluetooth stuff using ios simulator. yet wanted know there way using xctest unit test above scenario. ps: cbperipheral class not have public initializer think can't mock(create dummy cbperipherals using 'category') peripherals guess have work real devices.

wordpress - Using onmouseover to change image size with wp_get_attachment_image involved -

below part of code use display multiple rows of products tiny thumbnails (35x35 pixels) next each product. admin page created, spreadsheet managing products, less space take better. everything works great, have client "mouseover" view larger image. understand how "onmouseover" and/or work css achieve enlargement of image, that's traditional <img src... > element. is possible alter or tap wp_get_attachment_image same effect? can't paste code <img> element because "not there", speak, type (sorry lack of terminology, assume function rather static code can work with). or, there way not set array(35,35) , make <li> size container, make image fill container, , work element image alteration? if ( $attachments ) { foreach ( $attachments $attachment ) { $thumbimg = wp_get_attachment_image( $attachment->id, array(35,35) ); $productlist .= '<li style="display: inline-block; vertical-align: t

How would you control transaction with Spring & Hibernate. -

this question has answer here: what difference between user variables , system variables? 4 answers i asked question during interiew process few week's back. not sure talk about. need talk session or lazy loading/eager loading or transaction manager or optimistic locking , pessimistic locking. use @transactional annotation @ service base class.use rollback conditions when exception thrown.

How to reset bundle to online mode for android in react native -

i changed react native js bundle offline mode link :- how use offline bundle on android react native project? now want reset js bundle online mode can continue development. couldn't found possible way that.

python - Syntax error while defining function, code works fine -

using spyder 3.5.1 python 3.5 on mac. i can't load function in workspace because of syntax error, though line causing error works fine if ran in console alone. notice same function did not return issue on windows machine. here line of code sel = np.random.choice([false, true], size=(len(cl),), p=[1-pct, pct]) where pct number 0 1 , cl pandas dataframe. same line returns true/false vector of correct length if ran console. i've checked similar questions , indenting/parenthesis still can't find reason. many thanks!

python-paramiko rpm has been deprecated in RHEL 7, is there any alternative for this? -

i have support of rhel 6 developed scripts rhel 7 well, while installing rpm features getting error due import paramiko in of feature scripts. surfed error , found rhel has removed support python-paramiko. can there alternative paramiko rpm?

javascript - Node - go through folder of JS files and extract certain bits -

Image
i'm maintaining document of tests spreadsheet - have 3 columns: filename text it block - mocha test it('does thing', function(){ ... }) a description - i'm writing. however don't idea of time consuming maintain. is possible automate this, i'm thinking npm package exists. run through folder, filenames , each js gather information after defined string regex. example text after //description , it( - this: //description: text here it('does thing', function(){ ... }) any appreciated. thanks. use esprima ast , filter out test blocks want, generate source code escodegen here code: const fs = require('fs') const path = require('path') const esprima = require('esprima') const escodegen = require('escodegen') function walksync (dir) { return fs.statsync(dir).isdirectory() ? array.prototype.concat(...fs.readdirsync(dir).map(f => walksync(path.join(dir, f)))) : dir } const result =

Alexa responds to my input outside the skills during an interaction delegate -

i using beta interaction model editor. 1 question want ask user's weight. have sample utterance "i weight {pounds} pounds." if though, seems breaks out of app , responds "160 pounds 72.58 kilograms". card in alexa app has title "what 1 hundred sixty pounds". alexa heard "i weigh 1 hundred sixty pounds". how can ask user weight , stay in app?

html - Tree structures in WebKit (Chrome) -

web browsers make many trees when navigating web pages including dom, cssom, render, layout trees. (does layout tree exists? or layout tree concept amounts being concept of rendering tree layout property?) i'm inspecting chromium source code, , i’m trying find data structure of each tree, , how/when/where made. i found dom tree in webkit, tree-like structure. following source code, , see references like: dom tree: https://www.slideshare.net/abapier/dom-48837015 high-level view: https://developers.google.com/web/fundamentals/performance/critical-rendering-path/constructing-the-object-model what found following: htmldocumentparser works through function htmldocumentparser::pumptokenizer() in function, calls htmldocumentparser::constructtreefromhtmltoken() , constructs dom tree using htmltreebuilder when finishing parsing (when parser sees </html> end tag), function document::finishedparsing() executed, , domcontentloaded event fired. i think cssom, r

visual studio - Why the test cases are got failed in the jenkin server windows slave machine randomly? -

when run ci jobs in jenkins, test cases got failed randomly in slave machine. if run same source in same slave machine again, got passed result test cases. using jenkins version of 2.73. how resolve issue ? is test case running depend on network speed?

build system - Tzdata(tzdata.inc) Bug in Yocto fido -

https://github.com/open-switch/ops-build/blob/master/yocto/poky/meta/recipes-extended/tzdata/tzdata.inc above link yocto-fido/poky/recipes-extended/tzdata . when compile above recipe not giving required out-put in /usr/share/zoneinfo in rootfs . is error in tzdata.inc? file please help. i have update tzdata.inc in github source below link. https://github.com/vsivanagulu/ops-build/blob/master/yocto/poky/meta/recipes-extended/tzdata/tzdata.inc

javascript - Dropbox-sdk not loading on cordova app? -

i'm trying make app using cordova make calls dropbox api via official dropbox-sdk-min.js. when run app on web browser, including android web browser, working , when try on phonegap app or compiled apk via phonegap, seems dropbox js not being loading or crashing @ point, can't access browser log in app. this js var dbx = new dropbox({ accesstoken: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' }); dbx.fileslistfolder({path: ''}) .then(function(response) { var entries = response.entries; alert(entries) $$.each(entries,function(v,i){ var cards=myapp.virtuallist($$("#vlcatalogo"),{ items:entries, template: strvar }); }) }) .catch(function(error) { console.log(error); }); this index.html <!doctype html> <html> <head> <!-- customize policy fit own app's needs. more guidance, see: https://github.com/apache/cordova-plugin-whitelist/blob/maste

powershell - RBAC for integration accounts in logic apps is not available -

in portal, can see error message when user read permission @ integration account level try upload in integration account says user doesn't have microsoft.logic/integrationaccounts/schemas/write permission. but, while creating custom rbac when enter same permission , try create rbac (in both powershell rest api) getting error message "invalidactionornotaction: role definition includes invalid action or notaction." also command get-azurermprovideroperation microsoft.logic/integrationaccounts/* reveals nothing. as of not supported. however, in pipeline , addressed. thank you, raj

jquery - Submit form data and upload using Ajax and php? -

Image
first of beginner php. here table structure of table "post" <form method="post" action="poststatus.php"> <textarea rows="3" name="con" id="con" placeholder="what think?"></textarea><br> <input type="file" accept="image/*" name="img" id="img> <button name="post" id="post"> post > </button> </form> poststatus.php <?php session_start(); require_once '../log/class.user.php'; $user_home = new user(); if(!$user_home->is_logged_in()) { $user_home->redirect('../log/index.php'); } $stmt = $user_home->runquery("select * tbl_users userid=:uid"); $stmt->execute(array(":uid"=>$_session['usersession'])); $row = $stmt->fetch(pdo::fetch_assoc); $userid = $row['userid']; $postid = microtime(); $con = $_post['con

java - JPanel not showing after panel.setVisible(true) -

i'm working on desktop app, goal fetch given url jsoup.connect() . works fine, takes couple of secs, tought i'll display "loading" gif or while it's not complete. fetch , display loading jpanel same button click. if want set jpanel visible button click, works fine (code below) private void btnrefreshselectedactionperformed(actionevent e) { panelrefresh.setvisible(true); } but when add url fetching, panel won't show up, should see 1-3 secs. code: private void btnrefreshselectedactionperformed(actionevent e) { panelrefresh.setvisible(true); //swingutilities.invokelater(() -> panelrefresh.setvisible(true)); - still not working //do jsoup.connect , other things (1-3 secs runtime) //... panelrefresh.setvisible(false); } what problem? i'm not familiar jsoup api, guessing, but.. sure method jsoup.connect() synchronous? perhaps initiates connection on separate thread , returns immediately, other thread calls ha

c# - How to read zipfile as StreamContent from httpResponseMessage? -

i send zipfile response.content: [httpget] [route("package")] public async task<httpresponsemessage> getlogspackage() { httpresponsemessage response = new httpresponsemessage(httpstatuscode.ok); using (var stream = new memorystream()) { using (var zipfile = zipfile.read((path.combine(path, opid.tostring()) + ".zip"))) { zipfile.save(stream); response.content = new streamcontent(stream); response.content.headers.contenttype = new mediatypeheadervalue("application/octet-stream"); response.content.headers.contentlength = stream.length; } } return response; } how stream after call method? code doesn't work( can't read zipfile) send stream.lenght ,for example, 345673, receive response 367 lenght. wrong? var response = await _coreendpoint.getlogspackage(); using (var stream = response.content.readasstreamasync()) usi

fullscreen - How to enable standard start menu in Windows Server 2012 R2 -

i on windows server 2012 r2 , when click windows button bring start menu, start menu fills whole screen. have followed windows 10 steps disable this, there no such setting under personalisation windows server 2012 r2. connect windows server 2012 r2 has normal start menu, possible enable it. do this? regards.

c++ - removing white separator form between QMenu and QToolBar -

Image
i have written qmenu , qtoolbar in qt. that's got: i can't find way remove white separator between qmenu(file, edit) , qtoolbar(two buttons piano icons). code: mainwindow::mainwindow() { this->setstylesheet("background-color: black;"); initmenu(); initbuttons(); } void mainwindow::initmenu() { menubar()->setstylesheet("background: #555555; " "color: #eeeeee; " "selection-background-color: #222222; " "border-color:#eeeeee;"); qmenu *filemenu = menubar()->addmenu("file"); qaction *newfileaction = new qaction("new", this); newfileaction->setshortcut(qkeysequence::new); newfileaction->setstatustip("create new file."); //connect filemenu->addaction(newfileaction); qaction *openfileaction = new qaction("open", this); openfilea

sql server - SQL query optimization -

i trying find out script can me in data density of dbs. point figure out query , need problem query takes ever. works find small dbs, doesn't happen lot. looking kind of optimization or ideas me. script: declare cur cursor select db_name() databasename ,s.[name] schemaname ,t.[name] tablename ,c.[name] columnname ,'[' + db_name() + ']' + '.[' + s.name + '].' + '[' + t.name + ']' fullqualifiedtablename ,d.[name] datatype sys.schemas s inner join sys.tables t on s.schema_id = t.schema_id inner join sys.columns c on t.object_id = c.object_id inner join sys.types d on c.user_type_id = d.user_type_id d.name '%int%' or d.name '%float%' or d.name '%decimal%' or d.name '%numeric%' or d.name '%real%' or d.name '%money%' or d.name '%date%' or d.name '%datetime%' , is_identity = 0 open cur fetch next cur @databasename ,@schemaname ,@tablename ,@columnname ,@fullyqualified

cakephp - Updating belongsToMany association data -

i setting form updates person , associated person_to_role tables, person_to_role intermediate table links person role in n..n relationship. role has predefined list of roles, shouldn't modified person's scope. i need update role_id , description in person_to_role table , add/remove records . sql --person +-------------+-------------+------+-----+---------+----------------+ | field | type | null | key | default | | +-------------+-------------+------+-----+---------+----------------+ | id | int(11) | no | pri | null | auto_increment | | nick_name | varchar(16) | yes | | null | | | first_name | varchar(24) | no | | null | | | middle_name | varchar(8) | yes | | null | | | last_name | varchar(24) | no | | null | | | birth_date | date | no | | null | | | gender | varchar(8) | no | |

sql - How to store JSON data in a meaningful way in Oracle -

using twitter api, can tweets : { "coordinates": null, "created_at": "mon sep 24 03:35:21 +0000 2012", "id_str": "250075927172759552", "entities": { "urls": [ ], "hashtags": [ { "text": "freebandnames", "indices": [ 20, 34 ] } ], "user_mentions": [ ] }, "in_reply_to_user_id_str": null, "contributors": null, "text": "aggressive ponytail #freebandnames", "metadata": { "iso_language_code": "en", "result_type": "recent" }, "retweet_count": 0, "profile_background_color": "c0deed", "verified": false, &q

Javascript/JSON code output issue -

in below code snippet can understand servlet getallusers getting called , servlet code json object being returned. please correct me if wrong. writer in below code mean output gets printed? thanks. (ext.cmd.derive("amgui.store.userstore", ext.data.store, { model: "amgui.model.usernamemodel", constructor: function(a) { var b = this; = || {}; b.callparent([ext.apply({ autoload: true, autodestroy: true, storeid: "userstore", proxy: { type: "ajax", url: "getallusers", reader: { type: "json", root: "userlist" }, writer: { type: "json", root: "users", writeallfields: true } } }, a)]) } }

ios - save image with QRCode in document directory in background thread -

i developing app in have picked 10 images ios gallery , generate qrcode of images , save in document directory using background thread problem when change tab bar means after processing start when move tab bar view background thread stop , 3 or 4 stored images. have used different different background function achive have used nsoperationqueue made separate class tried save not succeeded. code have used: - (void)elcimagepickercontroller:(elcimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsarray *)info { nslog(@"%@",info); [self dismissviewcontrolleranimated:yes completion:nil]; dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_background, 0), ^{ [self savealld:info]; dispatch_async(dispatch_get_main_queue(), ^{ }); }); } -(void)savealld:(nsarray*)info { // int i=0; (nsdictionary *dict in info) { if ([dict objectforkey:uiimagepic

java - Right click and "Open with..." -

i have image displayed imageview. when perform right click on it, want able choose program open image (ie. have "open with" menu item on windows). know solution open image default associated program , know how handle right clicking found nothing "open with" menu action.

eclipse - How can i add images in source folder of a Maven Java Project? -

Image
i have images in source folder of maven java project. can see in below image. if run install command of maven, when see generated jar file , not see images in sources in jar file. my maven configuration below. <plugins> <plugin> <artifactid>maven-compiler-plugin</artifactid> <version>3.6.1</version> <configuration> </configuration> </plugin> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-jar-plugin</artifactid> <version>2.4</version> <configuration> <archive> <manifest> <mainclass></mainclass> </manifest> </archive> </configuration> </plugin> </plugins

arrays - How to retrieve data from string in php? -

i have array 1 : monday, tuesday, wednesday, thursday, friday, saturday,. have each day separately , each 1 need need add checkbox near .thank help. you need store days array able loop through them foreach loop. <?php $days = array( 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday' ); foreach($days $day) { echo $day; echo '<input type="checkbox">'; } ?> update: as have stored days string, need explode string convert array can loop through them. <?php $days = "monday, tuesday, wednesday, thurday, friday, saturday, sunday"; $days = explode(", ", $days); foreach($days $day) { echo $day; echo '<input type="checkbox">'; } ?>

Where to load packages when sourcing an R script -

i have 2 r scripts. scriptb called in scripta via source("scriptb.r") both scripta , scriptb load same library(x) x knitr or stringr or few other packages however, because scriptb calls library(x) example, seems scripta forced unload library(x) , load scriptb library(x) . leads following error: error in unloadnamespace(package) : namespace 'x' imported 'y' cannot unloaded error in library(x) : package 'x' version n.nn cannot unloaded i don't call unloadnamespace in source script i'm not sure why happening? how can prevent unload. should use require() in scripta can fail gracefully? so questions are: is sourcing r script best way include objects r script or there friendlier way how avoid script trying unload package x? ok sorted it. problem think was using old versions of stringr in scripta or b updated package , runs fine. suppose r unloads same library if there versioning difference , prefers library called

javascript - Iterate through select options with button click -

this seems should incredibly easy it's in morning , i'm drawing blank. i have select contains % values (for zooming) , having dropdown want have 2 buttons (+ , -) iterate through list. so assuming had: <button id="minusbutton">-</button> <select id="zoomselect" onchange="zoom()"> <option value="10">10%</option> <option value="20">20%</option> <option value="50">50%</option> <option value="100" selected="selected">100%</option> </select> <button id="plusbutton">+</button> how go switching , down select each time button pressed. ensuring stops nicely on 100% , 10% (ie, no wrapping round or throwing error if keep pressing +). thanks much! $(document).on('click', '#minusbutton', function() { var selindex = $("#zoomselect").prop('

dynamic - DexFile Not working on Android Lollipop and above -

so trying list of classes in application package.the issue below method not working on android lollipop , above. bear in mind cannot use pathclassloader because don't know name of classes. here code: string packagecodepath = context.getpackagecodepath(); dexfile df = new dexfile(packagecodepath); (enumeration<string> iter = df.entries(); iter.hasmoreelements(); ) { string classname = iter.nextelement(); if (classname.contains(mypackagename)) { classes.add(classname.substring(classname.lastindexof(".") + 1, classname.length())); } } am doing wrong here? have alternative solution?

Multiple extensions for a VM with Azure ARM -

we configuring our vm arm. use dsc install of requirements, however, installing anti malware extension dsc not work. we getting following error: multiple vmextensions per handler not supported os type 'windows'. vmextension 'dscextension' handler 'microsoft.powershell.dsc' added or specified in input. the resources this: { "type":"microsoft.compute/virtualmachines/extensions", "name":"[concat(variables('vmname'),'/', 'antimalwareextension')]", "apiversion":"[variables('api-version')]", "location":"[resourcegroup().location]", "dependson":[ "[concat('microsoft.compute/virtualmachines/', variables('vmname'))]" ], "properties":{ "publisher":"microsoft.azure.security", "type":"iaasantimalware", "typehandlerversion&q

databricks - Read XML File in Spark with multiple RowTags -

i read huge xml file 3 different rowtags apache spark dataframes. rowtag = xml element, interpret row in spark. the tags contain different data structures are not overlapping xml-spark ( https://github.com/databricks/spark-xml ) offers read 1 rowtag time, need read same file 3 times (not efficient). is there way read file in 1 read ? details: i have huge xml file (24 gb) contain 3 lists: <myfile> <containedresourcelist> <soundrecording><title>a</title></soundrecording> ... several million records ... <soundrecording><title>z</title></soundrecording> </containedresourcelist> <containedreleaselist> <release><releasetype>single</releasetype></release> ... several million records ... <release><releasetype>lp</releasetype></release> </containedreleaselist> <containedtransactio