conditional-statements

Using a custom folder for “File Search” Launch Condition in VS Installer (VS 2010)

百般思念 提交于 2019-12-11 17:13:36
问题 I am trying to create a setup file for my solution in VS2010. It's a C# application. So far it does whatever I need. However, I do some Interop stuff and this setup file shouldn't be run unless some Native DLLs exist on the system. I tried using the "File Search" Launch Condition type to try and find this file before I launch the installer, but it only seems to work for the special folders it lists in the combo box in the "Folder" Property for the File Search Launch Condition. Is there any

Finding if a triangle is right-angled or not

回眸只為那壹抹淺笑 提交于 2019-12-11 17:04:15
问题 This Python 3 based function returns if a triangle is or isn't right-angled given side lengths x, y, and z. I'm having an issue simplifying the conditional statement. Should this function check for acute, right, obtuse, scalene, isosceles, and equilateral angles, or are there conditions I can skip? Any feedback is appreciated. def right_angled(x, y, z): """This function returns if a triangle is or isn't right-angled given side lengths x, y, and z.""" p = x + y + z #triangle perimeter a_sym =

Grouping variables based on conditions

落爺英雄遲暮 提交于 2019-12-11 16:55:32
问题 Grouping the following data in 64 groups. I have two variables x and y for each object. I would like to group them up based on a condition. Both x and y have a range between 0 and 2000 and I want to break them into 64 groups. The first one to have x<250 and y<250 the next one 250 Sample data: index x y 1 10 100 2 270 60 3 550 1000 4 658 1900 5 364 810 6 74 1890 ... 6000 64 71 Could you please tell me a way to do it? I have my data now as a data frame but I do not know if it the way to go. I

Multivariate Functions with Conditions in Mathematica

雨燕双飞 提交于 2019-12-11 16:52:19
问题 I'm trying to define a bivariate function that takes values depending on whether a condition is met. I make them work for univariate case but I'm stuck with the bivariate case: g[x_, y_] := 10 /; x < 10 g[x_, y_] := 20 /; (x >= 10 && y < 5) g[x_, y_] := -5 /; (x >= 10 && y >= 5); This function never gives me the value of -5. g[12,10] = 20? 回答1: This works for me: Clear[g] g[x_, y_] /; x < 10 := 10 g[x_, y_] /; x >= 10 \[And] y < 5 := 20 g[x_, y_] /; x >= 10 \[And] y >= 5 := -5 then In[73]:= g

PHP conditional statements within Wordpress's function.php file not working

ぐ巨炮叔叔 提交于 2019-12-11 16:35:28
问题 I want to do the following PHP statement within function.php : If there's an uploaded image for #header h1 a 's background, indent the text (remove)...If not (else), keep the text (don't indent it). I'm not very familiar with PHP but this is what I did: <?php // Include functions of Theme Options require_once(TEMPLATEPATH . '/functions/admin-menu.php'); // If there's an image for the site title, remove it's text function logo_exists() { ?><style type="text/css"> #header h1 a { <?php if (

Laravel give user access to specific route when conditions are met

风格不统一 提交于 2019-12-11 15:58:41
问题 Laravel 5 How to give user access to specific route when certain conditions are met? For example let user access Route::get(view('posts/{id}'),'PostsController@show'); when user has over 100 points in his user->points column. 回答1: You can use Middleware for this,In Laravel it is very easy to secure your routes by creating your own middlewares. The following steps are required to do this: run command php artisan make:middleware Middlewarename and you'll find your middleware inside app/Http

Generate all combinations with maximum difference of consecutive elements

浪尽此生 提交于 2019-12-11 15:51:44
问题 I would like to generate combinations with length 9 out of a sorted list (length 150) without any repeated values: 24, 110, 157, 256, 278, 368, 416, 502, 593, 666, 751, 801, 827, 925, 991, 1044, 1118, 1159, 1203, 1296, 1375, 1479, 1546, 1621, 1679, 1695, 1726, 1832, 1922, 1978, 1995, 2041, 2119, 2160, 2240, 2315, 2421, 2493, 2527, 2543, 2559, 2654, 2762, 2813, 2883, 2950, 2982, 3009, 3052, 3103, 3162, 3239, 3346, 3427, 3462, 3480, 3548, 3638, 3670, 3761, 3833, 3898, 3946, 3979, 4051, 4096,

Can't differentiate the two expressions supposed to work in the same way

微笑、不失礼 提交于 2019-12-11 15:50:16
问题 Few days back I created this post , to seek any solution as to how I can let my script loop in such a way so that the script will use few links to check whether my defined title (supposed to be extracted from each link) is nothing for four times. If the title is still nothing then the script will break the loop and go for another link to repeat the same. This is how I got success--► By changing fetch_data(link) to return fetch_data(link) and defining counter=0 outside while loop but inside if

Using PHP include during conditional statements

你离开我真会死。 提交于 2019-12-11 15:32:42
问题 Is it possible to use an include statement that contains conditional statements in a control structure? It's hard to explain, so here's an example: if (...) { } elseif (...) { } elseif (...) { } elseif (...) { } else { } Let's say my third elseif contained a lot of code and I wanted to put it in another file and use an include statement instead. Could I do that? When I tried to, it was giving my an "unexpected T_ELSE" error. So it would be something like this: if (...) { } elseif (...) { }

Is it possible to abbreviate this condition in Swift?

风格不统一 提交于 2019-12-11 15:26:23
问题 Is there a way to abbreviate the following type of condition in Swift? if ( (myEnum == .1 || myEnum == .2 || myEnum == .3 || myEnum == .8) && startButton.isSelected ) I tried typing: if ( (myEnum == .1 || .2 || .3 || .8) && startButton.isSelected ) and: if ( (myEnum == .1,.2,.3,.8) && startButton.isSelected ) but none of those worked. I also tried looking at documentation but can't find a similar example. Thanks! 回答1: I don't think there is a way to abbreviate it like you want but there is,