Posts

Showing posts from February, 2013

R: Creating a ggplot2 barchart of timedate y-variable -

i'm having lot of trouble trying create otherwise simple ggplot barchart of timedate variable on y-axis. plots fine using geom_point or geom_line , replace geom_bar , r either crashes or returns me blank, grey graph. my raw data character strings of format: day time 1/1/2015 2:30:14 2/1/2015 15:10:40 3/1/2015 8:50:05 and knowing ggplot2 can bit picky time , date classes, format variables posixct , date follows: library(ggplot2); library(scales) datetime <- data.frame(date = c("1/1/2015", "2/1/2015", "3/1/2015"), time = c("2:30:14", "15:10:40", "8:50:05")) datetime$date <- as.date(datetime$date, format="%m/%d/%y") datetime$time <- as.posixct(datetime$time, format="%h:%m:%s") then, creating simple scatter plot of data works fine: ggplot(datetime, aes(date, time)) + geom_point() + xlab("day") + ylab("time") + scale_y

Using eexists to construct record terms in Coq -

suppose there denary relation r on type a . variable : type. variable r : -> -> -> -> -> -> -> -> -> -> prop. x , y different propositions both assert r holds on 10 terms of type a . inductive x : prop := | x_intro : forall a0 a1 a2 a3 a4 a5 a6 a7 a8 a9, r a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 -> x. record y : prop := { a0 : a; a1 : a; a2 : a; a3 : a; a4 : a; a5 : a; a6 : a; a7 : a; a8 : a; a9 : a; ry : r a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 }. since x , y assert same things, should easy prove x -> y . could, instance, explicitly constructing proof of y . theorem xy : x -> y. inversion 1. exists a0 a1 a2 a3 a4 a5 a6 a7 a8 a9. apply h0. qed. but seems unnecessary. last proposition obtained inversion on premise determines 10 terms, shouldn't have spell names out. postpone identification eexists , unify them later. theorem xy' : x -> y. intro. eexists. inversion h. apply h0. but unification fails here. goals before ap

php - MVC - Keep model consistent with DB -

i'm front-end developer trying write first back-end restful webapplication in php/mysql. what it's confusing me figure out how model works. in fe programming, wrote in angularjs, model service provides data webservice. model doesn't exists itself, services provide when calls controllers. in backend scenario have db stocks data, , there have retrieve data compose model. problem me is: data being updated continously each client talks backend, need keep model consistent db continuously changing. had use implementation similar frontend, model have being created when controllers commands interactions it, , solves problem me. but friend of mine (which skilled) told me approach wrong, , model have independent controllers. but, if db changes, how aware of , update model? i hope have being clear in backend mvc, model divided in 3 parts: domain, dao , service. domain representation of data, in case class attributes. dao class implements access database (or file

servicenow - how to read Derived field from .assignment group reference field in Service now? -

the actual value of assignment group can achieved referring assignment_group.parent.parent.not sure if can use glide records using visual studio 2010 connect web service , not able add required class gliderecord. is question reference fields in servicenow, or using visual studio servicenow? assignment group isn't derived field, it's reference field. asking how derived field off of sys_user_group table, dot-walking through assignment_group field? there isn't trick it. kind of script trying with? if it's client-side script, might running problem because can't dot-walk on client side; you'll need make glideajax (or, if performance not concern, gliderecord) query server. please more clear questions in future. cannot if can't decipher you're asking.

javascript - ReferenceError: className is not defined -

in rails app using reactjs have coffescript code looks this: dom = react.dom createnewmeetupform = react.createclass getinitialstate: -> { title: '' description: '' } titlechanged: (event) -> @setstate(title: event.target.value) descriptionchanged: (event) -> @setstate(description: event.target.value) render : -> dom.form classname: 'form-horizontal' dom.fieldset null, dom.legend null, "new meetup" dom.div classname: 'form-group' dom.label htmlfor: 'title' classname: 'col-lg-2 control-label' 'title' dom.div classname: 'col-lg-10' dom.input classname 'form-control' placeholder: 'meetup title' id: 'title' type: 'text' value: @state.titl

