Im doing some studying and im a bit confused on this little nondeterministic algorithm when it processes a 1. I understand that it will split into a brand with q1 since a 0 or 1 will redirect back, and that theres an exit arrow to q2 is there is a 1, but why would it split into q3? I feel like im misreading the (0,empty string), any clarification would be great.
The empty string means that you can take it at any time. In this case, a 1 will take it to q2 and because q2 has an empty string arrow to q3. It will also immediately take that without having to get the next bit of the input.
Related
I am really confused between Mid and Substring in VB.NET. Can anyone help me understand the difference with the help of a program? It will be really appreciated.
You can read the documentation for Mid and for Substring
The biggest difference arises from Mid being a legacy adapter function intended either to help VB6 code work if pasted into a vb.net project, or to provide VB6 programmers with some familiar functionality while they switch to using the modern .NET equivalent (Substring)
As a legacy function, Mid adopts the VB6 notions of strings being one-based indexing, rather than zero based (used by nearly everything else .NET) so anything you Mid should have a start parameter that is 1 greater than anything you Substring
Mid("Hellow World",1,5) 'returns Hello
Substring("Hellow World",0,5) 'returns Hello
Substring has a corollary, Remove, which removes chars after a certain point like Left used to. Ditching Left/Mid/Right in favour of Substring/Remove makes it easier to understand what to use/what will happen if the string passed in is in a right-to-left language
I've got the following code in place with the idea being that I need a 30 character random number generated each time the stored procedure is called and the odd thing is that in most cases it works as intended but in other seemingly random cases it will only generate a 28 character random number.
'\\xxx-servername\folder\'+
CAST(CAST((RAND()*1000000000000000000000000000000) as decimal(30))as varchar(30)) +
RAM.AccountNumber+HRMRN.PrefixMedicalRecordNumber+'ESTIMATE N00001'+
REPLACE(CONVERT(VARCHAR(12),ISNULL(HRM.Birthdate,HRM.BirthdateComputed),111),'/','')+HRM.Sex+
REPLACE(CONVERT(VARCHAR(12),GetDate(),111),'/','')+LEFT(REPLACE(CONVERT(VARCHAR(12),GetDate(),108),':',''),4)+'.PDF' as [CPFileName]
Hope maybe someone can offer some advice because I'm at a loss...
I suspect that your system is automatically removing leading zeros. You can either re-insert those zeros yourself, or else construct your number using something like:
number <- ""
number.append(randomDigit(1,9))
repeat 29 times
number.append(randomDigit(0,9))
end repeat
That guarantees that you do not get a leading zero.
I mean 2. Second Length found here
I think I found all mistakes but still, I can't seem to get the right answer.
On line 8 it should be wait1Msec(3000); instead of wait1Msec(4000);
Swing turn to the right should be written as 100 power for C and 0 power for B. I also tried -100 for B and even exchanged letters just in case I misunderstood which of the motors is left and which is right, but I still got the wrong answer (according to the website).
There are mistakes in the comments as well, but that shouldn't be a problem since they're just comments! Still, I corrected them just in case. Replaced 4 with 3 and replaced right with left, still not correct.
Do they expect me to right some specific text in the comments? Or am I missing something?
It seems that you should write the code for your second length after the comment
//END OF FIRST LENGTH
So, your code should be a code for the first length and the second length. I hope that helps.
How come I get the same results for q1 and q2? It seems that q2 is overwritten by q1. Don't understand since they reference the same element but store its value in different variables at different points of time.
There is definitely a change after I do ic.click for the second time. When I solely run the second part it gives me the correct result.
def test_relation(self):
ic = self.driver.find_element_by_xpath("//select[#id='selectNumber']/option[2]")
ic.click()
q1 = self.driver.find_elements_by_xpath("//select[#class='quarterSelect form__multiselect']/option")
print(len(q1))
ic = self.driver.find_element_by_xpath("//select[#id='selectNumber']/option[1]")
ic.click()
q2 = self.driver.find_elements_by_xpath("//select[#class='quarterSelect form__multiselect']/option")
print(len(q2))
If you are expecting ic.click() to cause something to happen, then you need to wait for that change to happen before you can look for it's result. adding in a call to WebDriverWait().until() for something will probably help you.
Also, I notice that the code is printing len(q1) and len(q2). are you sure that their length is not the same, even though they may have different items in the list?
Why does this ridiculously simple query on data.stackexchange.com return results that don't have [help/dont-ask] in the comment text? I feel like I'm missing something mind-numbingly obvious here.
select top 10 Id, PostId, Text
from comments
where text like '%[help/dont-ask]%'
Results I currently get:
Id PostId Text
-- ------- -----------------------------------
1 35314 not sure why this is getting downvoted -- it is correct! Double check it in your compiler if you don't believe him!
2 35314 Yeah, I didn't believe it until I created a console app - but good lord! Why would they give you the rope to hang yourself! I hated that about VB.NET - the OrElse and AndAlso keywords!
4 35195 I don't see an accepted answer now, I wonder how that got unaccepted. Incidentally, I would have marked an accepted answer based on the answers available at the time. Also, accepted doesn't mean Best :)
9 47239 Jonathan: Wow! Thank you for all of that, you did an amazing amount of work!
10 45651 It will help if you give some details of which database you are using as techniques vary.
12 47428 One of the things that make a url user-friendly is 'discover-ability', meaning you can take a guess at url's simply from the address bar. http://i.love.pets.com/search/cats+dogs could easily lead to http://i.love.pets.com/search/pug+puppies etc
14 47481 I agree, both CodeRush and RefactorPro are visually impressive (most of which can be turned off BTW), but for navigating and refactoring Resharper is much better in my opinion of using both products.
15 47373 Just wanted to mention that this is an excellent solution if you consider the problem to be linear (i.e. treating `A1B2` as a single number). I still think the problem is multi-dimensional, but I guess we'll just have to wait for the author to clarify :)
16 47497 Indeed, the only way to do this is get the server to generate your CSS file which can be done in many ways depending on which language you are using. HttpHandlers are common in C#. You could use jQuery or the likes to add styling to every element with the class 'ourColur' and parametrise your JS
18 47513 This advice goes against the spirit of CSS, which is separation of content and presentation. You way requires changing HTML for presentation sake, and stating in content which elements have same color.
...none of which contains the magic link (or even the text dont-ask).
Because [] delimits a set of characters to find.
You need to escape them.
Or just use CHARINDEX as the search is unsargable anyway.
WHERE CHARINDEX('[help/dont-ask]', text) > 0