Resetting stack with RNN lib - react-native-navigation

Cannot reset a stack with following use cases.
Let assume Screen A is a root, and navigate to Screen B,
Then while navigating to Screen C, I want the stack to have A->C instead of A->B->C.
If a stack has A->B->C and I want to rest the stack with root screen as C.
Please help on this use cases

This use case is not supported as removing an element from the middle of a stack is not a valid stack api. You probably want to show B in a modal, then push C into the stack contained in the modal. If you want to disallow the user from going back from C to B, then instead of push use setStackRoot with C.
use setStackRoot with C

Related

Importing modules in python 3.5

I am using python 3.5.
I want to import some modules:
One, with some constants, for example:
m.constant1 = 2,3
m.constant2 = 4,5
Another one with some functions definitions, for example:
def b_initialize (model,i) :
return m.binit
And the use this information in my main program,
how can I do it??
Thanks in advance,
Michael
In the first lines of your program, write import m
and to access constant1 and constant2, you can write m.constant1 and m.constant2
Alternatively, in the beginning you can write from m import constant1, constant2. From then on, you can access the constant1 and constant2 just by writing their names, without the m.
As for the function definitions, I can't help you if I don't know the module name, but you if you do, just write modulename.functionname.
This is used very commonly and has most likely been asked and answered on the internet before, though, so make sure to search thoroughly before asking on Stack Overflow.

How can I make PyCharm break when a variable takes a certain value?

I have a big dictionary and some of the elements occasionally end up with illegal values. I want to figure out where the illegal values are coming from. PyCharm should constantly monitor the values of my dictionary, and the moment any of them take the illegal value, it should break and let me inspect the state of the program.
I know I can do this by just creating a getter/setter for my dictionary instead of accessing it directly, and then break inside the setter with an appropriate condition.
Is there a way to do it without modifying my code?
I'm not sure if this answers your question but you can set a breakpoint on the line of code you want to break at, right click on that break point once it is set and then apply a condition.
An example of such a condition could be:
x > 5
Once you are at the stage in your loop/code where this condition is true i.e. when x = 6 then it will break and you can inspect all the current values/ status of your code.
Hope this helps

Linux: Compare repertories with a loop

I would like to compare two directories, and be able to copy one file from a directory to an other ( for example, copy the file dog.png from the directory 1 to the directory 2 if this one doesn't have this file)
I know that there is the "diff" command diff -rq rep1 rep2 which include recursion, but I don't think that the result is convenient (the way it's presented) to work with it. Plus , it doesn't care about the path as long as there is the same file somewhere in the second directory.
My idea was to list the elements of the rep1 , then do a loop, and if there is an other directory, open it and do another loop, do that until there are only files and then compare and go back to the previous loop. I know that seems like recursion, I wanted to know if it was possible to make it that way ? Or if it's too complex.
Mike C: Welcome to Stack Overflow! I would try posing this Q to another site https://softwareengineering.stackexchange.com/ as it does not quite fit the "norm" for Stack Overflow where usually you ask questions about concrete code.I'm going to try to answer the Q anyways.
Yes you could solve this with recursion. You would make one function or method that takes the full path to a directory as it's input, then that function would list all sub-directories and call itself on each of them.
The fact taht you will be scanning two directories in paralelle will add some complexity, because you have to decide what to do in 3 cases:
Subdir exists only in A
Subdir exists only in B
Subdir exists in both
I would implement this by passing TWO full paths to the function, and simply change behsaviour when one of them was null.

TI connect gives error "the name for this variable is not valid" on file transfer

I've written some code for my TI-84+ calculator using an online tool called cemetech, but I receive the above error when trying to transfer the code to my calculator via USB and the TI-Connect software.
I've done some research and apparently this problem can arise when there's a problem with the code, but I don't know enough about TI Basic to know if I've done something wrong or not. This is what I'm trying to transfer:
Prompt x
Prompt y
Prompt w
(x-y)/w->z
Disp z
If z=0.00:then:a=.5000
If z=0.01:then:a=.5040
...(and so on until z=0.49)
Disp a
I wasn't able to find any articles related to TI Basic here, so I'm not sure if I'm in the right place or not, but any help with this would be much appreciated!
The equals sign (=) tests equality, which you probably don't want. You want the assignment operator, (→). Also, I don't see any End statements. If:Then: requires End. For your code, you don't need the Then, your code should be something like
Prompt x
Prompt y
Prompt w
(x-y)/w→z
Disp z
If z=0.00:.5000→a
If z=0.01:.5040→a
...(and so on until z=0.49)
Disp a
Butting in for a moment:
If you are trying to store data into a variable using TI Connect, then:
Use the list of tools on the left hand side and go to:
Char > Keypad > (first option should be an arrow like you'd get with STO> button)
this should allow you to store your data into your variable of choice.
If you weren't looking for this information, my apologies for butting in =)

Is there a module for getting user input from the command line in node.js?

First of all: I don't mean parsing arguments and options from the process.argv array, but prompting the user and handling input/output. I've looked through the Node.js official module list without finding any sections or subsections that mentions input. In fact a search for 'input' on that page only gets 1 result which has something to do with YAML.
Anyway, I suppose cli input should be asynchronous and I've solved this issue before using stdin.on('data') which was messy to say the least. This seems like a perfect task for a node module which could come with extra goodies such as progress bars, spinners, coloured output, input validation etc.
There probably are some modules out there that does this, but I can't find any of them.
Help!!
(To clarify, the only functionality I require is the simplification of handling user input)
Search for modules here: http://eirikb.github.com/nipster/
Prompt: https://github.com/jesusabdullah/node-prompt
Progress bar: https://github.com/substack/node-multimeter
Colors: https://github.com/Marak/colors.js
Input validation: https://github.com/chriso/node-validator
More input validation (webbish tho): https://github.com/caolan/forms
Also, if you want to write your own: http://nodejs.org/docs/latest/api/all.html#readline
#node.js IRC welcomes you: http://webchat.freenode.net/?channels=node.js

Resources