java - GCM Topic messaging error -

i want let application register topic messaging, each time try call topic registration returning error below java.lang.illegalargumentexception: invalid topic name: using method bellow gcmpubsub.getinstance(context).subscribe(regtoken, "/topics/testtopic", null); i using tutorial on link https://developers.google.com/cloud-messaging/topic-messaging . appreciate on error. please try sample app . "/topics/testtopic" should fine. mentioned in documentation , topic name matching regex should fine: /topics/[a-za-z0-9-_.~%]+

ios - Add code in a completion block parameter -

sorry if question has been asked. can't find keywords have answer... in completion block, possible add code before or after block variable? i this: - (void)presentviewcontroller:(uiviewcontroller *)viewcontrollertopresent animated:(bool)flag completion:(void (^)(void))completion { [super presentviewcontroller:viewcontrollertopresent animated:flag completion:^{ //some code add here completion(); }]; } i have exc_bad_access error when try this. edit: issue caused use of "completion()" without checking if nil or not. of course can add code have comment. crash caused other problem, un-initialized variable, or perhaps using local variable has gone out of scope.

symfony - Some difficulties to understand a namesapace and his use -

i haves difficulties understand namespace's use : namespace utilisateurs\utilisateursbundle\entity; use fos\userbundle\entity\user baseuser; i have found namespace called fos (in /applications/mamp/htdocs/ecommerce/vendor/friendsofsymfony/user-bundle) : namespace fos\userbundle; but don't understand \entity\user. this code of entity : <?php // src/acme/userbundle/entity/user.php namespace utilisateurs\utilisateursbundle\entity; use fos\userbundle\entity\user baseuser; use doctrine\orm\mapping orm; /** * @orm\entity * @orm\table(name="utilisateurs") */ class utilisateurs extends baseuser { /** * @orm\id * @orm\column(type="integer") * @orm\generatedvalue(strategy="auto") */ protected $id; public function __construct() { parent::__construct(); // own logic } } when understand namespace, able fix problem : fatal error: class 'fos\userbundle\entity\user' n

mysql - Error 1067 for Default of Timestamp column where there is no Default -

i'm having trouble populating schema in mysql 5.5. each table has "create_time" , "update_time" timestamps. prefer have no default these columns 1067 error referencing default value when there no default value. #1067 - invalid default value 'update_time' below portion of script generated mysql workbench. set @old_unique_checks=@@unique_checks, unique_checks=0; set @old_foreign_key_checks=@@foreign_key_checks, foreign_key_checks=0; set @old_sql_mode=@@sql_mode, sql_mode='traditional,allow_invalid_dates'; create schema if not exists `database` default character set utf8 collate utf8_general_ci ; use `database` ; create table if not exists `database`.`table` ( `id` int unsigned not null auto_increment, `create_time` timestamp not null, `update_time` timestamp not null, primary key (`id`), unique index `id_unique` (`id` asc)) engine = innodb; set sql_mode=@old_sql_mode; set foreign_key_checks=@old_foreign_key_checks; set uniqu

r - Zero-inflated negative binomial non-integer error -

