StopApp | stop apps when you do not need to use | Android library
kandi X-RAY | StopApp Summary
kandi X-RAY | StopApp Summary
stop apps when you do not need to use or rarely used.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- This method is called when the app is created
- Initialize listener
- Get the application version
- Show info dialog
- Called when an activity is clicked
- Calculate the inSampleSize
- Get a scaled bitmap from an image file
- Batch of apps
- Clone the object
- Create the view
- Called when the root app is updated
- Get all installed apps
- Create the options menu
- Intercept the touch event
- Start photo
- Creates the options menu
- Helper method to set the basic app info
- Initializes the toolbar
- Change the color of the message
- Helper method to set the icon
- Handle touch events
- Called when the view is clicked
- Initializes the instance
- Disable apps
- Initialize the toolbar
- Create the RecyclerView
StopApp Key Features
StopApp Examples and Code Snippets
Community Discussions
Trending Discussions on StopApp
QUESTION
A driving simulator PC in my lab generates data that I receive via python socket
. The data is generated every 1/60th of a second. I continuously save it to a csv file called position.csv
. I also want to read position.csv
in R to use in a shiny
app. I read it every 0.2 seconds.
When I run the shiny
app in R, python throws the PermissionError: [Errno 13] Permission denied: 'position.csv'
ANSWER
Answered 2022-Mar-04 at 12:04Without even looking at the shiny portion of this, reaching out to the filesystem for a CSV file every 0.2 seconds has got to be a huge bottleneck and unlikely to be the best way to go with performance in mind.
The most likely reason you're getting permission denied may (I haven't tested) be due to file-locking, where pandas has temporarily locked the file while writing to it, and R is trying to read it too soon. Frankly, even if you were not getting a "denied" error, it is certainly feasible to try to read the file while it is mid-write, meaning incomplete data. There should be some coordination of the write and read events such that this cannot happen.
Some thoughts, without testing (but with experience in mutual-file-access):
Not Filesystem-basedOne alternative is to use some form of streaming-data mechanism such as Redis. This can be a simple "topic" (fifo queue) or with a little more thought (and depending on your needs) a Pub/Sub setup. With this, pandas would push its new data to the topic or pubsub topic, and one (if a vanilla topic) or one-or-more (if pubsub) consumers would get the data in its entirety.
Advantages:
- Not using a filesystem, so the biggest bottleneck will be network bandwidth, likely much lower latency than filesystems, and writes and reads are always atomic (meaning no read-while-being-written problems like you're facing);
- With pub/sub, any client can start "late" and get all past data (if desired) without impacting any other consumers. Realize that "another consumer" may be just you monitoring things, it doesn't necessarily have to be a full-time processing program.
Disadvantages:
- Requires Redis (or Apache Kafka or RabbitMQ or something similar) as a service somewhere on the network, the closer (topologically the better).
- Requires a little more thought into the architecture of cooperation between pandas and R. This will reap benefits.
This is actually quite easy to do on your dev-computer using Docker: the Redis image is free and performs very well, I use it regularly for purposes similar to this. (Docker is not required, Redis installs just fine without it, over to you.)
(Python has redis-py
, R has redux
.)
If you must go with file-based, then you need to use a method that completely mitigates the risk of reading-while-writing. While file-writing is not atomic (which is why you have problems), file-renaming is. Write the file to a temporary file (on the same filesystem, but not in a place or with a name that R will read) and then, once written/closed, rename it so that R will see it.
For instance, let's assume that your convention is to use /some/path/file1234.csv
where perhaps the 1234
increments with each write. (You might instead have time, it doesn't matter.) Let's restrict R so that it only sees files that end in the literal .csv
(not difficult). In pandas, write to /some/path/file1234.csv.temp
, and when complete (and you close()
in python!), rename it to /some/path/file1234.csv
. As soon as the file is renamed, R should be able to read it without distraction.
Advantages:
- No change in architecture, likely the fastest to implement and test.
Disadvantages:
- Still based on the filesystem, which means compounding latency from: network (if using a network filesystem), OS, HDD, etc.
If you're really curious, MailDir is a directory structure that I use for identical purposes, though it's working off of a huge GPFS (NFS-like) where latency of file-creation can be upwards of 10-15 seconds, file-locking is not supported (reliably), and without the file-renaming atomicity I mentioned above, I would be sunk. Surely you do not need the "complexity" (not much, but relatively more complex) of a maildir structure for passing files between pandas and R, but ... the premise of atomic file-renaming has precedence and has had a lot of people work on it. (Maildir scales very well, afaict. The only thing I haven't attempted to figure out yet is filesystem-based pubsub in maildir ...)
(Python and R both do file-renaming atomically, no non-standard modules/packages required.)
Possible change to python (untested):
QUESTION
I use shiny modules to update a large number of value boxes. The annoying part is the value boxes donot seem to scale above 10 or 20 as their updating is causing annoying flickers. Even those boxes whose values are not changing on the next invalidation, flicker. Ideally if the value is not changing the box should not refresh.
A representative shiny app using shiny modules is presented to replicate the problem. When the value of N is 4 or 5 the number of boxes are small and the updates happen instantaneously. As you increase N to 10 it gets noticeable and at N = 20 the flicker is unbearable.
...ANSWER
Answered 2021-Nov-14 at 20:21If you only want to stop the flashing while recalculating all you'll have to do is adding
tags$style(".recalculating { opacity: inherit !important; }")
to your UI - taken from here.
Still I'd encourage you to simplify your app for better performance.
Here is an example for the approach I mentioned in the comments:
QUESTION
How can I update the interface while processing data?
Here is the full story:
I am running a shiny app in a docker container. Before starting the app, I need to download a substantial amount of data (which takes some time). During that time it is not possible to connect to the shiny web server – since it has not started yet. However, I would like to make a simple page "Please wait, downloading data (XX%)" or something to that effect, and once the data is loaded, stop the app and run another one.
Below is a bit of code that kind of works. That is, the app runs, executes the "processing block" and when "data loading" is finished, stopApp is called and the results are returned. However, output is not being rendered until all the "work" has been done.
...ANSWER
Answered 2021-Sep-21 at 10:02Something like this ? Source
QUESTION
The following Shiny app has 3 buttons (blue when inactive). When a button is clicked (active) it should turn red until another button is clicked. If the user clicks elsewhere in the app (e.g. background, or any other widget than the buttons), the clicked button should stay red.
...ANSWER
Answered 2021-Aug-25 at 14:02That's because there's already a class named active
in Shiny which sets a background color to the buttons. So you have to use another name and use !important
. And you don't need HTML
in runjs()
.
QUESTION
I need to call a function in my shiny app that pastes together the code that is to be executed.
(Why? I have many conditional inputs which are dynamically called upon to be worked with. Because of that the conditional inputs differ with the category selected in radiobuttons by the user.)
However, my app throws an error of "object 'input' not found".
Thus: How can my function access all the input$... variables?
MWE:
...ANSWER
Answered 2021-Aug-16 at 10:18library(shiny)
library(tibble)
# Some function stitching together code =================================
my_function <- function(input, label_string) {
tibble(testcolumn = c(input[[label_string]]))
}
shinyApp(
ui = fluidPage(
sidebarLayout(
sidebarPanel(
radioButtons(
"testinput", "This is just a testinput. Just select something.",
c("A", "B", "C"), "A"
)
),
mainPanel(
dataTableOutput("testoutput")
)
)
),
server <- function(input, output, session) {
interim <- reactive({
my_function(input, "testinput")
})
output$testoutput <- renderDataTable(interim())
}
)
QUESTION
I am creating a custom RStudio Project Template as detailed here.
I have everything working to create a new project, and I also have the Shiny app working by itself.
However, I would now like to synchronously run the app in what amounts to my hello_world()
function in the above webpage.
I can write wrapper functions around my Shiny app that work as desired outside of the context of making a new project from a template via the RStudio menus, but in the context of creating a new project, it is as if the line to run the app is not present as no app appears, and there are no messages, warnings, or errors issued.
...ANSWER
Answered 2021-Aug-05 at 13:32?shiny::shinyApp
Normally when this function is used at the R console, the Shiny app object is automatically passed to the print() function, which runs the app. If this is called in the middle of a function, the value will not be passed to print() and the app will not be run. To make the app run, pass the app object to print() or runApp().
The app runs correctly in its self contained function because the returned value is invisibly passed to print, but this does not happen when the function contains additional code.
Therefore, a solution is to wrap the function call in a print()
.
QUESTION
I do have a bit of code executed within session$onSessionEnded()
(such as a DBI::dbDisconnect()
) of a Shiny app and I wonder the best practice to trigger it directly from the R code (for instance when a condition is not met, you close the app but also want to trigger this bit of code).
stop()
will stop the R code (but not the app itself letting a "ghost" app) whereas stopApp()
will close the app without triggering the session$onSessionEnded()
Should I for instance create a function that I should call before stopApp()
ing or is there a way to tell to the application to trigger the session$onSessionEnded()
? Like a session$endSession()
?
ANSWER
Answered 2021-Jul-20 at 17:56You can call session$close()
from anywhere within the server function to stop the current session.
Here is an example:
QUESTION
I created a simple survey form in R Shiny (see code underneath). Now I would like to add some functionality that requires input on all questions on a specific page, before the 'Next' button works. So, if you press 'next' on the first page, but have not answered the first three questions, an alert/error message must appear. The same goes for the second, third, fourth page etc. This example has a few questions, but my final questionnaire would have around 15-20 questions.
It would be great if someone could help me out!
...ANSWER
Answered 2021-Jun-05 at 23:03Final result with working code:
QUESTION
I'm continuing to try and understand the basics of shiny. I am now trying to take a user input via a text box (input$answer
), have a conditional test based on that input (input$answer == "xyz"
), and generate outputs based on this condition (if { } else { }
).
I think I got much of the basics down. I can get a user input, I have turned this into a reactive value so I can generate a query in an if-statement without getting an error. And I can use that user input to generate an output after the answer is submitted.
There are two problems though:
- The query
(isolate(input$answer) == "Hello")
is never TRUE since the value ofisolare(input$answer)
always remains the value it is first assigned. In the current case that is "Enter text..." but the behavior doesn't change if I leave this blank (it just assumes "" as the value). If I change the statement toif (isolate(input$answer) == "Enter text...")
the evaluation will always be TRUE. Why does this value not change even though in the subsequentpaste0("Your answer of ",input$answer, " is incorrect!") })
the value is updated correctly? - Is there a way to prevent the correct/incorrect evaluation at the startup of the server and only have it kick it when the submit button has been hit for the first time?
ANSWER
Answered 2021-Jan-02 at 18:12You need to turn your logic inside out a little when you move from normal R to Shiny. Everything you want to be reactive (i.e. change in response to a user input) needs to be within a reactive context (e.g. a renderText
).
In this example your if
statement is only actually being executed once, when the app is loaded. To have it work more like you want, try something along these lines:
QUESTION
I'm trying to find my way around building some basic shiny tools to display some of the data I'm generating and analysis. Part of the intended workflow is to use one app for the user to select the data that should be displayed and then call a second module that would be specific for the dataset selected. I'm playing around with a toy-example to figure out how to collect inputs and then start a new module based on that info.
I got everything about the data input working, but I am not able to figure out how to pass information from the shinyApp(ui = ui_parameter_selection, server = server_parameter_selection)
call on to the main code. Specifically, I would like to retrieve the last values for input$number
, input$range[[1]]
, and input$range[[2]]
once the shinyApp
is closed and continue working with them.
ANSWER
Answered 2021-Jan-02 at 16:49You can use <<-
to get access of values outside shiny. Change the server function to:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install StopApp
You can use StopApp like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the StopApp component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page