conditional-statements

Add value from previous row under conditions

会有一股神秘感。 提交于 2019-12-12 03:32:33
问题 I have a df data and I would like to add to a new column a value that exist in a previous column and row if the factor is the same. Here is a sample: data <- structure(list(Id = c("a", "b", "b", "b", "a", "a", "b", "b", "a", "a"), duration.minutes = c(NA, 139L, 535L, 150L, NA, NA, 145L, 545L, 144L, NA), event = structure(c(1L, 4L, 3L, 4L, 2L, 1L, 4L, 3L, 4L, 2L), .Label = c("enter", "exit", "stop", "trip" ), class = "factor")), .Names = c("Id", "duration.minutes", "event" ), class = "data

Sum cell range filtered by merged value?

风流意气都作罢 提交于 2019-12-12 01:58:48
问题 I have a bowling result sheet in usual format, where each series contains one row for the actual scores and below that the accumulated score so far, incrementing to the right. For each bowling session I have the date and the name of the bowling hall, and for each series the series number. Example showing two bowling sessions (with identical scores because I'm lazy): | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | 1| Date | Hall |Series

PHP - conditional statement not working properly

≡放荡痞女 提交于 2019-12-12 01:56:57
问题 I'm working in PHP and JSON at API for my mobile application. I tried to write a registration module, but a part of my conditional statements don't work as expected. If statement 1 : if(!isset($_GET['username']) || !isset($_GET['password']) || !isset($_GET['imei']) || !isset($_GET['imie']) || !isset($_GET['nazwisko']) || !isset($_GET['email']) || !isset($_GET['zgoda']) || !isset($_GET['telefon']) || !isset($_GET['zgoda2']) || !isset($_GET['kraj'])); { $returning = array('error' => 'Invalid

Excel: conditional formatting, check if column contains text from other sheet

最后都变了- 提交于 2019-12-12 01:46:33
问题 First sheet: First name Last name Role Valeria Bianchi Admin Evelise Verdi Teacher Daniele Rossi Teacher Annamaria Neri Admim Anna Gialli Manager Anna Bella Proietti Teacher Simona Ciaociao Manager Elisabetta Lilla Admin Second sheet: Email Name a@mail.com Valeria Bianchi b@mail.com Daniele Rossi c@mail.com Annamaria Neri d@mail.com Anna Gialli e@mail.com Simona Ciaociao f@mail.com Elisabetta Lilla Now I have a rule for conditional formatting that colors the rows in the first sheet if Role is

replace string on condition - php

拟墨画扇 提交于 2019-12-12 00:49:01
问题 i am facing an issue here , trying to replace string with another under a condition. check the example : $data = ' tony is playing with toys. tony is playing with "those toys that are not his" '; so i want to replace toys with cards . but only which is NOT in ques ( " ). i know how to replace all words that are toys . $data = str_replace("toys", "cards",$data); but i don't know how to add a condition which specifies to replace only the one's which are not in the ( " ). can anyone help please

How do I restrict query results based on sub-results in CakePHP?

ε祈祈猫儿з 提交于 2019-12-11 20:18:50
问题 In CakePHP if I run the following find command $this->Instructor->find('all'); the following is returned: Array ( [0] => Array ( [Instructor] => Array ( [id] => 1 [user_id] => 3 [bio] => A billionaire playboy, industrialist and ingenious engineer, Tony Stark suffers a severe chest injury during a kidnapping in which his captors attempt to force him to build a weapon of mass destruction. He instead creates a powered suit of armor to save his life and escape captivity. He later uses the suit to

C++, Adding conditions in class vars

£可爱£侵袭症+ 提交于 2019-12-11 20:12:40
问题 The title may not be right because I can't find an appropriate words for it. I want to add conditions to some object (instance created by class). In obj.h: (excluding preprocessor commands) class obj { public: void addCondition( bool cond ); void useCondition(); private: bool conditions; }; In obj.cpp: (excluding preprocessor commands) void obj::addCondition( bool cond ) { //What to write here, is the question in short!!! } void obj::useCondition() { if(conditions) { //Do something... } }

Join with multiple conditions

馋奶兔 提交于 2019-12-11 19:19:04
问题 my entire query is a bit complex so I'll try to just show what you need to understand my problem, I'm fetching tickets from a data base, it displays the title, the creator, the people in charge of the ticket, and the last updater, for the creator and the people in charge I find their ID in tickets_users.users_id and their type 1 or 2 depending if they are the creator of the ticket or if they are in charge, for the title and all the informations of the ticket itself the table is named tickets

Search text in page (jQuery) - What to do if no match

狂风中的少年 提交于 2019-12-11 18:53:12
问题 I have this great function that works like a charm. The script highlights the words in the content as long as it matches. However, I can seem to find the right code to display an error if no result matches the query. This is the HTML: <div id="search"> <input type="text" id="searchtxt" /> <input type="button" value="Find" onClick="replaceText();" id="search-resultButton" /> </div> <p>Copy goes here</p> And this is the function: function replaceText() { $("body").find(".search-result")

SQL: conditional statement in GROUP BY clause

爱⌒轻易说出口 提交于 2019-12-11 18:04:44
问题 I would like the below case statement to change the resultset when the variable @SubjectName is changed between 'English', 'Mathematics' and any other subject eg science. When the variable is 'English' the column in students called Ks2en should be included in the results set, but when 'Mathematics' is selected the column changes to Ks2ma and when it is anything else Ks2av should be selected. Where there are any blank values ('') in the results set they are replaced with 'No KS2'. Here is what