Ambiguous behavior of the while () cycle in c

Since the while cycle ends its execution by false expression, despite the following they are giving different outputs. Unable to track

int main()
    //code snippet 1
    return 0;

this gives way



    int main()
        //code snippet 2
        return 0;

this gives way


Since the printf () function returns the number of characters printed and no character is printed, therefore, it should not result in an infinite loop since 0 has the false logical value.

What is the name of the UX pattern to show an ambiguous count of likes, votes, etc.?

While browsing several social media platforms, I find this vote button in favor, which shows an ambiguous count of the things mentioned above.

Is there a name for such a pattern?

enter the description of the image here

Ambiguous grammar demonstration exercise

Hi, I'm stuck in an ambiguous grammar exercise. I need an example that shows that this grammar is ambiguous.

S -> aT | bR

R -> a | aS | bRR

T -> b | bS | ATT

Thank you!

How to show timestamps that are not ambiguous?

issue: I need to name the log files in such a way that the file name is not ambiguous.

My initial solution was to move from the largest to the smallest unit with zero padding in each unit …


In the previous example, you could assume that everything is filled with zeros and a 24-hour clock, so the record was recorded on …

2019-12-05 13: 57: 04.0042

Adding some characters could make the file name even more readable in this way …


Ambiguity arises when the hours are less than 13


One could also assume that the record was written "super early on Valentine's day" or "Around lunchtime on Valentine's Day"

Is there any way to name the log file, so it is impossible to assume the wrong timestamp?

(The shorter the name of the file, the better, but you can assume that there is no limit to the length of the file name)

All I can think about is this, but maybe someone else has a more concise solution …


no context: does the following grammar have an inherently ambiguous language?

The grammar is as follows:

$ S rightarrow aaAb | aab | To $

$ A rightarrow aaAb | aAb | epsilon $

I think this grammar has an unequivocal equivalent grammar as follows.

First let's rewrite the grammar in the following way, so that this grammar has the same language as one in question:

$ S rightarrow aaSb | aSb | epsilon $

Because this grammar generates $ L = {a ^ nb ^ m: m le n le 2m } $

This grammar only uses two productions in some order to derive strings and then uses null production to complete the derivation.

So, the idea is that we can order the use of production in such a way that any use of $ S rightarrow aaSb $ Production does not arrive before the use of any production $ S rightarrow aSb $. And following this idea, it is very easy to generate this grammar.

$ S rightarrow aSb | To $

$ A rightarrow aaAb | epsilon $


Another argument is as follows:

Why $ 2k_1 + k_2 = n $ Y $ k_1 + k_2 = m $ for some $ not negative spatial integer space k_1, k_2 $. (here $ k_1 $ Y $ k_2 $ corresponds to the production usage number of form $ S rightarrow aSb $ Y $ S rightarrow aaSb $ respectively.)

After solving the previous equations, we find that $ k_1 = m-n $ hence the value of $ k_1 $ It will be unique for any perticular chain. Which means we must use a fixed number of times the production of the form $ S rightarrow aSb $. Which consequently means that in our last rewritten grammar there is a fixed point for a perticular chain where you must perform $ S rightarrow A $.

Please help me with this. I want to know if this language is inherently ambiguous or not?

Algorithms: Count compound words with ambiguous decomposition

I have a set of words $ D $, and I make compound words concatenating a fixed number $ n $ of words from $ D $ (Repeats are allowed). Let's call those words $ n $-composites. I want to know how many different compound words can be formed and how many $ n $-composites can be formed in $ to $ forms for each value of $ to $. For example, yes $ D $ is {hell, hello, open, pen} Y $ n = $ 2, the compound word hellopen can be formed as hell + open or hello + pen, so there are 16 different pairs of words in $ D $, but only 15 different words of 2 compounds on $ D $.

Formally, leave $ mathscr A $ be a finite size alphabet $ ge 2 $, $ D $ a finite set of words in length $ ge 2 $ finished $ mathscr A $Y $ n ge 2 $ an integer The set of valid $ n $compound word is $ C = {u_1 ldots u_n mid (u_1, ldots, u_n) in D ^ n } $. Let's call ambiguity of a word $ w $ The number of $ n $-tuples $ (u_1, ldots, u_n) in D ^ n $ such that $ u_1 ldots u_n = w $. (So, an ambiguity of 0 means that the word is not in $ C $, an ambiguity of 1 means that the word can be broken down uniquely, and larger ambiguities mean words that can be formed in multiple ways).

I would like to calculate the number of different compound words, that is, the size of $ C $. I am also interested in the amount of words with ambiguity. $ to $ for every value of $ to $, and especially the number of unambiguous compounds ($ a = $ 1) Obviously, this can be done by listing all $ | D | ^ n $ combinations and store its multiplicity in a multi-set structure, but that has a huge cost of memory and time. Is there a better way? I have the feeling that it would help build a set of prefixes and suffixes, but I can't understand how to chain them.

If the exact calculation is not practical, you would be satisfied with an estimate. How can I test my dictionary for a reliable estimate? In addition, if there is a method that works well, except in some pathological cases, and it is possible to avoid those pathological cases by eliminating some words of $ D $, that is still fine for my application.

