Posts

Showing posts from January, 2012

Max value from field Spring Data and Mongodb -

i want calculate maximum value of field code within entity "user", use spring data, have seen code as: ".find({}).sort({"updatetime" : -1}).limit(1)" but not know how integrate "repository" @query or equivalent solution, return maximum value of said field. can me? thank you. you can write custom method repository. example have: public interface userrepository extends mongorepository<user, string>, userrepositorycustom { ... } additional methods repository: public interface userrepositorycustom { user maxuser(); } and implementation of it: public class userrepositoryimpl implements userrepositorycustom { @autowired private mongotemplate mongotemplate; @override public user maxuser() { final query query = new query() .limit(1) .with(new sort(sort.direction.desc, "updatetime")); return mongotemplate.findone(query, user.class) } } ...

python - Assign init arguments automatically in decorator -

i trying assign arguments passed init class. cannot arguments, nor class self (the self init gets passed first arg): class unpack_arguments(object): def __init__(self, f): self.f = f def __call__(self, *args, **kwargs): import ipdb; ipdb.set_trace() class someobject(object): @unpack_arguments def __init__(self, one=1, two=2, three=3, four=4): pass # @ point, can # # obj = someobject() # obj.one # 1 # obj.two # 2 # obj.three # 3 # obj.four # 4 obj = someobject() i try find things can't find class instance of someobject or key names one , two , etc: ipdb> kwargs {} ipdb> args self = <__main__.unpack_arguments object @ 0x1077a3f60> args = () kwargs = {} ipdb> self.f <function someobject.__init__ @ 0x1077a06a8> ipdb> dir(self.f) ['__annotations__', '__call__', '__class__', '__closure__', '__code__', '__defaults__', '__delattr__', '__dict__...

html - grunt-include-replace adding a folder when it compiles -

i'm @ wits end trying figure out. have include replace pulling src folder , compiling dist folder. doing that, however, it's adding src folder dist folder , putting html file that. if pull root directory instead of src folder, works fine , puts html dist folder no folder. why adding path src folder create src folder inside dist folder , how stop doing that? my code set this... distdir: 'dist', srcdir: 'src', includereplace: { dist: { options: { includesdir: '<%= srcdir %>/includes/' }, src: '<%= srcdir %>/*.html', dest: '<%= distdir %>' } } never mind. figured out. have this: files: [ { src: '*.html', dest: '<%= distdir %>/', expand: true, cwd: '<%= srcdir %>/' } ]

asp.net mvc - Sending hyperlink in the email issue -

mvc 4, c#, visual studio 2015, using smtp server. sending hyperlink in email. few people (out of email sent to) receive not complete hyperlink, part of hyperlink blue-underlined-active (represented in bold below). when clicked on, takes https://abcd.efgh.org , not page whole link points to. few use gmail receive emails. https://abcd.efgh.org /testone/testtwo/12?enr=12c873%2goyrjmhxsi%2b9g12xsmv1veb%2ccnndj3o23gi7giu5r5ypyb9ldtkqdbavgwzdpk%2kw%3d%3d ---- view sendmyemail.html.cshtml-------------------------------------------------------------------- @using actionmailer.net @model emailsend @{ layout = "~/views/shared/_email_layout.cshtml"; var emailcontent = model.email.emailcontent; // text emailcontent = emailcontent.replace("{my_hyperlink}", @viewbag.hyperlink); } <!doctype html> <html> <head> <title>mytitle.html</title> </head> <body> <div> @html.raw(em...

r - RMarkdown: preserve source code formatting in code cell -

Image
my rmarkdown source looks (screenshot rstudio): (notice empty lines) when press ctrl+shift+k got view expected (with empty lines). however, if run chunk (evaluate) , compile ( ctrl+shift+k ), get: (no empty lines) is there way how preserve empty lines in source code? (i checked knitr options: strip.white=false, tidy=true, tidy.opts=list(blank=true) no joy.) i'm using rstudio 1.0.153 other info: sessioninfo() r version 3.4.1 (2017-06-30) platform: x86_64-pc-linux-gnu (64-bit) running under: debian gnu/linux 9 (stretch) matrix products: default blas: /usr/lib/openblas-base/libblas.so.3 lapack: /usr/lib/libopenblasp-r0.2.19.so locale: [1] lc_ctype=en_us.utf-8 lc_numeric=c [3] lc_time=en_us.utf-8 lc_collate=en_us.utf-8 [5] lc_monetary=en_us.utf-8 lc_messages=en_us.utf-8 [7] lc_paper=en_us.utf-8 lc_name=c [9] lc_address=c lc_telephone=c [11] lc_measurement=en_us.utf-8 l...

