Posts

Showing posts from September, 2012

reset password by sending text using ionic and angularjs -

i have existing api , end system, doing front end part (using ionic , angular create mobile app) , want achieve function reset password sending message on phone customer. i have done reset password html page allow user input his/her mobile number, , send api id of customer, don't know how send link associated changing password customer's phone. <ion-view title="resetpassword"> <ion-header-bar> <h1 class="title">reset password</h1> </ion-header-bar> <ion-content> <form name="resetpwddata" novalidate> <p> please enter mobile number associated account ! </p> <label class="item item-input"> <span class="input-label">mobile number</span> <input type="text" ng-model="resetpwddata.mobile" required> </label> </form> </ion-content> this must...

What is the ruby equivalent of #define A B in C/C++? -

is there ruby equivalent of c/c++ macro? #define somethingelse ruby projects typically have neither pre-processing nor compilation step , usage of pre-processor not common. you can define constants using capitalized variable names. however, if need pre-processor can use cpp ruby or other language - not care actual syntax.

How to handle INT overflow on limited RAM devices (any language)? -

i have task in school have answer question: "a couple of students make calendar program days "absolute daynumber" defined amount of days january 1st year 0 current day. on many smaller computers maximum value int 32767. can happen if disregard this? how can solve issue?" the question kind of confuses me. work in python , have read python automatically handles int overflows converting int long , other programming languages similar things (like example wrapping around negative number, aka 32768 becomes -32767). if programming languages didn't automatically handle overflows imagine error if number goes on 32767... right? if wanted print "absolute daynumber" (assuming on 32767 , can use int's) wouldn't able because can't store value in int. impossible. if wanted print today's date take pc bios or use unix time instead. for me seems answer question depends on want program do. teacher says no. says none of answers correct. don...

infinite loop - Python BASIC simulator -

i'm brand new programming , have been working on free python course university of waterloo. i'm stuck on section 15a , have write basic simulator. i'm working on section titled "smart simulation", i'm writing code execute basic program. part of exercise having determine if program completed successfully, or if entered infinite loop. here current code have section: def findline(prog, target): x in range(0,len(prog)): prog2 = prog[x].split() start = prog2[0] if len(prog2) > 2: end = prog2[2] if start == target: return x def execute(prog): location = 0 visited = [false] * len(prog) while true: if location==len(prog)-1: return "success" if visited[location] == true: return "infinite loop" currentline = prog[location] currentline = currentline.split() t = currentline[2] location = findline(prog, t) visited[location] = true so i've r...

Running multiple sockets at the same time in python -

i trying listen , send data several sockets @ same time. when run program en error saying: file "/library/frameworks/python.framework/versions/3.5/lib/python3.5/ssl.py", line 704, in __init__ if sock.getsockopt(sol_socket, so_type) != sock_stream: oserror: [errno 9] bad file descriptor the first socket starts correctly, once try start new 1 error. class bot: def __init__(self, host, port): self.host = host self.port = port sock = socket.socket() s = none def connect_to_server(self): self.s = ssl.wrap_socket(self.sock) self.s.connect((self.host, self.port)) above class , i'm running several instances. def run_bots(bots): bot in bots: try: threading.thread(target=bot.connect_to_server()).start() except: print(bot.host) print("error: unable start thread") bots = [] b = bot('hostname.com', 1234) b1 = bot('hostname1.com', 1234) b...

java - Spring Cloud custom Enable* annotations -

i want learn how enable* annotations work spring cloud components. for example enableeuekaclient, enableeuekaserver, , many more ... for purpose implemented monitoring components can included in applications. beans , configurations, controller read automatically , straigth forward working. but want enable whole stuff annotation enablemonitorserver, enablemonitorclient, enablemonitordashboard not automatically loaded , have specify component should loaded. i read stuff https://www.javacodegeeks.com/2015/04/spring-enable-annotation-writing-a-custom-enable-annotation.html , understand expose beans on configuration, me more bean. my example can found here https://github.com/alwasdev/spring-cloud-monitor , , repository in want implement enable* annotations. please me code examples, or better tutorials, can learn how can disable controllers, annotations, available after used enable* annotation. thank , time. greets alwasdev