I am specifically interested in the following case of practical use: $ D $ it is a set of a few thousand common words in English (all lower case), and $ n $ It is approximately 3 to 8. The application is the generation of passwords of "correct horse battery staple" style: how much bias is introduced if it does not put spaces between words?

State: when there are two buttons, how do I correctly indicate that one is active without being ambiguous?

I'm a little unsure of whether you intend to use these buttons as buttons or as tabs (for navigation).

If you are using them as buttons, indicating that "one is active" implies that the other is disabled. The key is to make the active button visible with a click / tappable and the opposite for the disabled button. In your example, both buttons look active. To make the disabled button appear less clickable / interchangeable, especially compared to the active button, try to set its opacity to be erased, but still readable. You may also want to consider adding information about tools (when moving the mouse) or a dialog box (when clicking or touching) that explains to the user why the button is disabled.

If you are using them as tabs, they are not exactly buttons. The tabs (or the segmented controllers in iOS) help the navigation since they remain static, with only a change of state, which I assume is the "state response" to which you refer? If this is your use case, many visual attributes are opened without buttons that can be applied to solve your problem.

jsf – when adding omniface library I get WELD-001318: Unable to resolve an ambiguous dependency

I'm using JSF 6.2 in eclipse, I have a p: dataTable that I want the filters to be preserved during the session

Reloading the page in the table does not appear filtered until you click on update to the table by means of a button. What I'm trying to do is make an update to the table when loading the page

import org.omnifaces.util.Ajax;
@ManagedBean (name = "myBean")
public class myBean {
List of fix list

public void init () {
list = listObjects ()
Ajax.update ("form: table");

In faces config add this:


Add the project to the omnifaces-2.6.1 library which is what makes it listen, if you like the library, even if you do not add the Ajax line in the bean or the change in faces-config the result is the same

javax.servlet.ServletException: WELD-001318: Unable to resolve an ambiguous dependency between: - Managed bean [class myBean] with qualifiers [@Any @Default], - Handled Bean [class otroBean] with qualifiers [@Any @Default]
javax.faces.webapp.FacesServlet.service (
io.undertow.servlet.handlers.ServletHandler.handleRequest ( (
io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest ( (
io.undertow.server.handlers.PredicateHandler.handleRequest ( ( (
io.undertow.server.handlers.PredicateHandler.handleRequest ( ( ( ( ( ( (
io.undertow.server.handlers.PredicateHandler.handleRequest ( (
io.undertow.server.handlers.PredicateHandler.handleRequest (
io.undertow.server.handlers.PredicateHandler.handleRequest (
io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest (
io.undertow.servlet.handlers.ServletInitialHandler.access $ 100 (
io.undertow.servlet.handlers.ServletInitialHandler $ (
io.undertow.servlet.handlers.ServletInitialHandler $ (
io.undertow.servlet.core.ServletRequestContextThreadSetupAction $ (
io.undertow.servlet.core.ContextClassLoaderSetupAction $ (
io.undertow.servlet.api.LegacyThreadSetupActionWrapper $ (
io.undertow.servlet.api.LegacyThreadSetupActionWrapper $ (
io.undertow.servlet.api.LegacyThreadSetupActionWrapper $ (
io.undertow.servlet.api.LegacyThreadSetupActionWrapper $ (
io.undertow.servlet.api.LegacyThreadSetupActionWrapper $ (
io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest (
io.undertow.servlet.handlers.ServletInitialHandler.access $ 000 (
io.undertow.servlet.handlers.ServletInitialHandler $ 1.handleRequest (
io.undertow.server.Connectors.executeRootHandler (
io.undertow.server.HttpServerExchange $ (
java.util.concurrent.ThreadPoolExecutor.runWorker (
java.util.concurrent.ThreadPoolExecutor $ ( ( 

trace – Are these expressions not the same? The output of Mathematica is ambiguous.

The following graph indicates that the first expression is equal to the second. But how can I use Mathematica to prove it's true?

Plot[(-(Log[(1 - P)/P]/Log in[10])) - (Log in[-(P/(-1 + P))]/Log in[10]), {P, 0, 1}]

An attempt to simplify indicates that the expressions are not the same:

FullSimplify[(-(Log[(1 - P)/P]/Log in[10])) - (Log in[-(P/(-1 + P))]/Log in[10])]

That gives the following answer:

(Log in[-1 + 1/P] + Log[-(P/(-1 + P))])/Log in[10]

enter the description of the image here

automaton – automaton that recognizes ambiguous accepted words of another automaton

Build an NFA that simulates (in a decisive way) two executions of the original NFA in the entry. The NFA also remembers a bit, whether the two races have diverged so far or not. If the bit is disabled and the NFA chooses two different transitions, then it turns it on. The NFA accepts if both executions accept and the bit is activated.

If the original NFA has $ k $ States, then the new NFA will have $ 2k ^ 2 $ You can convert it into a DFA with $ 4 ^ {k ^ 2} $ state

We can reduce the number of states in the corresponding DFA by building the power set directly. In each step, we will remember, for each step, if (i) it is impossible to be in that state, (ii) it is possible to be in that state, but there is a single execution of this type, (iii) it is possible to be in the state , and there are at least two of these executions. A state is accepting if there is an acceptance status of type (iii), or at least two acceptance states of type (ii). This construction uses only $ 3 ^ k $ states, and so it matches your suggestion.