i fitting zinb in winbugs using r2winbug , winbugs model code: model{ for(i in 1:n){ injections[i] ~ dnegbin(p[i],r) p[i] <- r/r+ramda[i]*(1-u[i]) u[i] ~ dbern(p0[i]) logit(p0[i]) <- alpha0 + alpha1*hiv[i] + alpha2*parteners[i] + alpha3*married[i] + alpha4*divorced[i] + alpha5*mage[i] log(ramda[i]) <- beta0 + beta1*hiv[i] + beta2*parteners[i] + beta3*married[i] + beta4*divorced[i] + beta5*mage[i] } # priors missing covariates for(i in 1:n){ parteners[i] ~ dpois(mu) hiv[i] ~ dbin(q,1) } # priors q ~ dunif(0.0,1.0) r <- exp(logalpha) logalpha ~ dnorm(0,1.0e-8) beta0 ~ dnorm(0,1.0e-8); beta1 ~ dnorm(0,1.0e-8) beta2 ~ dnorm(0,1.0e-8); beta3 ~ dnorm(0,1.0e-8) beta4 ~ dnorm(0,1.0e-8); beta5 ~ dnorm(0,1.0e-8) alpha0 ~ dnorm(0,1.0e-8); alpha1 ~ dnorm(0,1.0e-8); alpha2 ~ dnorm(0,1.0e-8) alpha3 ~ dnorm(0,1.0e-8); alpha4 ~ dnorm(0,1.0e-8); alpha5 ~ dnorm(0,1.0e-8) mu ~ dgam

android - TextView.setText disables CheckBox's default animation -

i have gridview checkboxes , every time user clicks checkbox call textview.settext() , somehow calling settext() disables default animation android gives check boxes. why happen? edit: my listener: checkbox.setoncheckedchangelistener(new compoundbutton.oncheckedchangelistener() { @override public void oncheckedchanged(compoundbutton buttonview, boolean ischecked) { if (ischecked) { checkedpositions.add(position + 1); } else { checkedpositions.remove(new integer(position + 1)); } //removing line brings animation textview.settext("some text"); } });

Grails unit testing service with spock mocking functionality -

presently trying test grails service ( experience geb functional testing ) trying mock necessary required data service need (e.g. user,etc.) ... no matter how seem declare/initialize domains of interest all appear null in tests methods i'm trying set required information once, can reused through test methods. @testfor(reminderservice) @mock([reminder, user, subscriptions, organisation, userorganisation, organisationrole, ref, role, title]) class reminderservicetests extends specification { @shared user, org, userorg, roleuser, sub, orgrole, ti, refvals, reminder def mailservice def setup() { def refsubstatus = new ref(value: 'current').save() def refsubpublic = new ref(value: 'no').save() def refsubtype = new ref(value: 'subscription taken').save() def refremunit = new ref(value: 'month').save() def reforgrole = new ref(value: 'subscriber').save() def refremmethod = new ref(value: 'email

android - Scale a layout to match parent with animation -

in sample project have linear layout, height set wrap content in xml , there fragment below takes remaining space. fragment contains button when clicked remove fragment , height of linear layout set match parent. tried adding android:animatelayoutchanges="true" transition wrap_content match_parent not smooth. how can animate android:layout_height="wrap_content" android:layout_height="match_parent" here layout <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/bg" android:orientation="vertical" android:id="@+id/layoutroot" tools:context=".mainactivity"> <linearlayout android:layout_width="match_parent" a

Powershell WMIObject Error Handling -

i have code connects remote servers. need write text-file if connection server cannot made. i've done code: try { $w3wpresult = (get-wmiobject win32_process -filter "name 'w3wp%'" -computername $server | select name, @{l= "private memory (gb)"; e={$_.privatepagecount / 1gb}}) $vmresult = (get-wmiobject win32_process -filter "name 'w3wp%'" -computername $server | select name, @{l= "virtual memory (gb)"; e={$_.virtualsize / 1gb}}) $vmmemory += $server + " @ " + $time + ": " + (($vmresult|%{"$_"})-join',') + "`r`n" $w3wpmemory += $server + " @ " + $time + ":" + (($w3wpresult|%{"$_"})-join',') + "`r`n" } catch [system.runtime.interopservices.comexception] { if($_.exception.errorcode -eq 0x800706ba) { $errormessage = "unable connect server"

.htaccess - Redirect sub directory to diff domain using same subdirectory -

there many posts on issue, couldn't find answer. when tried change htaccess caused problems. www.xyz.com points www.xyz.com/mysite works great , user sees www.xyz.com unfortunately if types www.xyz.com/mysite same site, see www.xyz.com/mysite ideally when type www.xyz.com/mysite show www.xyz.com. thank help you can use redirect rule inside /mysite/.htaccess : rewriteengine on rewritecond %{the_request} /mysite [nc] rewriterule ^ / [l,r=302,ne]

php - How do I make an element appear after form submission? -

i have simple, working form , i'd make html element appear after form has been sent , page has reloaded. what have far: <?php $firstname = $_post['firstname']; $lastname = $_post['lastname']; $email = $_post['email']; $company = $_post['company']; $phone = $_post['phone']; $message = $_post['message']; $formcontent=" first name: $firstname \n last name: $lastname \n phone: $phone \n company: $company \n message: $message"; $recipient = "someone@example.com"; $subject = "client webform"; $mailheader = "from: $email \r\n"; mail($recipient, $subject, $formcontent, $mailheader) or die("error!"); $result= '<p>thanks!</p>' ?> the form's action set same php file. reloads same page. and below submit button have echo of result: <?php echo $result; ?> currently $result displayed on webpage loads, need appear when form sent , page reloads. a

asp.net - C# - Identity Framework and integer UserId - await SignInAsync issue -

i working on mvc5 demo app , attempting make of identity framework, in conjunction dapper within this. i have implemented n-tier hybrid architecture many layers including dal handled dapper (with repository pattern). using standard microsoft.aspnet.identity both owin , core assemblies correctly referenced authentication - read on rolling own not advisable! i digress, problem having following method within identity implementation... passwordsigninasync() for example, within accountcontoller.cs have following: // post: /account/login [httppost] [allowanonymous] [validateantiforgerytoken] public async task<actionresult> login(loginviewmodel model, string returnurl) { // doesn't count login failures towards account lockout // enable password failures trigger account lockout, change shouldlockout: true var result = await signinmanager.passwordsigninasync(model.username, model.password, model.rememberme, shouldlockout: f

jaxb2 - JAXB XmlAdapter via bindings file -

consider xsd: <xsd:schema targetnamespace="http://foobar" xmlns:tns="http://foobar" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <xsd:complextype name="idattribute"> <xsd:attribute name="id" type="xsd:token" /> </xsd:complextype> <xsd:complextype name="foobartype"> <xsd:sequence> <xsd:element name="someids" type="tns:idattribute" maxoccurs="unbounded" /> </xsd:sequence> </xsd:complextype> <xsd:element name="foobar" type="tns:foobartype" /> </xsd:schema> which results in following, generated java class: @xmlaccessortype(xmlaccesstype.field) @xmltype(name = "foobartype", proporder = {"someids"}) public class foobartype { @xmlelement(required = true) protected list<idattribute> someids; // ...

javascript - changing plus sign to minus when collapsed while keeping link -

i'm pretty new jquery, admit don't know i'm doing. top menu item text , not it's own link, has dropdown. i'm trying add plus , minus sign before text toggles while keeping original content clickable. html <div class="menu-clinical-materials"> <ul> <li class="menu-item-has-children"><a>clinical studies &amp; articles</a> <ul class="sub-menu" style="display: none;"> <li><a target="_blank" href="">link 1</a></li> <li><a target="_blank" href="">link 2</a></li> <li><a target="_blank" href="">link 3</a></li> <li><a target="_blank" href="">link 4</a></li> <li><a target="_blank" href="">link 5</a>

android - textSize in Radio Buttons doesn't follow defined style -

Image
in layout there 2 styles defined 2 different elements: headline (upper) , radio buttons. both should have textsize of 30sp in sw600dp , wider layouts; how looks in styles: <item name="android:textsize">30sp</item> . in meantime, like: how can make radio button text become bigger? edit: adding styles & code of both elements. 1a. headline code: <textview android:id="@+id/question" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginright="10dp" android:layout_marginend="10dp" android:text="@string/q1_question" style="@style/headlinetextview"/> 1b. headline style: -- parent: <style name="textviewparent"> <item name="android:typeface">sans</item> <item name="andr

ruby - How do I extract from this JSON? -

i'm trying extract data json, when type [0], returns '{' & if type ["tweets0"], nothing. missing obvious? i'm using ruby & multijson gem, if changes anything. { "tweets0": [ { "content": "test1", "time": "2015/08/16 7:43 pm" } ], "tweets1": [ { "content": "test2", "time": "2015/08/16 7:44 pm" } ], "tweets2": [ { "content": "test3", "time": "2015/08/16 7:44 pm" } ], "tweets3": [ { "content": "test3", "time": "2015/08/16 7:46 pm" } ], "tweets4": [ { "content": "test", "time": "2015/

Rails: parameter missing in update action -

here's error message: actioncontroller::parametermissing in userscontroller#update param missing or value empty: user full error log actioncontroller::parametermissing (param missing or value empty: user): app/controllers/users_controller.rb:36:in `update_user_params' app/controllers/users_controller.rb:15:in `update' the error highlights line: def update_user_params params.require(:user).permit(:role) end the parameters on error these: {"utf8"=>"✓", "_method"=>"put", "authenticity_token"=>"nvso53f3pfihoxdthmfcaxgtidaewnxppsgtnzkp/zc=", "admin"=>{"role"=>"user"}, "commit"=>"make user", "id"=>"2"} here's form i'm using: show.html.erb <tr id="dashfield"> <td><%= @user.first_name%></td> <td><%= @user.last_name %></td>

android - Custom widget does not fill available space in width -

created custom widget textview. created custom component works fine when declared through xml. when try add layout dynamically through code , not fill available width. can 1 me how make occupy full width. my xml layout below : <scrollview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <linearlayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/llayout" > in activity file , try add custom widget linear layout below : string yourtext = "lorem ipsum dolor sit amet, consectetur adipiscing elit. " + "ut volutpat interdum interdum. nulla laoreet lacus diam, vitae " + "sodales sapien commodo faucibus.

ruby on rails - ng-boilerplate LESS files are not compiling to the CSS file in build directory -

the css (from less) not rendering or compiling in ng-boilerplate app. i'm creating app using ng-boilerplate , rails using these tutorials here , , we've integrated working rails server angular. angular working on page... in, can use: $scope.animal = "dogs" and <div> {{animal}}! </div> to get i dogs! however, less , css (which copied , pasted functional ng-boilerplate app without rails worked , compiled different directories fine) not compiling build directory nor rendering. in fact, in new app (the 1 rails), not original css/less ng-boilerplate template compile or render. we tried using following commands, tutorial suggested, created weird nested build directories (a build inside build inside build) , didn't fix problem. cd public ln -s ../build ui meanwhile, ui folder linked build folder using symlink but... the less (from different files in different directories) supposed compile 1 css file called ng-boilerplate.css (which d

windows - Python 3 nltk.data.load error -

i'm trying load english.pickle sentence tokenization. windows 7, python 3.4 file followed path exists(tokenizers/punkt/py3/english.pickle). here code: import nltk.data tokenizer = nltk.data.load('tokenizers/punkt/py3/english.pickle') here error: oserror: no such file or directory: 'c:\\python\\nltk_data\\tokenizers\\punkt\\py3\\py3\\english.pickle' how fix? the problem \\py3 doubled in path. nltk.data.load() method adds /py3 path if called python 3. so should work if load tokenizer (removing /py3 string): import nltk tokenizer = nltk.data.load('tokenizers/punkt/english.pickle') nltk allow possibility of programs run python 2 , 3.

java - How to put a limit on the amount of objects in an ArrayList -

i'm doing revision o.o.p. exam coming next week , i'm stuck on question. question give example of bi-directional association between dog , flea. far i've got dog fleas. part i'm stuck on is, "modify dog class dog object can hold 5 flea objects max (print "your dog has many fleas!" if there's more 5 fleas). here's code far: dog.java import java.util.arraylist; public class dog { private string name; private int age; private string address; arraylist<flea> fleas = new arraylist<flea>(); { if(fleas.size() > 5) { system.out.println("this dog has many fleas!"); } } public string getname() { return name; } public void setname(string name) { this.name = name; } public int getage() { return age; } public void setage(int age) { this.age = age; } public string getaddress() { return address;

css3 - How to FadeIn a parent element and then it's child elements with a slight Delay (CSS Only) -

i want fadein body element , fadein 1 of it's child slight delay. i've tried it's not working body { animation: fadein 0.5s; } header { animation: fadein 2s; } @keyframes fadein { { opacity: 0; } { opacity: 1; } } i've tried using animation-delay didn't help. body { animation: fadein 0.5s forwards; /* use forwards maintain last keyframe state */ } header { opacity:0; /* need initial opacity */ animation: fadein 2s 1s forwards; /* 1s delay */ } @keyframes fadein { { opacity: 0; } { opacity: 1; } } p.s: not sure if body best parent option, here's example uses div parent: html, body{height:100%;} #page { height:100%; background:green; animation: fadein 0.5s forwards; } header { opacity:0; animation: fadein 2s 1s forwards; } @keyframes fadein { { opacity: 0; } { opacity: 1; } } <div id="page"> <header>this header</header> </d

Separating JavaScript from HTML doesn't work -

i trying separate javascript html, doesn't seem want work. here combined code: <script type="text/javascript"> var width = 100; var height = 200; function ball(){ // random radius this.radius = math.floor(math.random()*(10-5+1))+5; // random x , y this.x = math.floor(math.random()*(width-this.radius+1))+this.radius; this.y = math.floor(math.random()*(width-this.radius+1))+this.radius; // random direction, +1 or -1 this.dx = math.floor(math.random()*2) * 2 - 1; this.dy = math.floor(math.random()*2) * 2 - 1; //random colour, r, g or b var rcol = math.floor(math.random()*3); this.col = rcol==0 ? "red" : rcol==1 ? "blue" : "green"; } // create array of balls numballs = 10; var balls = new array(numballs); for(i= 0 ; < numballs ; i++){ balls[i] = new ball(); } // draw balls on canvas function draw(){ var canvas = document.getelementbyid("mycanvas"); /

asp.net mvc - How can I force itextsharp ITextHandler.Parse to use UTF-8? -

i have code rendering pdf on asp.net mvc server, characters example e accent (Ä›) not shown correctly. library use itextsharp-lgpl nuget. the pdf rendering code is: protected actionresult viewpdf(object model) { // http://www.codeproject.com/articles/66948/rendering-pdf-views-in-asp-mvc-using-itextsharp // create itextsharp document. document doc = new document(); // set document write memory. memorystream memstream = new memorystream(); pdfwriter writer = pdfwriter.getinstance(doc, memstream); writer.closestream = false; doc.open(); // render view xml string, parse string xml dom. string xmltext = this.renderactionresulttostring(this.view(model)); xmldocument xmldoc = new xmldocument(); xmldoc.innerxml = xmltext.trim(); // parse xml itextsharp document. itexthandler texthandler = new itexthandler(doc); texthandler.parse(xmldoc); // close , resulted binary data. doc.close(); byte[] buf = new byte[memstre

ios - 'warning: directory not found for option' error on build -

all of sudden app has started giving me error when try build it. error i'm getting: ld: warning: directory not found option '-l/users/user/documents/developer/alton-towers-times/build/debug-iphoneos' ld: file small (length=0) file '/users/user/library/developer/xcode/deriveddata/mouse_times_florida-eqhrhnbxmmkxtahdghmnvehbzbgt/build/intermediates/mouse times florida.build/debug-iphonesimulator/mouse times florida watchkit extension.build/objects-normal/x86_64/secondinterfacecontroller.o' architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation) only thing i've done since last managed run changing bundle ids , changed app name. i've tried few things including deleting derived data, nothing seems have helped. anyone have ideas? i solved warning removing following setting: "$(sdkroot)/developer/library/frameworks" this options located in settings -> build settings -> search paths -&g

Html select input select all options at once with JavaScript -

i have code <!doctype html> <html> <body> <select multiple> <option value="volvo">volvo</option> <option value="saab">saab</option> <option value="opel">opel</option> <option value="audi">audi</option> </select> </body> </html> i want select option @ once javascript i've tried google , did not found here 1 way it: function selectall() { options = document.getelementsbytagname("option"); for ( i=0; i<options.length; i++) { options[i].selected = "true"; } } <!doctype html> <html> <head> </head> <body> <select multiple> <option value="volvo">volvo</option> <option value="saab">saab</option> <option value="opel"

Python Selenium Firefox on Ubuntu: New Tabs Not Working -

i'm doing remote web crawling , scraping, , hoping not reload new browser window every link on 1 page. the problem new tabs not opening firefox web driver. here's i've tried: from selenium import webdriver selenium.webdriver.common.keys import keys selenium.webdriver.common.action_chains import actionchains pyvirtualdisplay import display # launch our headless display display = display(visible=0, size=(800, 600)) display.start() # launch our web driver , page browser = webdriver.firefox() browser.get("http://www.google.com/") # try open new tab actionchains(browser).key_down(keys.control).send_keys("t").key_up(keys.control).perform() # should print 2, prints 1, because new tab not opened print len(browser.window_handles) # clean browser.quit() display.stop() specifications: ubuntu 14.04.2 python 2.7.6 selenium 2.47.1 pyvirtualdisplay 0.1.3 based on this response selenium developer , new tabs in firefox not supported of a

python 2.7 - Subtract value in one data frame from the next value in a second data frame -

i have data frame composed of several datasets (about 146 , counting). 2 of columns labeled "start_time" , "stop_time," represent start , stop of response (i.e., total duration of response). need "inter-response time" or start_time subtracted next corresponding value in start_time. if: start_time = [1,4,7] stop_time = [2,5,8] i need: stop_time[0] - start_time[1] stop_time[2] - start_time[3] in order get: iri = [2,2] my code looks this: iri_t = [] def grps(): grp in lset2_name_grps.groups: beg_eng_t = pd.dataframe([lset2_name_grps.stop_time, lset2_name_grps.start_time], columns=['end_t','beg_t']) end_t = [i in lset2_name_grps.stop_time] beg_t = [i in lset2_name_grps.start_time] beg_t = np.insert(beg_t, len(beg_t),0) end_t = np.insert(end_t, 0,0) iri_t.append(np.subtract(end_t, beg_t)) # i,j in zip(end_t, beg_t): # iri_t.append(np.subtract(i,j))

php - How can I send data from one page to another using Laravel? -

so i'm using laravel 5.1 , i'm stuck in weird situation. i have 2 models season and tournament , lets url add season model ..../seasons/add , view season ..../seasons/(id) ... standard stuff right? but want add tournament link ..../seasons/1 , click link takes me ..../tournaments/add ... how can send season model page without submitting form hidden input? currently have setup ..../seasons/1/tournaments/add using blade generate links. method doesn't feel right.... thanks. how can send data 1 page using laravel? : suggest controller. take @ redirecting flashed session data , might come in handy. from flash data documentation: "[...] available during subsequent http request, , deleted [...]" you can send model, static values or whatever want using ->with: redirect('route')->with('key', 'value');

listview - Android how to append new data to a Custom base adapter -

i have custom base adapter extracts new data database on button click, works old data discarded , keep , append new data it. looking on example how append latest data custom base adapter list view in android? , seems incomplete, instance how can append new data old 1 without creating new object. this area of code struggling with @override protected void onpostexecute(string s) { super.onpostexecute(s); customview cv; try { listview lv = (listview) m.findviewbyid(r.id.mylistview); jsonobject jsonn = new jsonobject(result); jsonarray jarray = jsonn.getjsonarray("myarray"); jsonobject jobject = null; jsonarray sss = new jsonarray(); (int = 0; < jarray.length(); i++) { jobject = jarray.getjsonobject(i); jobject.getstring("message"); sss.put(jobject); } jsonn.put("myarray", sss

javascript - Javacript - 'appendChild' on 'Node': parameter 1 is not of type 'Node' -

i can't solve (learning js), there other threads none helped me. according ' mozilla ': adding node, simple: // create new paragraph element, , append end of document body var p = document.createelement("p"); document.body.appendchild(p); however, when that, get: "... parameter 1 not of type node" js code: (function () { var mynode = document.queryselector('#shiny-pics .pixgrid ul'); mynode.addeventlistener("click", function(e) { if (e.target.tagname === 'img') { var myoverlay = document.createelement('div'); myoverlay.id = 'overlay'; document.body.appendchild('myoverlay'); /*console.log(typeof(myoverlay));*/ /*console.log(myoverlay.prototype.tostring());*/ } }, false); //image clicked })(); i've tried see type of var 'myoverlay' (with typeof ) , says ob

ios - Scroll View and View Hierarchies in Swift -

i have uiimageview in custom cell in uitableview. want have uiscrollview can display multiple photos horizontally within custom table cell. what's correct way approach problem? multiple uiimageviews go on top of scroll view? i'm using storyboards happy programmatically if easier. if you're talking scroll view being horizontal, go it! however, i'd avoid having nested vertical scroll views - creates confusing ux user in experience. you can read here https://developer.apple.com/library/ios/documentation/windowsviews/conceptual/uiscrollview_pg/nestedscrollviews/nestedscrollviews.html with regards how achieve this: create custom subclass of uitableviewcell , , set view how want. include tableview . need make controller custom cell, , have inherit protocols required tableview

ruby - Setting the filename for a pdf using prawn-rails in rails 4.0 doesn't work in IE11 -

i'm using prawn-rails gem generate pdf , setting filename overwriting @filename variable in controller eg: respond_to |format| format.pdf @filename = "newreportname.pdf" render 'report' end end i using following view generate pdf: data_rows = [@report.fields.map{|f| f.titleize }] @report.results.each |result| data_rows << @report.fields.map{|k| result.send(k) } end prawn_document() |pdf| pdf.table(data_rows) end the pdf generation works in browsers i've tested when go save pdf in ie11, sets filename action name instead of name specified in @filename variable. i've posted comment on git repo prawn-rails gem i'm wondering if here help. in advance. you can set file name using prawnto format.pdf @filename = "newreportname.pdf" prawnto :filename=>@filename end

CSS Pseudo element syntax -

this vanity question, you've been warned! i've never been fan of partial definitions such as .flexaround1 { display:flex; justify-content:space-around; align-items:center; } .flexaround1::before { content:""; } .flexaround1::after { content:""; } today, "but if!?!?" , tried this: .flexaround1 { display:flex; justify-content:space-around; align-items:center; } ::before { content:""; } ::after { content:""; } and whaddayaknow, works. thing though, i've never seen written in of tutorials or reference sites. proper css syntax or kind of unofficial somehow supported feature? from mdn a css pseudo-class keyword added selectors specifies special state of element selected. a pseudo class keyword added selectors. mdn goes on give syntax, defining as selector:pseudo-class { property: value; } so appears leaving out selector isn't valid css (and kind

conditionalPanel Display but condition is not met - R Shiny -

i have started ui using shiny r, having problem layout of page. the problem facing second conditionalpanel showing though not selected. put selected='item1' in radiobuttons, checkboxgroupinput of item2 showing well. what problem here , how go around fixing it? there error or mistake in code? library("shiny") shinyui(navbarpage("title", tabpanel("subtitle1", sidebarlayout( sidebarpanel( checkboxgroupinput("variable1","items:", c("item1","item2"))), mainpanel( plotoutput("plot") ) ) ), tabpanel("subtitle2", sidebarlayout( sidebarpanel( radiobuttons( inputid="item", label="item selection:", choices=list( "item1","item2"), selected='item1'