azure - Authenticated REST API for a mobile app and website on ASP.NET Core -

i want build rest api, hosted on azure, built "asp.net core web application (.net framework)" template stores identities in ef. i want avoid having views etc clutters codebase. it should callable described in article (tl;dr: header authentication , post /token endpoint , controllers [authorize]) https://blogs.msdn.microsoft.com/martinkearn/2015/03/25/securing-and-securely-calling-web-api-and-authorize/ however, fail find how /token endpoint in asp.net core. i'm reading bunch of stuff on jwt, bearer, owin, ..., , basic auth bad, lost on how proceed. the api used website , mobile apps. what need , steps need take "hello world" , running? also, why seemingly 1 architecture? there isn't token endpoint in asp.net core. you can build custom middleware, explained in article: asp.net core token authentication guide or can use external package: identityserver4 aspnet.security.openidconnect.server openiddict for last, suggest artic...

python - Using Requests and lxml, get href values for rows in a table -

python 3 i having hard time iterating through rows of table. how iterate tr[1] component through number of rows in table body teamname, teamstate, teamlink xpaths? import lxml.html lxml.etree import xpath url = "http://www.maxpreps.com/rankings/basketball-winter-15-16/7/national.htm" rows_xpath = xpath('//*[@id="rankings"]/tbody) teamname_xpath = xpath('//*[@id="rankings"]/tbody/tr[1]/th/a/text()') teamstate_xpath = xpath('//*[@id="rankings"]/tbody/tr[1]/td[2]/text()') teamlink_xpath = xpath('//*[@id="rankings"]/tbody/tr[1]/th/a/@href') html = lxml.html.parse(url) row in rows_xpath(html): teamname = teamname_xpath(row) teamstate = teamstate_xpath(row) teamlink = teamlink_xpath(row) print (teamname, teamlink) i have attempted through following: from lxml import html import requests siteitem = ['http://www.maxpreps.com/rankings/basketball-winter-15-16/7/national.htm' ...

Difference between variable and data object in C language? -

i reading c primer plus , came across following lines couldn't understand- pointers? they? basically, pointer variable (or, more generally, data object)whose value memory address. just reference,i came across these lines earlier- consider assignment statement. purpose store value @ memory location. data object general term region of data storage can used hold values. c standard uses term object concept. 1 way identify object using name of variable. i tried googleing couldn't find anything.these basic terminologies confusing me please me understand these terms. in c, object takes storage. c 2011 online draft : 3. terms, definitions, , symbols ... 3.15 1 object region of data storage in execution environment, contents of can represent values an lvalue expression designates object such contents of object may read or modified (basically, expression can target of assignment lvalue). while c standard doesn't define term variable...

Importing data incrementally from RDBMS to hive/hadoop using sqoop -

i have oracle database , need import data hive table. daily import data size around 1 gb. better approach? if import each day data partition, how can updated values handled? for example, if imported today's data partition , next day there fields updated new values. using --lastmodified can values need send updated values new partition or old (already existing) partition? if send new partition, data duplicated. if want send existing partition, how can achieved? your option override entire existing partition 'insert overwrite table...'. question - how far going updating data? think of 3 approaches u can consider: decide on threshold 'fresh' data. example '14 days backwards' or '1 month backwards'. each day running job, override partitions (only ones have updated values) backwards, until threshold decided. ~1 gb day should feasible. data before decided time not guranteed 100% correct. scenario relevant if know fields ca...

php - Convert Associative Array -> Grouping by Value -

Image
i have associative array looks this: i want convert it. should grouped "product_service_category_name" , should this: $productservices = [ '' => [ 1 => 'diverses service #1', 2 => 'diverses service #2' ], 'beratung' => [ 5 => 'ernährungsberatung' ], 'massagen' => [ 3 => 'heilmassage', 4 => 'shiatsu' ] ]; please take care fact, value maybe empty. could me this? thank you! function group($array) { $group = array(); $key = 'product_service_category_name'; foreach (array_values($array) $values) { if ( empty($values[$key])) { $ptr = 'empty'; } else { $ptr = $values[$key]; } $new_key = $values['product_service_id']; $group[$ptr][$new_key] = $values['product_service_name']; } return $group; } $grouped = group($ungrouped...

javascript - Why is webpack trying to parse every file in my dependency's path? -

i have large project i've been refactoring use webpack , es6 modules. many of dependencies using commonjs or amd modules, i'm requiring them old way. for example, const pikaday = require("pikaday"); unfortunately, when run webpack --progress it looks webpack trying parse every single file in path. several warnings like, example: module parse failed: /path/to/node_modules/pikaday/index.html eventually, following error: error in ./~/pikaday/tests/methods.js module not found: error: cannot resolve module 'expect.js' in /users/myuser/web/myproject/node_modules/pikaday/tests i'm getting error tests directory in dependency, don't care parsing bundle. why webpack trying parse every file in path, , how correct behavior? for clarity, i'll post important parts of webpack.config.js file here. var webpack = require("webpack"); var path = require("path"); module.exports = { entry : { main : ...

javascript - Set context scope in Angular -

i have variables bound this in controller, , in route designation use controlleras: 'game' . allows me include them in html {{game.var}} . sometimes, bind objects want display, forces me write repeatedly {{game.object.a}} , {{game.object.b}} , {{game.object.c}} . in previous project using meteor, set data context with keyword. {{#with object}} {{a}} {{b}} {{/with}} but don't see similar feature in angular. closest i've been able make work adding attribute ng-repeat="object in [game.object]" . works, isn't semantic. causes me quick flash of second element when game.object changes, new 1 loads before first 1 erased. is there better solution problem? angular intentionally uses context scope avoid confusion between parent , child scopes. if you're not using child scopes, can skip controller syntax entirely , bind $scope in model, turns game.a , game.b a , b in view. if using child scopes, can still skip controlleras, bec...

c# - How do you guarantee sequential execution of async event handlers? -

conventional wisdom async void ok in event handlers works great in gui-driven applications (e.g. wpf). however, i've been bitten assumption when working different sort of event handlers. consider application event handler gets called result of external event, such rabbitmq message or third party integration library. presumably, event handler gets called kind of dispatcher loop. if code in event handler synchronous, - needs finish executing before event handler can fire again. if event handler async void , each call event handler fire-and-forget, , many execute in parallel. it case don't want behaviour. example, if processing messages rabbitmq queue, want process messages in order. yet, able await asynchronous calls. how can have asynchronous event handlers , yet still have them executed sequentially? update : came across blog post stephen cleary describes same problem i'm having. however, if understand correctly, suggested use of deferrals assumes have con...

c++ - Problems with MPI_Reduce -

first of all, new mpi. have program uses rectangle/midpoint rule calculate area of function equal pi. when use method involving sends , receives calculation gives value pi. however, when testing mpi_reduce achieve same thing pi 1 processor, using different numbers of processors value less pi. have code output local_sum each processor , global_sum mpi_reduce. local sums add global sum, isn't pi. can't figure out wrong. appreciated. here section of code relevant: /* add areas calculated each process */ if (my_rank == 0) { total = my_area; (source = 1; source < p; source++) { mpi_recv(&my_area, 1, mpi_double, source, tag, mpi_comm_world, &status); total = total + my_area; } } else { mpi_send(&my_area, 1, mpi_double, dest, tag, mpi_comm_world); } //*********test begin using mpi_reduce********* // print local sums on each process printf("local sum process %d - %f\n", my_rank, my_area); double g...

javascript - Owl Carousel 2 Nav on Sides -

hi i'm using owl carousel version 2 , can't find example put navigation on sides of carousel right , left chevrons or arrows. how do it? i did yesterday:) firstly make sure nav turned on in config http://www.owlcarousel.owlgraphic.com/docs/api-options.html $('#_samewidth_images').owlcarousel({ margin:10, autowidth:false, nav:true, items:4, navtext : ['<i class="fa fa-angle-left" aria-hidden="true"></i>','<i class="fa fa-angle-right" aria-hidden="true"></i>'] }) this inject controls dom, see http://www.owlcarousel.owlgraphic.com/docs/api-classes.html <div class="owl-carousel owl-theme owl-loaded"> <div class="owl-stage-outer"> <div class="owl-stage"> <div class="owl-item">...</div> <div class="owl-item">...</di...

java - Scala HashMap from an Array -

i have scala array of 2-tuples this: (("a", "2015-11-01"), ("b", "2016-11-11"), ("a", "2017-11-01"), ("b", "2013-11-11")) i want create map key maps latest date. so, in example above, result should be: map ("a" -> "2017-11-01", "b" -> "2016-11-11") i know how iteratively - scala-way (functional-way) this? first groupby key , pick latest date. arr .groupby(_._1) .map { case (k, v) => k -> v.maxby(_._2)._2 } use mapvalues make shorter arr.groupby(_._1).mapvalues(_.maxby(_._2)._2) as date (string) formatted max date latest date. need not convert date time in millis decide max date. scala repl scala> val arr = array(("a", "2015-11-01"), ("b", "2016-11-11"), ("a", "2017-11-01"), ("b", "2013-11-11")) arr: array[(string, string)] = array((a,201...

Excel formula to convert groups of columns to a single row -

Image
i struggling formula. have tried number of different calculations, cannot seem figure out. below data table what trying achieve below if source starts a1 (not row number, date value), put formulas in q1: =int((row()-1)/3)+1 r1: =indirect(address(q1,(mod((row()-1),3))*5+1)) s1: =indirect(address(q1,(mod((row()-1),3))*5+2)) t1: =indirect(address(q1,(mod((row()-1),3))*5+3)) u1: =indirect(address(q1,(mod((row()-1),3))*5+4)) then select 5 cells, , pull them down, results

wpf - Event Triggered Toast Notification UWP -

Image
idea:i automating wifi login particular network user have enter credentials poping toast notification alarm app instead of snooze or dismiss button there login or logout. issue:how trigger toast notification when user connect particular wifi network? you need use background task getting triggered system event - in case networkstatechanged trigger. here list of available triggers: systemtriggertype enum and here quick introduction how respond such system event: respond system event you can check if want show toast using windows.networking.connectivity.networkinformation.getinternetconnectionprofile() look @ question https://stackoverflow.com/a/32846558/5111904 or documentation of networkinformation class further information.

javascript - I want to create a dynamic table that features data entered by a user when the user hits submit/save (novice programmer) -

i new coding in general, , thought best way learn make app of kind, , went simple one. premise if employee has lost work pass/badge, , need temporary 1 day, receptionist/security can input employees information along assigned badge number form. form, automatically inputted table. within table, there'll checkbox validate return of pass @ end of day. i have 2 problems: first cannot data except employees name , date of birth (so contact numbers/addresses etc. aren't showing), show when hit save. second must have hit wrong key somewhere none of data (name , dob included) showing when hit save. have looked on code several times, however, said new (this being first project), , i'm not sure i'm supposed looking for. if guys offer guidance, i'd extremely grateful. ps. colours can see i'm changing when playing css - final version better (i hope!). apologies again poor standard of coding: i'm sure it's riddled obvious signs of absolute beginner... this...

java - How to open directly a directory(location) with JFileChooser? -

is there possibility open preconfigured directory directly in jfilechooser opendialog ? i tried set directory follow code: file fn = new file("c://users//me//documents//test"); openfile = new jfilechooser(); openfile.showopendialog(f); openfile.setcurrentdirectory(fn); fto = openfile.getselectedfile(); loadfile(openfile.getselectedfile()); it can go this: string startpath = "c://users//me//documents//test"; jfilechooser openfile = new jfilechooser(new file(startpath)); openfile.showopendialog(null); file filechoosen = openfile.getselectedfile(); string filename = openfile.getselectedfile().getname(); string filepathandname = openfile.getselectedfile().getpath(); //do want variables... system.out.println(filename); system.out.println(filepathandname);

qt - keyPressEvent() method doesn't work for PyQt5 / Python 3+ -

i'm newbie python. i've designed simple calculator app using "qt designer" , convert "ui" file "py" using "pyuic5". but when i've added keypressevent() method, method didn't work. , don't know why. i've tried setfocus() method overcome issue failed. can me please? please check code below: from pyqt5 import qtcore, qtgui, qtwidgets import sys class ui_mainwindow(object): def setupui(self, mainwindow): mainwindow.setminimumsize(qtcore.qsize(330, 280)) mainwindow.setmaximumsize(qtcore.qsize(330, 280)) self.centralwidget = qtwidgets.qwidget(mainwindow) self.lineedit_display = qtwidgets.qlineedit(self.centralwidget) self.lineedit_display.setgeometry(qtcore.qrect(10, 0, 311, 41)) font = qtgui.qfont() font.setpointsize(14) font.setbold(true) font.setweight(75) self.lineedit_display.setfont(font) self.lineedit_display.setma...

javascript - PrestaShop Blocklayered issue with custom input -

i add product-list.tpl input +/- buttons works until use filter blocklayered module, +/- buttons stop working. my input looks like: <input type='button' value='-' class='qtymin' field='qty' /> <input type="text" class='qtynum' name="qty" id="quantity_to_cart_{$product.id_product|intval}" value="1"/> <input type='button' value='+' class='qtypl' field='qty' /> js code is: jquery(document).ready(function(){ // button increment value $('.qtyplus').click(function(e){ // stop acting button e.preventdefault(); // field name fieldname = $(this).attr('field'); // current value var currentval = parseint($('input[name='+fieldname+']').val()); // if not undefined if (!isnan(currentval)) { // increment...

c++ - Unique id of class instance -

i have class this: class exampleclass { private: int _id; string _data; public: exampleclass(const string &str) { _data = str; } ~exampleclass() { } //and on... } how can add unique(!) integer identifier (_id) every instance of class without using global variable? use private static member int, shared among instance of class. in static int in constructor increment it, , save it's value id member; class exampleclass { private: int _id; string _data; static int counter=0; public: exampleclass(const string &str) { _data = str; id=++counter; } update: you need take consideration in copy constructor , operator= behavior want (depends on needs, new object or identical one).

osx - Cannot get GoLang oracle package -

i new golang, chances messed setup. here have : echo $gopath /users/name/documents/developer/go_workspace this 1 worked. name$ go -v golang.org/x/tools/cmd/oracle it created 2 subfolders inside go_workspace --> src, bin , pkg. then when try : go -u golang.org/x/tools/cmd/oracle package golang.org/x/tools/cmd/oracle: cannot find package "golang.org/x/tools/cmd/oracle" in of: /usr/local/go/src/golang.org/x/tools/cmd/oracle (from $goroot) /users/name/documents/developer/go_workspace/src/golang.org/x/tools/cmd/oracle (from $gopath) when enable -v see : fetching https://golang.org/x/tools/cmd/oracle?go-get=1 parsing meta tags https://golang.org/x/tools/cmd/oracle?go-get=1 (status code 200) "golang.org/x/tools/cmd/oracle": found meta tag main.metaimport{prefix:"golang.org/x/tools", vcs:"git", reporoot:"https://go.googlesource.com/tools"} @ https://golang.org/x/tools/cmd/oracle?go-get=1 "golang.org/x/tool...

javascript - What is the function constructor in Node.js? -

in browser (chrome @ least) functions instances of function settimeout instanceof function // true however in node, not settimeout instanceof function // false so settimeout 's constructor if not function ? it seems constructor function , 1 realm. if run code console.log(object.getownpropertynames(settimeout.constructor.prototype)); you array typical function.prototype methods call , apply , bind . so guess it's analogous happens in web browsers when borrow settimeout iframe: var iframe = document.createelement('iframe'); document.body.appendchild(iframe); var win = iframe.contentwindow; console.log(win.settimeout instanceof function); // false console.log(win.settimeout instanceof win.function); // true

Loop through nested json array object and sum values javascript -

i create new object orgid, name , value unique orgid. data: { "id":0, "value": "12345" "organisations" { "orgid": "1", "name": "a" } }, { "id":1, "value": "74790" "organisations" { "orgid": "1", "name": "a" } }, { "id":2, "value": "89668" "organisations" { "orgid": "2", "name": "c" } }, { "id":3, "value": "23559" "organisations" { "orgid": "3", "name": "d" } } for below example: sum of id 0 , 1 should occur, , 3rd , 4th id is. final object = [ {1, a, 94521}, {2, c, 75463}, {3, d, 56743} ]; i tried using nested loops...

pandas - How to determine column values changing in a particular direction? -

i have dataframe consisting of 1 column of periods (year , quarters) , column of productivity numbers period. task identify period where, example, have 2 consecutive quarters of productivity decline; or, similarly, 2 consecutive quarters of growth. imagine can use brute force , loop on rows looking @ several rows @ time, reading might have "shift" function -- dont understand how works. thank help 1971q1 1,137.8 1971q2 1,159.4 1971q3 1,180.3 1971q4 1,173.6 1972q1 1,163.8 1972q2 1,140.1 1972q3 1,145.8 1972q4 1,150.0 try buddy #define growth rate df['growth_rate'] = np.log(df.production) - np.log(df.production).shift(1) #a recession when there have been 2 quarters of negative growth. df['recession'] = (df['growth_rate'] < 0 ) & (df['growth_rate'].shift(1) < 0 )

Regression testing between test and dev environments for 1000s or URLs? -

i need provide assurance on changes made site 1000s of urls. what easiest way regression testing between live , dev environment following structure? e.g. www.website.com/unique_web_page.html dev.website.com/unique_web_page.html need visual regression testing , capture javascript errors in console , 404 assets. is there third party tool can recommended? saas online? assuming understand don't need of usual tools (e.g. selenium), suggest take @ jsoup . tool provides convenient api extracting , manipulating data, using best of dom, css, , jquery-like methods. this question discusses how deal status codes. as visual validations can turn galen framework. offers syntax of checking , feel of sites.

c - Adding a size_t variable to a pointer -

i want add size_t type pointer. this: void function(size_t sizea,size_t sizeb){ void *pointer; pointer=malloc(sizea); pointer=pointer+sizeb; } in hipothetic case not end in segfault, question is: can this? add type size_t pointer? , resulting address in address 'size'? can [add size_t pointer]? yes, can, provided cast void pointer other type: pointer = ((char*)pointer) + sizeb; the type of pointer determines how pointer advanced. if cast char* , each unit of sizeb corresponds 1 byte; if cast int* , each unit of sizeb corresponds many bytes takes store int on system, , on. however, must ensure sizeb scaled size of pointer cast less or equal sizea , otherwise resultant pointer invalid. if want make pointer can dereferenced , scaled sizeb must strictly less sizea .

c# - how do I get Controller data from ModelValidatorContext in ASP.NET Core -

i have custom model validator: public class myvalidationattribute : attribute, imodelvalidator { public ienumerable<modelvalidationresult> validate(modelvalidationcontext context) { ... } } let's say, purposes of validation need data controller. not expert in reflection voodoo, can some data controller: var descriptor = context.actioncontext.actiondescriptor controlleractiondescriptor; or var typeinfo = descriptor.controllertypeinfo; but if have variable in controller, say, repository of dbcontext passed via di (although doubt if important) - how can access variable validator? note : simplified use case mcve purposes. realize brittle way go , there better way validation when need do remote validation. use case different.

node.js - Converting AWS Lambda function to use promises? -

i writing simple http 'ping' function being periodically executed using aws lambda. uses 4 asynchronous functions: http.get, s3.getobject, s3.putobject, , nodemailer.sendmail. each seems have different callback model. after reading promises, spent way time trying convert following code use q promises , failed miserably. for own education , of others, hoping me convert using promises (doesn't have q): 'use strict'; var http = require('http'); var nodemailer = require('nodemailer'); var aws = require('aws-sdk'); var s3 = new aws.s3( { params: { bucket: 'my-bucket' } } ); exports.handler = (event, context, callback) => { var laststatus; var options = { host: event.server.host, port: event.server.port ? event.server.port : 80, path: event.server.path ? event.server.path : '', method: event.server.method ? event.server.method : 'head', timeout: 5000 }; var transporter = nodemailer...

highcharts - Customise Highstock tooltip conditionally -

i make tooltip in highstock styled differently(not style of content, style tooltip itself. example, different padding, shadow, border radious etc) when hovering on flag series , line serieses. however, looks these properties needs configured in tooltip configuration object. not sure if can dynamically changed. like in jsbin: http://jsbin.com/cixowuloxa/1/edit?js,output what's better way give 'summer arrives' tooltip different style other shared tooltips? your approach correct. in formatter callback wrap text in html tags , style using css, inline or class name, depending if flag or line series. make sure set usehtml true. tooltip: { usehtml:true, borderwidth: 0, headerformat: '', shared: true, formatter: function(){ if (!!this.points) { return this.points .reduce( function(prev, cur) { return prev + '<br>' + cur.series.n...

loops - Looping statistic Tests in R -

i apply t test in r within loop groups length size diet place 2.4048381 0.7474989 1.6573392 334.3273456 2.72500485 0.86392165 1.8610832 452.5593152 1.396782867 0.533330367 0.8634525 225.5998728 b 1.3888505 0.46478175 0.92406875 189.9576476 b 1.38594795 0.60068945 0.7852585 298.3744962 b 2.53491245 0.95608005 1.5788324 303.9052525 i tried code loop, not working: for (i in 2:4){ t.test(table[,c(i)] ~ table$groups, conf.level = 0.95) } can me this? thanks! your code computes 4 t-tests, results lost, because don't them. try following: info <- read.table(header=true, text="groups length size diet place 2.4048381 0.7474989 1.6573392 334.3273456 2.72500485 0.86392165 1.8610832 452.5593152 1.396782867 0.533330367 0.8634525 225.5998728 b 1.3888505 0.46478175 0.92406875 189.9576476 b 1.38594795 0.60068945 ...

android - Pass data to Fragment from Layout before it's rendered -

i need pass data fragment, declared in activity layout before rendered: <fragment android:name="com.app.fragments.myfragment" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/myfragment" /> i tried in activity's oncreate fragment rendered @ time. @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); // here fragment rendered mposts = (myfragment)getsupportfragmentmanager().findfragmentbyid(r.id.myfragment); mposts.setdata(somedata); } i've seen way when fragment created programmatically in activity oncreate , added container. it's not bad solution. but... there simpler? for xml layout there 1 question on here: https://stackoverflow.com/a/23226281/842607 even has cannot pass arguments, can use callbacks or custom attributes. else norm...