logic

Conditional choices should be either or

五迷三道 提交于 2019-12-08 12:25:08
问题 This is an example how the code exist currently : http://jsfiddle.net/rym2g/ The only thing I need it to do now is based on the choice that was made make sure that it is the only choice available... for example: who are you? jim kyle becky (you chose becky) display becky's form (you decided that you wanted to choose kyle instead of becky) hide becky's form and display kyle's form only Hope I've explained myself well enough. <form> <ul class="form-nav"> <li><a href="#a-1">AAA</a></li> <li><a

Android - Help with Calculator Logic

北慕城南 提交于 2019-12-08 11:01:52
问题 I've made a custom dialog that is a simple calculator for addition, subtraction, multiplication and division. I'm having trouble getting the logic of my code correct. Does anyone have any word of wisdom or know of resource I could check out that could help. Below is the code for my custom dialog and the calculator Logic that i'm working on. As it is all the calculations work fine except for when i use the equals button. Calculation I do after that point don't come out right. Thanks!

Subtract numbers using arrays - C++

纵然是瞬间 提交于 2019-12-08 09:30:53
问题 I want to calculate the difference between two numbers (let's say v and n , so v-n ) using arrays (don't ask why I have to do so). The arrays for each number are made in the following way: Their capacity is the number of digits of the greatest number between v and n (= q in the code) vArray[i] = i th digit of v except leading zeros to fill the whole array nArray[i] = - i th digit of n except leading zeros to fill the whole array For example, choose v = 10 and n = 2 then, vArray = [1,0] nArray

IPv6 Abbreviation(zero blocks compression) logic. I'm using c#

♀尐吖头ヾ 提交于 2019-12-08 06:44:49
问题 This is a complete un compressed IP address 2001:0008:0000:CD30:0000:0000:0000:0101 I need to compress it like this 2001:8:0:CD30::101 But i was only able to compress the zeroes in blocks like this 2001:8:0:CD30:0:0:0:101 using this code string output = ""; string a = textBox1.Text; if (a.Length != 39 ) MessageBox.Show("Invalid IP please enter the IPv6 IP in this format 6cd9:a87a:ad46:0005:ad40:0000:5698:8ab8"); else { for (int i = 0; i < a.Length; i++) { if ((a[i] >= '1' && a[i] <= '9') ||

random the link everytime the page is refresh?

别说谁变了你拦得住时间么 提交于 2019-12-08 06:07:06
问题 I'm trying to figure out how can I make one anchor tag that will everytime change when the page is refresh random from the list I have. Say I have this list <a href="http://testpage.com/">This is the first one</a> <a href="http://testpage.com/">This is the second one</a> <a href="http://testpage.com/">This is the third one</a> This is the first one This is the second one This is the third one it is like Link Unit ads that Adsense has but I just want it to do simple random not to do any kind

XOR logic in JSON schema for a list of boolean items

坚强是说给别人听的谎言 提交于 2019-12-08 05:57:48
问题 I faced a problem with validating a list of boolean values. My input is: [true,true,false] and it should not verify this because only lists with one and only one true value, should be true. At the moment my schema does a sort of inclusive OR by accepting one or more true values, but not all: { "type": "array", "items": { "$ref": "#/definitions/_items" }, "$ref": "#/definitions/xor", "definitions": { "xor": { "oneOf": [ { "$ref": "#/definitions/or" }, { "$ref": "#/definitions/and" } ] }, "

How to find TMax without using shifts

坚强是说给别人听的谎言 提交于 2019-12-08 04:43:02
问题 Using ONLY ! ~ & ^ | + How can I find out if a 32 bit number is TMax? TMax is the maximum, two's complement number. My thoughts so far have been: int isTMax(int x) { int y = 0; x = ~x; y = x + x; return !y; } That is just one of the many things I have unsuccessfully have tried but I just cant think of a property of TMax that would give me TMax back. Like adding tmax to itself would be unique compared to all the other integers. Here is the actual problem: /* * isTMax - return 1 if x is the

Create a new column by picking non-null values from 3 different columns in Tableau

旧城冷巷雨未停 提交于 2019-12-08 04:32:23
问题 I have outer-joined 3 data sources - Sales, Cost, Price details to make sure I don't miss any rows from either of data sources. A sample of my case looks as below: As per above image, after outer joining I find Cost and Price info for Brand E but there is no sale of Brand E as a reason Brand column from Sales data appears null against Brand 'E' at both Cost and Price details. I want to create a new column called 'Brand_New' where all Brand from A to D as in Sales should get populated also

joining arrays, preserving different value, pick one if same. with php

回眸只為那壹抹淺笑 提交于 2019-12-08 04:07:43
问题 lets say from zero to more is important level of the value # very imporant 0 => array 'index' => string 'helloworld:Index' (length=16) 404 => string 'helloworld:Missinga' (length=19) 503 => string 'helloworld:Offline' (length=18) 'nojs' => string 'helloworld:Nojs' (length=15) 'blog' => string 'helloworld:blog' (length=15) # important 1 => array 'index' => string 'helloworld:Index' (length=16) 404 => string 'helloworld:Missingb' (length=19) 503 => string 'helloworld:Offline' (length=18) 'nojs'

How to get all possible n-digit numbers that can be formed using given digits?

家住魔仙堡 提交于 2019-12-08 03:25:41
问题 I am coding a part of a big application where I am facing this problem. I will abstract you all from all the details by presenting a similar plain-vanilla scenario. I am given n (the no. of digits of the number to be formed at run-time). I am also given a list of numbers say {2,4,8,9}. I have to form all the possible numbers that can be formed from the above list of the given length. e.g. if n = 3 and list = {4, 5, 6} then the possible number are: 444, 445, 446, 454, 455, 456, 464, 465, 466,