问题列表 - 第198718页

Byteman - 跟踪给定包中的所有类和方法

使用Byteman时,我们必须在规则语法中指定类和方法.如果我想使用Byteman跟踪程序执行怎么办?

示例:执行程序功能时,我不知道正在执行哪些方法.我想在功能执行期间识别被调用的方法.

这是否意味着我要为给定包中每个类的每个方法添加一个规则?或者有没有其他方法来实现这一目标?

java trace byteman

0
推荐指数
1
解决办法
1036
查看次数

如何在Safari私密模式的本地存储中保存

我有一个应用程序,用于在本地存储中保存用户名.它适用于所有浏览器,除了Safariprivate mode.

有没有办法在Safari私密模式下保存此变量?我尝试过使用cookies,但它也不起作用......

有什么工作吗?

cookies safari local-storage incognito-mode

4
推荐指数
2
解决办法
2651
查看次数

在R中闪亮的仪表板应用程序中显示LaTeX方程式

我想在我闪亮的仪表板应用程序中显示带有LaTeX方程的Rmd文件.我使用includeMarkdown()和遇到了问题includeHTML().这是我正在努力实现的简化应用程序.这是我的app.R:

library(shinydashboard)
ui <- dashboardPage(
    dashboardHeader(title='My test application'),
    dashboardSidebar(
        sidebarMenu(
            menuItem("Theory", tabName = "theory", icon = icon("book"))
        )
    ),
    dashboardBody(

        tabItems(

            tabItem(tabName="theory",
                    includeMarkdown("Theory.Rmd")
                    #includeMarkdown("Theory.md")
                    #includeHTML("Theory.html")
            )
        )    
    )
)

server <- function(input, output){

}

shinyApp(ui = ui, server = server)
Run Code Online (Sandbox Code Playgroud)

我的Theory.Rmd文件:

---
title: "Theory"
output: 
  html_document:
    mathjax: "http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
---
Here is an equation:

$$Q = a(h ? c)^b$$ 
Run Code Online (Sandbox Code Playgroud)

请注意,为了运行应用程序,必须将Theory.Rmd和app.R保存在同一目录(例如工作目录)中,手必须具有这些确切的名称.要获取Rmd文件的markdown Theory.md文件,只需执行以下操作:

library(knitr)
knit("Theory.Rmd","Theory.md")
Run Code Online (Sandbox Code Playgroud)

要获取该Theory.html文件,只需按下Theory.Rmd文件中的Knit to HTML按钮即可

在我的浏览器或RStudio窗口中运行我的应用程序时,includeMarkdown("Theory.Rmd")或者includeMarkdown("Theory.md"),不要渲染方程式,但它在理论菜单项中默认启动,如下所示: 在此输入图像描述 但是使用includeHTML("Theory.html")方程式可以正确渲染,但屏幕显示会缩短,默认情况下它不会在任何菜单项中启动,如下所示:在此输入图像描述

但是当点击理论时,我得到了正确的渲染方程式: …

r r-markdown shiny shinydashboard

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

Spring-使用cookie的RESTful身份验证

根据本文,我尝试使用Cookie来实现针对我的android客户端应用程序的身份验证-http: //automateddeveloper.blogspot.co.uk/2014/03/securing-your-mobile-api-spring-security.html

SecurityConfig:

@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    private final static String TOKEN_STRING = "my_token";
    private final static String COOKIE_STRING = "my_cookie";

    @Autowired
    private UserDetailsService userSvc;
    @Autowired
    private MyTokenBasedRememberMeService tokenSvc;
    @Autowired
    private RememberMeAuthenticationProvider rememberMeProvider;
    @Autowired 
    private MyAuthSuccessHandler authSuccess;
    @Autowired
    private MyAuthFailureHandler authFailure;
    @Autowired
    private MyLogoutSuccessHandler logoutSuccess;


    @Autowired
    protected void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
        auth
            .userDetailsService(userSvc)
            .passwordEncoder(passwordEncoder());

        auth.authenticationProvider(rememberMeProvider);
    }

    @Override
    protected void configure(HttpSecurity http) throws Exception {

         http
            .authorizeRequests()
                .antMatchers("/register").permitAll()
                .anyRequest().authenticated().and()
            .formLogin()
               .loginPage("/")
               .loginProcessingUrl("/loginendpoint")
               .successHandler(authSuccess)
               .failureHandler(authFailure).and()
            .logout() …
Run Code Online (Sandbox Code Playgroud)

cookies spring spring-security spring-boot

4
推荐指数
1
解决办法
1万
查看次数

在 OpenXml 复选框 word2013 中设置值

所以我有一个正在通过 WPF(C#) 应用程序编辑的文档。我已成功编辑纯文本内容控件,但现在我无法选中/取消选中表单中的复选框。

我成功找到了复选框并设置了值并保存了文档,但是当我打开它时,从未在 word 文档中选中设置为 true 的复选框。

这是我用来操作复选框的代码。注意:我在标签级别访问复选框,因此 field.parent.parent

private static void SetCheckBox(OpenXmlElement field, bool isChecked)
{
    var checkBox = field.Parent.Parent.Descendants<SdtContentCheckBox>().ToList();
    foreach (var check in checkBox)
    {
        if (isChecked)
        {
            check.Checked.Val = OnOffValues.True;
        }
        else
        {
            check.Checked.Val = OnOffValues.False;
        }
        MessageBox.Show(check.Checked.Val);
    }
}
Run Code Online (Sandbox Code Playgroud)

当我在 MessageBox 中显示值时,它们显示 0/1 表示真/假。所以它们实际上是被设置的。

我这样做正确吗?

c# wpf checkbox openxml

4
推荐指数
1
解决办法
2622
查看次数

当通过javascript填充输入框时,使实体标签移出输入框

通常,使用Materialize,文本输入框的标签会显示在输入框内,直到用户输入选择框并在其中输入文本.但是,当通过javascript填充框的值时,标签不会移开.它保留在框中并与输入的文本重叠.有没有办法用javascript触发标签转换,所以这不会发生?

css labels materialize

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

如何调用可选的协议方法?

我有一个符合我自己的协议的类,它有可选的方法.对该类对象的引用也是可选的.换句话说,对象可能存在,并且它可能已经实现所讨论的方法.但我怎么称呼它?我有这样的代码:

if let theDelegate = delegate {
    if let result = theDelegate.delegateMethod() {
    }
}
Run Code Online (Sandbox Code Playgroud)

但Xcode抱怨"可选类型的值'(( - - >())?' 没有打开".它希望我将示例中第2行的后半部分更改为"theDelegate.delegateMethod!()",但是强制展开会破坏我想要做的目的.我怎么称呼这种方法?请注意,我的方法没有参数或返回值.

swift

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

将预测值和残差附加到pandas数据帧

将预测值和残差作为不同列附加到数据框上是一种有用且常见的做法.我是熊猫的新手,我在执行这个非常简单的操作时遇到了麻烦.我知道我错过了一些明显的东西.有一个非常相似的问题大约一年半前,,但它没有得到真正的回答.

数据框目前看起来像这样:

y               x1           x2   
880.37          3.17         23
716.20          4.76         26
974.79          4.17         73
322.80          8.70         72
1054.25         11.45        16
Run Code Online (Sandbox Code Playgroud)

而我想要的是返回一个具有预测值的数据帧和每个观察的y = x1 + x2的残差:

y               x1           x2       y_hat         res
880.37          3.17         23       840.27        40.10
716.20          4.76         26       752.60        -36.40
974.79          4.17         73       877.49        97.30
322.80          8.70         72       348.50        -25.70
1054.25         11.45        16       815.15        239.10
Run Code Online (Sandbox Code Playgroud)

我已经尝试使用statsmodels和pandas解决这个问题并且无法解决它.提前致谢!

python prediction dataframe pandas statsmodels

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

在python中将字符串转换为树结构

我在python中有一个以下形式的字符串:

line a
line b
  line ba
  line bb
    line bba
  line bc
line c
  line ca
    line caa
line d
Run Code Online (Sandbox Code Playgroud)

你可以得到这个想法.它实际上采用与python代码本身非常相似的形式,因为有一条线,并且在该行下方,缩进指示块的一部分,由最近的较小缩进线引导.

我需要做的是将此代码解析为树结构,以便每个根级别行是字典的键,其值是表示所有子行的字典.所以上面会是:

{
'line a' => {},
'line b' => {
  'line ba' => {},
  'line bb' => {
    'line bba' => {}
    },
  'line bc' => {}
  },
'line c' => {
  'line ca' => {
    'line caa' => {}
    },
  },
'line d' => {}
}
Run Code Online (Sandbox Code Playgroud)

这是我得到的:

def parse_message_to_tree(message):
    buf = StringIO(message)
    return parse_message_to_tree_helper(buf, 0)

def parse_message_to_tree_helper(buf, …
Run Code Online (Sandbox Code Playgroud)

python

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

grunt-contrib-connect错误:中间件未定义

我正在为我的AngularJS应用程序使用yeoman的角度生成器.这个生成器包括grunt和grunt-contrib-connect,它们非常有用......但是依赖项已经过时了,所以我决定更新它们.

这样做时,我有一个grunt-contrib-connect错误,这是我使用--verbose选项的时候:

Running "connect:test" (connect) task
Verifying property connect.test exists in config...OK
File: [no files]
Options: protocol="http", port=9001, hostname="localhost", base=".", directory=null, 
keepalive=false, debug=false, livereload=35729, open=false, useAvailablePort=false, 
onCreateServer=null, middleware=undefined
Warning: undefined is not a function Use --force to continue.

Aborted due to warnings.
Run Code Online (Sandbox Code Playgroud)

所以似乎中间件负责这个问题,这里是:

middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect.static('test'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
Run Code Online (Sandbox Code Playgroud)

任何帮助我解决这个问题的帮助都非常受欢迎:)

gruntjs grunt-contrib-connect

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