小编Akk*_*kki的帖子

无法解析方法getActivity()

  • 我是Android的新手,并通过以下
    示例学习如何在Android中创建片段:片段导航抽屉

  • 在菜单项添加导航标题之间导航之间的代码包含一种方法getActivity().

  • 由于作者没有提到粘贴此代码的位置,我粘贴在我的MainActivity.java文件中

  • 菜单项之间的导航添加导航标题之间的代码是否由我粘贴在正确的位置?

  • 在方法中selectDrawerItem(MenuItem menuItem)有一个评论// Create a new fragment and specify the planet to show based on position
    作者希望我在这里添加一些东西.

  • 我在AndroidStudio上创建的项目文件布局如下:AndroidStudio Snapshot

android android-fragments navigation-drawer

20
推荐指数
2
解决办法
5万
查看次数

使用身份验证从JAVA连接到RServe

  • 我使用cmd从Server机器运行RServe

    Rserve.exe --RS-conf Rserv.conf --RS-port 12306
    
    Run Code Online (Sandbox Code Playgroud)
  • Rserv.conf文件包含以下内容:

    pwdfile RserveAuth.txt
    auth required
    remote enable
    plaintext disable

  • RserveAuth.txt具有以下内容:

    管理员123456

  • 我从JAVA连接到R Server

    import org.rosuda.REngine.REXPMismatchException;
    import org.rosuda.REngine.REngineException;
    import org.rosuda.REngine.Rserve.RConnection;
    import org.rosuda.REngine.Rserve.RserveException;
    import org.rosuda.REngine.REXP;
    import org.rosuda.REngine.*;
    public class ConnecttoR
    {
      ...
      ...
     public void connectR()
     {
         try 
        { 
            RConnection connection = new RConnection("172.16.33.242",12306); // Works if authentication is not required in Rserv.conf 
        }
        catch (RserveException e) {
        e.printStackTrace();
        } 
        catch(REXPMismatchException e){
        e.printStackTrace();
        }
        catch(REngineException e){
        e.printStackTrace();            
    } 
     }
    }
    
    Run Code Online (Sandbox Code Playgroud)
  • 无需用户名和密码即可连接所有人.如何添加安全性并仅允许使用有效凭据连接以访问Rserve

java windows r tcp-ip rserve

13
推荐指数
1
解决办法
753
查看次数

我们可以在try块中获取LineNumber和ColumnNumber,发生异常

我有下面的代码,我可以打印出发生错误的fullclassname,classname,methodname.

此外,我能够打印行号,但打印的行号是变量"LineNumber"初始化的行.

如何在try块中打印出错误发生的确切LineNumber和ColumnNumber?

try
{
    SQL Query
}
catch(Exception e)
{
   String fullClassName = Thread.currentThread().getStackTrace()[1].getClassName();              
   String className = fullClassName.substring(fullClassName.lastIndexOf(".") + 1);  
   String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();  
   int lineNumber = Thread.currentThread().getStackTrace()[1].getLineNumber();  

     JOptionPane.showMessageDialog(null,fullClassName+"--"+className+"--"+methodName+"--"+lineNumber,"Error In Moving data from table1 to table2",JOptionPane.ERROR_MESSAGE);                         

}
Run Code Online (Sandbox Code Playgroud)

输出继电器:

  IPM.Shifting--Shifting--ConfirmTransfer_BActionPerformed--1138
Run Code Online (Sandbox Code Playgroud)

java exception-handling exception try-catch catch-block

9
推荐指数
2
解决办法
8982
查看次数

基于sysdate的事件

可能重复:
基于sysdate的触发器

1.我有一张表,每天必须在12:00(24小时格式)执行更新操作.

我该怎么做到这一点?

表格架构:

CREATE TABLE CHARGES   
(
    total NUMBER(30),
    admitdate TIMESTAMP(6),
    dischargedate TIMESTAMP(30)
)
Run Code Online (Sandbox Code Playgroud)

更新算法:

if 
{
   dischargedate="null" 
   then total=admitdate-sysdate=difference in days * Total
   Do this every day at 12:00(24 Hr. Format)
}
else
{  
  do nothing.    
}
Run Code Online (Sandbox Code Playgroud)

sql database oracle triggers plsql

5
推荐指数
1
解决办法
395
查看次数

在运行时禁用JComboBox项

1.当用户从JComboBox中选择项目时,我创建了一个JComboBox和Jtable,它们被添加到JTable中.
2.我不想让用户选择他之前在JComboBox中选择的项目.
3.因此必须禁用所选的选项(不可选择).我该怎么办?4.下面的代码在JTable中添加后从JComboBox中删除了该项,但我有兴趣禁用它

        String getchoice=(String)selectedgames_combobox.getSelectedItem();

        DefaultTableModel gamesmodel = new DefaultTableModel(); 

        //adding selected choices from JComboBox in JTable 
        gamesmodel.addColumn("Selected Games");     
        gamesmodel.insertRow(gamesmodel.getRowCount(),new Object[]{ getchoice }) ;  

        //refreshing table
        games_table.setModel(gamesmodel);

        //removing the selected item from JComboBox
        selectedgames_combobox.removeItem(getchoice);
Run Code Online (Sandbox Code Playgroud)

java swing jcombobox

5
推荐指数
1
解决办法
6357
查看次数

查找数据框中的子集并写入结果

  • 我有一个35243行*29列的数据.我正在尝试使用下面的方法在此数据框中查找子集.
  • 给定一条记录,我需要检索与它最相似的记录.
  • 应用函数访问数据集中的每一行,子集函数查找与apply函数当前访问的行类似的记录.

      findFragment<-function(Dataset){        
      df1 <<- data.frame(Col9=character(),aid=character(),month=as.Date(character()),year=as.Date(character()),Outcome=character(),ser_no=character(),Similar=character(),stringsAsFactors=FALSE)
    
      rowind<<-0    
      start.time <- Sys.time()
      apply(Dataset,1,function(slic){
          rowind<<-rowind+1
          fragment<-subset(Dataset, subset = ser_no %in% slic[1] & 
                                                 Outcome %in% slic[2] & 
                                                 year  %in% slic[3] &   
                                                 month %in% slic[4] &
                                                 code %in% slic[5] & 
                                                 name %in% slic[6] & 
                                                 !(aid %in% slic[7]) &
                                                 ((as.numeric(Percentage)<=(as.numeric(slic[8])+0.01) &
                                                 as.numeric(Percentage)>=as.numeric(slic[8])-0.01)
                                                 )
                          ) 
    
           #Refiltering results   
           #If result includes more than 3 rows then refilter back on these rows and include only those rows that have percentage+-0.0001
           if(nrow(fragment)>3){  
                fragment<<-subset(fragment, …
    Run Code Online (Sandbox Code Playgroud)

r match dataframe

5
推荐指数
1
解决办法
403
查看次数