lisp - Allegro CL, Debugging functions step by step -

this question has answer here: how debug in [clozure] common lisp? 3 answers i trying understand how function works in lisp, used allegro cl quite time ago, , remember had special function in repl, let see how function worked step step, in matlab. example, if had function: (+ 1 (* 2 3 (/ 6 2) ) ) you see each function step step, like: (+ 1 (* 2 3 3) ) and then: (+ 1 18) and finally: 19 many in advance. thanks jkiiski, the code showing step step function be: (step (+ 1 (* 2 3 (/ 6 2)))) and shows in detail how lisp parses data , evaluates function. after many steps gives: [step] cg-user(2): result 6: 2 6: (/ 6 2) [step] cg-user(2): result 5: 18 result 4: 18 result 3: 18 result 2: 18 2: (+ 1 18) [step] cg-user(2): result 2: 19 result 1: 19

SPARK_WORKER_INSTANCES for Spark 2.2.0 -

in spark 2.2.0, not see option spark_worker_instances launch multiple workers per node. how do this? if @ spark-env.sh file inside conf directory of spark folder, see option spark_worker_instances=1 . can change number want. so when spark started sbin/start-all.sh number of worker nodes defined should started on machine.

ios - Pushing a button in a Scrollview without UserInteraction on -

i using uitableview headers , footers, whole tableview has horizontal uiscrollviews inside. use lock titles function, in excel. the userinteraction disabled on uiscrollview in uitableview header , uitableview footer , scrolls when body scrolls. in header have button situated in uiscrollviews contentview , need able interact it, not... has come across in past? much of unneeded code has been omitted... - (uiview *)tableview:(uitableview *)tableview viewforheaderinsection:(nsinteger)section { uitableviewheaderfooterview *viewheader; uibutton *flow; viewheader = [[uitableviewheaderfooterview alloc] initwithframe:cgrectmake(0, 1, self.tableview.frame.size.width, 48)]; uiview *thiscontentview = [[uiview alloc]initwithframe:cgrectmake(0, 0, contentwidth, 48)]; flow = [[uibutton alloc] initwithframe:cgrectmake( flowrate.frame.origin.x + flowrate.frame.size.width + 5, 14, colwidth1, 20)]; [flow.imageview setimage:[uiimage imagenamed:@"ic_flow...

big o - What would be the complexity of this Sorting Algorithm? What are the demerits of using the same? -

the sorting algorithm can described follows: 1. create binary search tree array data. (for multiple occurences, increment occurence variable of current node) 2. traverse bst in inorder fashion. (inorder traversal return sorted order of elements in array). 3. @ each node in inorder traversal, overwrite array element @ current index(index beginning @ 0) current node value. here's java implementation same: structure of node class class node { node left; int data; int occurence; node right; } inorder function (returning type int obtaining correct indices @ every call, serve no other purpose) public int inorder(node root,int[] arr,int index) { if(root == null) return index; index = inorder(root.left,arr,index); for(int = 0; < root.getoccurence(); i++) arr[index++] = root.getdata(); index = inorder(root.right,arr,index); return index; } main() public static void main(string[] args) { int[] arr = new int[]{100...

json - JMSSerializerBundle and custom normalaizers -

in our project useing jmsserializerbundle , api responses need use custom normalizers . when using standard symfony serializer working well, in jms-only way of attaching normalizers, using subscribinghandler interats few types like: null string boolean double float array so question is, know of solution have jms , symfony custom normalizers work together?

php - DynamoDB Query Iterator -

based on official dynamodb documentation, query operation retrieve maximum of 1mb of data, , recommended use getiterator method retrieve entire list of data matching query. sample code provided on http://docs.aws.amazon.com/aws-sdk-php/v2/guide/service-dynamodb.html#query below. $iterator = $client->getiterator('query', array( 'tablename' => 'errors', 'keyconditions' => array( 'id' => array( 'attributevaluelist' => array( array('n' => '1201') ), 'comparisonoperator' => 'eq' ), 'time' => array( 'attributevaluelist' => array( array('n' => strtotime("-15 minutes")) ), 'comparisonoperator' => 'gt' ) ) )); // each item contain attributes added foreach ($iterator $item) { ...

jsonschema - How to use JSON schema oneOf for arrays with fixed values -

i want specify multiple values oneof , have defined below schema validates ( http://json-schema-validator.herokuapp.com/ ). note there deliberately 1 value under oneof in example. { "id": "test-schema", "$schema": "http://json-schema.org/draft-04/schema#", "description": "test schema", "type": "object", "properties": { "alpha": { "type": "object", "properties": { "beta": { "oneof": [ { "type": "object", "properties": { "obja": { "type": "object", "properties": { ...

html - CSS positioning images in the correct place -

i have following html: #cake1 { float: left; } #cake2 { width: 200px; height: 200px; } <img id="cake1" src="https://www.bbcgoodfood.com/sites/default/files/styles/category_retina/public/recipe-collections/collection-image/2013/05/rosewater-raspberry-sponge-cake.jpg?itok=ovpusqm9" /> <h2>cake</h2> <img id="cake2" src="https://www.bbcgoodfood.com/sites/default/files/styles/category_retina/public/chocolate-avocado-cake.jpg?itok=e2ewe_dx" /> i trying cake2 appear under cake1 using css, instead of displaying on right of image. i removed float:left ; <html> <head> <style> #cake2{ width: 200px; height: 200px; } </style> </head> <body> <img id="cake1" src="https://www.bbcgoodfood.com/sites/default/files/styles/category_retina/public/recipe-collections/collection-image/2013/05/rose...

C# Outlook Retrieving the COM class factory for component with CLSID failed due to the following error: 80080005 -

i getting below error when try access outlook folder download attachment inbox. code working when run windows form application. when use windows service auto scan outlook folder, getting issue. *pollingservice encountered error 'retrieving com class factory component clsid {0006f03a-0000-0000-c000-000000000046} failed due following error: 80080005.' for more information, see , support center @ http://go.microsoft.com/fwlink/events.asp .* microsoft not recommend, , not support, automation of microsoft office applications unattended, non-interactive client application or component (including asp, asp.net, dcom, , nt services), because office may exhibit unstable behavior and/or deadlock when office run in environment. if building solution runs in server-side context, should try use components have been made safe unattended execution. or, should try find alternatives allow @ least part of code run client-side. if use office application server-side solution, app...

linux - Does iomem comprehensively list everything that's addressable? -

there address range here that's not listed in /proc/iomem. when tried read in address range, got values, 0x000000ab, indicate there behind address range. so question title is: iomem comprehensively list that's addressable? there else that's memory-mapped not listed iomem? the environment issue linux running on custom made board x86 cpu.

android - Enable Debug mode on your development device for Firebase -

i have user properties/tags want test in real-time in firebase console. have have piping set correctly see tags builds uploaded hours later. i have read command adb shell setprop debug.firebase.analytics.app <package_name> should take care of doesn't seem working me. steps have taken: ran build via android studio opened terminal in android studio , ran adb shell setprop debug.firebase.analytics.app com.x.y.android.qa.debug (where x , y app identifiers, qa flavor , debug debug build) i still see no devices available in firebase debugview dashboard. am missing step? need build , deploy app command line? thanks, otterman

c# - Accessing dimensions (width/height) from a VideoPlayer source URL -

i working on unity project requires me download video file (mp4 format) , play using videoplayer component. because file downloaded @ runtime, have "stream" via url downloaded location, opposed loading videoclip. to accurately size target rendertexture , gameobject video playing to, need dimensions of video file itself. because not videoclip cannot use: videoclip clip = videoplayer.clip; float videowidth = clip.width; float videoheight = clip.height; because using source url opposed videoclip, return null. can video dimensions directly file somehow? you can retrieve these information texture videoplayer constructs. get videoplayer videoplayer videoplayer = getcomponent<videoplayer>(); get texture videoplayer texture vidtex = videoplayer.texture; get videoplayer dimension width/height float videowidth = vidtex.width; float videoheight = vidtex.height; make sure texture after videoplayer.isprepared true . see other answer full code o...

postgresql - ERROR: extra data after last expected column - COPY -

when try import data delimiter | receive error: error: data after last expected column i able load data if remove double quote or single quote filed have issue in below sample data requirement need data without removing any. this copy command: copy public.dimingredient '/users//downloads/archive1/test.txt' delimiter '|' null '' csv header escape '"' ; my table: public.dimingredient ( dr_id integer not null, dr_loadtime timestamp(6) without time zone not null, dr_start timestamp(6) without time zone not null, dr_end timestamp(6) without time zone not null, dr_current boolean not null, casnumber character varying(100) collate pg_catalog."default" not null, ingredientname character varying(300) collate pg_catalog."default" not null, matchingstrategy character varying(21) collate pg_catalog."default", percentofconfidence double precision, disclosurestatus ...

Aside from the resulting git tree structure, are there any important differences between git pull vs git fetch + git rebase? -

i've worked on dev team preferred use method of git fetch , git rebase rather method of git pull , before git pushing changes avoid merge conflicts. is there specific reason besides difference in visual tree structure? according http://mattsnider.com/git-rebase-versus-git-pull/ fetch & rebase "will produce cleaner history, without extraneous merge commits" but between 2 methods there other reasons choose 1 on other? git pull = git fetch + git merge git pull --rebase or git pull -r = git fetch + git rebase no more, no less ;-) there no magic. second. the main advantage of doing fetch rebase in 2 distinct steps first doesn't modify local branch (absolutely no risks) , every time (you create task run periodically). and once fetched, @ history, compare commits, , decide want , when...

Oracle 11: reclaim space after setting BLOBs to NULL -

on table contains blobs , today filled 32gb tablespace, removed large percentage of blobs setting them null update statement (leaving remaining columns untouched of course). no space freed had add 2nd datafile, 4gb, in order allow insert queries work. did "alter table x move", no benefit. did "alter table x shrink space", increased occupancy of 2nd datafile , left 1st 1 unaffected. i found utility on net calculates how space can saved, , gives me users ts has 4004mb can freed, when i'd expect @ least 10gb (4gb 2nd datafile should empty plus @ least 6gb 1st datafile filled capacity=32gb). it seems impossible free space. setting null bad idea? why oracle refusing see space reclaimable? please advise. check if helps: http://www.dba-oracle.com/t_update_blob_reclaim_space.htm answer: lob/blob column still exists within table blocks, , data still there. marked unused. free space, use command: alter table my_tab modify lob event...

java - Passing username to a HttpGet request -

i need access api works this: curl https://api.com/ratings/v1/ -u [your token here]: the token username should passed httpget request. trying same in following way using java: credentialsprovider credentialsprovider = new basiccredentialsprovider(); credentialsprovider.setcredentials(authscope.any, new usernamepasswordcredentials("usrname", "passwrd")); httphost proxy = new httphost("proxy.com", 8080, "http"); httpclient httpclient = httpclients.custom().setproxy(proxy).setdefaultcredentialsprovider(credentialsprovider).build(); httpget toesget = new httpget("https://api.com/ratings/v1/"); toesget.setheader("accept", "application/json"); toesget.addheader("username", "[your token here]"); try { httpresponse toes = httpclient.execute(toesget); system.out.println(toes.getstatusline()); system.out.println(toes.getentity().tostring()); } catch (ex...

webforms - Path translation in asp.net masterpage -

in site.master page, have references few css , js files. when page in subfolder uses master page, can see css file's path gets correctly translated, adding necessary ../ in front of it, not js files results in 404 errors when viewed in chrome's debug window. i tired using ~ runat=server force translation; didn't work; tried using page.resolveurl gives no error message seems break script , not sure how can work. in site.master: <!-- bootstrap core css --> <link href="assets/css/bootstrap.min.css" rel="stylesheet" /> this gets correctly displayed following .aspx page in sub-folder: <link href="../assets/css/bootstrap.min.css" rel="stylesheet" /> for js files, none of following works. this 1 shows same file in sub-folder: <!-- bootstrap core javascript --> <script src="assets/scripts/bootstrap.min.js"></script> this 1 shows no 404 erro; "/<sitename>/" get...

SQL Server with linked server to quickbooks -

so attempting connect sql server 2012 quickbooks account through quickbooks driver called qodbc. following pages seen here , here , have reached point unable proceed. it enter second article , in sql server management studio running query: select * tbl_account qremote...account through new query. fails message msg 7303, level 16, state 1, line 1 [qodbc] qb begin session failed. error = 80040430, application unable log quickbooks company data file automatically. quickbooks administrator must grant permission automatic login through integrated application references. if such permission granted, administrator must revoke permission, save preferences, grant permission again. cannot initialize data source object of ole db provider "msdasql" linked server "qremote". i have given correct permissions quickbooks, , have removed , re-granted permissions. cannot find anywhere has said can done issue besides re-granting permissions, , wondering...

vba - Check cell value in a table excel? -

trying check if cell value in "calendar" contained in table ams, wich located in sheet in same workbook error item specified name not founf...help please sub look() activeworkbook.sheets("calendar").select range("c7").select if intersect(activecell, [ams]) nothing msgbox "activecell not in table1" else msgbox "yup" end if

oauth 2.0 - Azure AD: Authentication missing or malformed -

i using postman query graph api list of applications on instance of aad. auth url: https://login.microsoftonline.com/common/oauth2/authorize?resource=https%3a%2f%2fmanagement.azure.com%2f access token url: https://login.microsoftonline.com/common/oauth2/token with these, i'm able access token. when attempt query graph api list of applications, along access token included in header, following error: { "error": { "code": "invalidauthenticationtoken", "message": "access token validation failure.", "innererror": { "request-id": "***-***-***", "date": "2017-07-25t16:21:06" } } } is there way resolve this? edit: found weird when receive access token, not receive refresh token along :| thanks! the resource value in auth url not graph api endpoint, access token obtained resource , graph api cannot validate it. graph api endpoint s...

papyrus - Unable to get Requirement in Acceleo -

can not requirement model. have tried getappliedstereotypes() still not works. code following: [comment encoding = utf-8 /] [module maintest('http://www.eclipse.org/papyrus/sysml/1.4/sysml', 'http://www.eclipse.org/papyrus/sysml/1.4/sysml/activities', 'http://www.eclipse.org/papyrus/sysml/1.4/sysml/requirements', 'http://www.eclipse.org/uml2/5.0.0/uml')/] [template public maintestclass(apackage : package)] [comment @main /] [file ((apackage.name+'.m'), false, 'utf-8')] 0000 [for (r : requirements::requirement| apackage.packagedelement->filter(requirements::requirement))] 11111 [/for] [/file] [/template] also, page http://techqa.info/programming/question/35093700/cannot-access-sysml-stereotypes-and-their-properties-in-acceleo , can requirement generate(re : requirements::requirement) can not meet needs since have put node values in model document, template cannot model information. or maybe solutions getting nodes inf...

project settings - Can I set custom developer's name for creating files in Xcode? -

Image
when xcode creates new textual file, contains such header: // // appdelegate.swift // application name // // created developer name on 25.07.17. // copyright © 2017 company. rights reserved. // application name , company values gives project when developer's name macos account can set custom developer's name project in xcode directly, without changing or setting os account? it needed example when 1 mac uses work , home projects. want set real name work projects , pen name home. thanks mark 's comment found answer for set custom project developer's name info.plist file must edited just add row copyright (human-readable) (source code key nshumanreadablecopyright ) , enter needed name: or directly in source code: <?xml version="1.0" encoding="utf-8"?> <!doctype plist public "-//apple//dtd plist 1.0//en" "http://www.apple.com/dtds/propertylist-1.0.dtd"> <plist version="1.0...

php - How can I paginate data from a model join with different database's table in cakephp? -

i have cakephp app use 2 databases, main 1 , common 1 share information other apps. in app need paginate tbl_properties join tbl_favorite_properties . made query. $options = array(); $options ['joins'] [] = array ('table' =>"tbl_properties", 'alias' => 'property', 'type' => 'left', 'foreignkey' => false, 'conditions' => array ('property.mls = favoriteproperty.mls_num' ) ); $conditions = array('conditions'=>array('favoriteproperty.user_id'=>$user_id)); $arrfields = array ('fields' => array ('favoriteproperty.user_id','favoriteproperty.mls_num mls','property.id','property.mls','property.house_number')); $criterias = array_merge($options,$conditions,$arrfields); $this->controller->paginate = $criterias; $favproperties = $this->controller->paginate('favoriteproperty'); the bl_properties i...

vb.net - write an Algorithm for a Function that calculates average of 3 numbers and then average is called by a sub procedure to display the average -

i have no problem programming in vb.net rather simple. understand functions , sub procedures , how work. im having trouble writing algorithm. below algorithm ive writen if had take place in sub procedure: ~start display "enter first number" enter num1 display "enter second number" enter num2 display "enter third number" enter num3 ~process average = (num1 + num2 + num3) / 3 ~output display average i know how should write algorithm if calculations done in function , answer displayed sub-procedure. have state function , procedure name? have indicate if variables byval or byref? i have looked rather thoroughly solution or atleast pointer in right direction. you use flowchart, since easiest , (at least me) more option small algorithms. there lot of free software....just flowchart software. here have info , under "see also" section, can find other options "represent" algorithm. ulm option. about b...

CSS Odd Behavior: min-height and margin collapse -

consider following code: .container { min-height: 100px; background-color: lightgreen; } p { margin-bottom: 50px; } <div class="container"> <p>welcome</p> </div> <div class="after"> main content. </div> http://jsfiddle.net/lp4tp/31/ question: mdn's margin collapse page states if there min-height set on parent element, prevent bottom margin adjoining last child's bottom margin - prevent margin collapsing. me, makes sense. parent , first/last child: if there no border, padding, inline part, block_formatting_context created or clearance separate margin-top of block margin-top of first child block, or no border, padding, inline content, height, min-height, or max-height separate margin-bottom of block margin-bottom of last child, margins collapse. collapsed margin ends outside parent. in example, however, devtools shows bottom margin of p tag expected - directly ben...

java - Writing my own compareToIgnoreCase method -

so i've looked around similar question day or 2 , seems new topic. little project, i'm trying hand write own comparetoignorecase() method without using api strings. in program, user enters string , class definition converts string char array. user enter string , compare first string entered. here compareto() method wrote. question is, how edit ignore case while comparing. public int compareto(mystring anothermystring) { if(anothermystring.sequence[i] > 0) { return 1; } else if(anothermystring.sequence[i] == 0) { return 0; } else { return -1; } } assuming you're ok using java.lang.character , 1 possible solution ignore case convert each char lowercase before comparing them: char1 = character.tolowercase(char1); char2 = character.tolowercase(char2); // compare char1, char2

javascript - jquery serializeArray() wordpress -

i trying submit form wordpress page php script resides in same directory index.php using custom html option on page generate form , using jquery serializearray() send data php script. in console, when submit jquery("#formid").serializearray(); returns object stores name , value of each of inputs. however, when use jquery("resultdiv").load("phpscript.php", jquery("#formid").serializearray()); php $_post variable empty. i've used method in past , has worked. reason, it's not working in case. else have issue? here's script looks like: <script type="text/javascript"> //need validate form jquery("#sendform").click(function() { var email = jquery("#sub_email").val(); var email2 = jquery("#sub_verify_email").val(); var type_reseller = jquery("#sub_type").val(); var province = jquery("#sub_prov").val(); var country_from = jquery("#sub_country...

javascript - How to control the movement of search box while searching any element in it? -

i have made search box , whenever search element in it, search box moves towards right reasons. here fiddle it. i want make sure, whenever searching element, box should not move (not going towards right or left). the html, css , js have used form are: function myfunction() { var input, filter, ul, li, a, i; input = document.getelementbyid("myinput"); filter = input.value.touppercase(); ul = document.getelementbyid("myul"); li = ul.getelementsbytagname("li"); (i = 0; < li.length; i++) { = li[i].getelementsbytagname("a")[0]; if (a.innerhtml.touppercase().indexof(filter) > -1) { li[i].style.display = ""; } else { li[i].style.display = "none"; } } } /* search box start */ #myin...

Creating array from file; getting error: Exception in thread "main" java.util.NoSuchElementException: No line found -

all trying create array numbers in file... i'm pretty new java may not efficient way i'm going off limited knowledge now. when run it, following message: exception in thread "main" java.util.nosuchelementexception: no line found @ java.util.scanner.nextline(scanner.java:1540) @ createarray.main(createarray.java:27) here feeble attempt @ code: import java.io.*; import java.util.scanner; import java.util.arraylist; public class createarray { public static void main(string[] args) throws ioexception { file file = new file("numbers.txt"); scanner inputfile = new scanner(file); // find number of lines in file int count = 0; while (inputfile.hasnextline()) { string str = inputfile.nextline(); count++; } // create array double[] numbers = new double[count]; // add numbers array string str; while (inputfile.hasnextline()); { (int = 0; < count; i++) { str = inpu...

android - Quick way to add hundreds of items to an XML <animation-list> element -

i have add 100 .png's create animationdrawable on android. luckily, png's named in ascending order (p1, p2, p3, p4). manually adding pngs xml element painfully slow, i'm wondering if there's way automatically 'increment' filename limit. the method not have use android studio. text manipulation program do. below example of desired result: <animation-list android:id="@+id/selected" android:oneshot="false" xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/p1" android:duration="500" /> <item android:drawable="@drawable/p2" android:duration="500" /> <item android:drawable="@drawable/p3" android:duration="500" /> <item android:drawable="@drawable/p4" android:duration="500" /> ... ... ... <item android:drawable="@drawable/p99" android:duration="500" /...

apache zookeeper - Kafka partition leader not updated after broker removed -

i have kafka cluster managed marathon/mesos had 3 brokers version 0.10.2.1 . docker images based on wurstmeister/kafka-docker . broker.id=-1 assigned automatically , sequentially @ start , leaders auto-rebalanced auto.leader.rebalance.enable=true . clients version 0.8.2.1 . zookeeper configuration: ➜ zkcli -server zookeeper.example.com:2181 ls /brokers/ids [1106, 1105, 1104] ➜ zkcli -server zookeeper.example.com:2181 /brokers/ids/1104 {"listener_security_protocol_map":{"plaintext":"plaintext"}, "endpoints":["plaintext://host1.mesos-slave.example.com:9092"], "jmx_port":9999,"host":"host1.mesos-slave.example.com", "timestamp":"1500987386409", "port":9092,"version":4} ➜ zkcli -server zookeeper.example.com:2181 /brokers/ids/1105 {"listener_security_protocol_map":{"plaintext":"plaintext"}, "endpoints":["plaintext://ho...

spring - Projection create new field -

i have class represents user date of birth in 2 separated fields public class user { private int yearofbirth; private int monthofbirth; } is possible make projection exports user age? know can concatenate fields using @value . something this, example: public class useragedto { private int yearofbirth; private int monthofbirth; public useragedto(int yearofbirth, int monthofbirth) { // constructor implementation... } public int getage() { // age calculation... } } public interface userrepo extends jparepository<user, long> { @query("select new com.example.myapp.dto.useragedto(u.yearofbirth, u.monthofbirth) user u u = ?") useragedto getuseragedto(user user); } some info

Building an App in SharePoint Online -

i have client wanted easier way team members build/update pages on site, site heavily customized lot of javascript. issues when team member wanted add new section page had consult dev person hard code in desired features. decided create customizable web parts of features making site more self-serviceable. when first started found documentation said use visual studios build web part using sandbox code, upload site , need activate deploy on site. buuut unbeknownst me code based sandbox solutions no longer supported in sharepoint , therefore web parts built not deployed. told needed build add-in, started building add-ins found customizable field properties (i.e. ability change background color, text style/color , banner color) want not implementable add-ins. so i’m @ square 1 , don’t know if it’s possible build web part add-in or need go different route? any thoughts or links sources can provide hugely appreciated! thanks terek in sharepoint 2016 things have changed l...

sql server - SQL loses decimals after multiplication -

i have table includes: count risk 35 0.6456000000 11 0.5234000000 4 0.8431000000 i need column multiply 2 columns. i'm getting result of: total 35 11 4 count - int risk - varchar sql rounding decimals 1. i've tried casting decimal, numeric , multiplying 1.0. need retain decimals actual calculation. great convert result decimal select convert(decimal(16,10), count * risk) decimalresult dbo.whatever; or convert count decimal select cast(count decimal(16,10)) * risk

r - partykit minsize option drops branches that exceed minsize -

Image
i'm using lmtree() function partykit partition data using linear regressions. regressions use weight, , want ensure each branch has minimum total weight, specify minsize option. instance, in following example tree has 2 branches instead of 3 because x1=="c" has small weight in own branch. n <- 100 x <- rbind( data.frame(tt=1:n, x1="a", weight=2, y=seq(1,l=n,by=0.2)+rnorm(n,sd=.2)), data.frame(tt=1:n, x1="b", weight=2, y=seq(1,l=n,by=0.4)+rnorm(n,sd=.2)), data.frame(tt=1:n, x1="c", weight=1, y=seq(1,l=n,by=0.6)+rnorm(n,sd=.2)) ) x$x1 <- factor(x$x1) tr <- lmtree(y ~ tt | x1, data=x, weight=weight, minsize=150) fitted party: [1] root | [2] x1 in a: n = 200 | (intercept) tt | 0.7724903 0.2002023 | [3] x1 in b, c: n = 300 | (intercept) tt | 0.5759213 0.4659592 i have real-world data unfortunately confidential leading behavior not understand. when not specify...

javascript - Timeout for String.replace -

i trying add width , height attribute tag via javascript. img src web ( http://www.... .). using javascript.replace add in height , width. here code. (currently width). <!doctype html> <html> <body> <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script> <script> $(window).load(function() { var htmlstring = '<div class="sample"> <img src="https://kbob.github.io/images/sample-5.jpg"> </div><div class="sample_another"><img src="http://www.crazymonkeydefense.com/wp-content/uploads/2012/02/sample-img3.png"> </div> '; function dostuff(img, imgstring) { img.onload = function() { imgstring = imgstring.replace("<img ", '<img width="' + this.width + 'px" '); console.log("modified = " + imgstring); }; }...

javascript - How to delete a row in gridview after clicking the delete button in a form -

i have aspx page has gridview 3 fields , 1 button "update". when click on update button i'll redirected aspx page has form more information entry in grid view selected clicking button "update". form contains more fields , button "delete". when click button "delete" need close opened form , go gridview , delete entry. i'm using templatefield gridview. <asp:gridview id="gridview1" runat="server"> <columns> <asp:templatefield showheader="false" headertext=" "> <itemtemplate> <asp:button id="btn_update" text="update" runat="server" buttontype="button" commandname="update" /> </itemtemplate> </asp:templatefield> <asp:boundfield datafield="id" headertext="id" /> <asp:boundfield datafield="firstname" headerte...

angular - Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' -

just yesterday code working fine, made no changes app module , today when using "ng build --prod" error. know it's not related changes, when pull older branches same error. don't know do, recommendation update each package, after still same error. not sure if guys can help, here's app.module: import {browsermodule} '@angular/platform-browser'; import {ngmodule} '@angular/core'; import {formsmodule} '@angular/forms'; import {httpmodule} '@angular/http'; import {appcomponent} './app.component'; import {logincomponent} './login/login.component'; import {comparecomponent} './compare/compare.component'; import {routermodule} "@angular/router"; import {comparecardcomponent} './compare/compare-card/compare-card.component'; import {layoutcomponent} './layout/layout.component'; import {comparevaluepipe} "./compare/compare-card/compare-card.pipe"; import {homecomponent} '....

javascript - How to make hovering a button changes background of a different element -

website in question what want happen when hovers 1 of 3 buttons "signature events" "weddings" "le coq d'or" background , content of div above change. div above static, it's not slider. styled html block. i've started getting js within last week or so, , seems done js switch, i'm not sure. don't know search info on this. thank you! you can use data attribute target class , little bit jquery code. $('button').hover( function() { $('header').addclass($(this).attr("data-class")).text($(this).attr("data-title")); }, function() { $('header').removeclass($(this).attr("data-class")).text($('header').attr("data-title")); } ); header{ background-image: url('http://lorempixel.com/200/600/'); background-size: cover; height: 180px; width: 500px; display: flex; justify-content: center; align-items: center...

c++ - Templating a function to deduce the return type stl-container from input arguments -

i have function objective take stl-container of specific data type , return same stl-container of different specific data type. see below: template < template <typename, typename = std::allocator<double> > class returncontainer, template <typename, typename = std::allocator<int> > class container > inline returncontainer<double> transform(const container<int>& container) { returncontainer<double> ret(container.size()); for(size_t = 0; < container.size(); ++i) { // here } return ret; } which use as: // // using vectors // std::vector<int> data_vector_in; data_vector_in.push_back(0.0); data_vector_in.push_back(1.0); std::vector<double> data_vector_out = transform<std::vector>(data_vector_in); // // using lists // std::list<int> data_list_in; data_list_in.push_back(0.0); data_list_in.push_back(1.0); std::list<double> data_list_out = transform<std::list>(data_list_in)...