背景
我正在Data Science Studio中构建一个闪亮的信息中心,用户必须从actionButton
中选择要处理的文件,然后按提交DT::renderDataTable
。按下按钮后,它会启动后端进程以确定文件属于哪个类别以及应遵循的工作流程(不同的工作流程包含不同的清理步骤和最终输出)。工作流完成后,我想在library(shiny)
library(shinydashboard)
library(DT)
library(dataiku)
path <- dkuManagedFolderPath("receiver") #folder with the files to choose from
dashboardPage(
dashboardHeader(title = "Catchy Title"),
dashboardSidebar(
selectizeInput("file", "Select File",
list.files(path)),
actionButton("submit", "Submit")
),
dashboardBody(
fluidRow(
box(h2("Show Data"),
div(style = 'overflow-x: scroll', DT::dataTableOutput('mytable')),
width = 12)
)
)
)
中显示最终输出。
渴望输出
我希望我的闪亮应用
MINIMAL WORKING EXAMPLE
我如何在这个简单的应用程序中实现它?
UI
library(dataiku)
library(shiny)
library(shinydashboard)
library(DT)
library(dplyr)
shinyServer(function(input, output) {
file_name <- reactive({
req(input$file)
})
####
# run the process that takes the file name to pass it to
# the global environment, which triggers the conditional workflow
# and may result in different data outputs
####
## AFTER the process runs (approx. 30 seconds after pressing the submit button)
# I want the shiny app to follow this logic:
if(is.null(nrow(try(dkuReadDataset("intermediate_dataset"))[1]))){
df <- dkuReadDataset("final_data1")
} else{
df <- dkuReadDataset("final_data2")
}
output$mytable = DT::renderDataTable({
df
})
})
SERVER 的
public class Client {
public static void main(String[] args) throws IOException, NoSuchAlgorithmException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException, InvalidKeyException, InterruptedException, InvalidAlgorithmParameterException
{
int port=56321;
byte[] ipAddr = new byte[] { 127,0,0,1 };
InetAddress address = InetAddress.getByAddress(ipAddr);
System.out.println(address);
DatagramSocket socket = new DatagramSocket();
byte[] data = new byte[1024];
byte[] plainBytes = "123456".getBytes();
byte[] keySymme = {
0x74, 0x68, 0x69, 0x73, 0x49, 0x73, 0x41, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x4b, 0x65, 0x79
};//"thisIsASecretKey";
SecretKeySpec secretKey = new SecretKeySpec(keySymme, "AES");
System.out.println("key"+secretKey);
// Create Cipher instance and initialize it to encrytion mode
Cipher cipher = Cipher.getInstance("AES"); // Transformation of the algorithm
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
byte[] EncryptedData = cipher.doFinal(plainBytes);
DatagramPacket packet1=new DatagramPacket(EncryptedData, EncryptedData.length, address, port);//bytes
System.out.println("Sending...");
socket.send(packet1);
System.out.println("Sent...");
socket.close();
}
感谢提示!