小编ski*_*box的帖子

mysql.user中的重复用户

我刚刚做了一个SELECT主机,用户,密码来自mysql.user; 我得到以下结果:

+-------------------------------------+----------+-------------------------------------------+
| Host                                | User     | Password                                  |
+-------------------------------------+----------+-------------------------------------------+
| localhost                           | root     | *CFB0F01E12976D94C46201145940E3EF71E32742 |
| my_name_goes_here-MacBook-Pro.local | root     | *CFB0F01E12976D94C46201145940E3EF71E32742 |
| 127.0.0.1                           | root     | *CFB0F01E12976D94C46201145940E3EF71E32742 |
| ::1                                 | root     | *CFB0F01E12976D94C46201145940E3EF71E32742 |
| localhost                           |          |                                           |
| my_name_goes_here-MacBook-Pro.local |          |                                           |
| %                                   | testuser | *00E247AC5F9AF26AE0194B41E1E769DEE1429A29 |
+-------------------------------------+----------+-------------------------------------------+

如何删除这些重复的条目?(我也可以在我的硬盘中看到以前版本的mysql(5.5.8))

mysql

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

尝试访问已实施的登录页面时,来自glassfish 3的HTTP状态403错误

我使用一个很好的指南创建了一个登录页面,我发现了使用netbeans的Java EE6和GlassFish3.在我尝试访问登录页面时部署项目后,我从GlassFish3服务器获得"HTTP状态403 - 拒绝访问所请求的资源".

我使用的网址是:http:// localhost:9999/simplewebapp/admin/admin.jsp 指南说我应该自动重定向到我创建的登录页面.

相反,我收到上述错误.看一下glassfish3日志,当我输入上面的url时,我得到这两行.

信息:JACC策略提供程序:失败的权限检查:上下文("simplewebapp/simplewebapp"),权限("((javax.security.jacc.WebUserDataPermission /admin/login.jsp GET)")INFO:JACC策略提供程序:失败的权限检查: context("simplewebapp/simplewebapp"),permission("((javax.security.jacc.WebUserDataPermission /admin/login.jsp GET:CONFIDENTIAL)")

更多细节:

web.xml中

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <security-constraint>
        <display-name>Admin Pages</display-name>
        <web-resource-collection>
            <web-resource-name>Administrative Pages</web-resource-name>
            <description/>
            <url-pattern>/admin/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <description>admin</description>
        </auth-constraint>
    </security-constraint>
    <login-config>
        <auth-method>FORM</auth-method>
        <realm-name>file</realm-name>
        <form-login-config>
            <form-login-page>/login.jsp</form-login-page>
            <form-error-page>/loginerror.jsp</form-error-page>
        </form-login-config>
    </login-config>
    <security-role>
        <description>Administrators</description>
        <role-name>admin</role-name>
    </security-role>
    <security-role>
        <description>Users</description>
        <role-name>user</role-name>
    </security-role>
</web-app>
Run Code Online (Sandbox Code Playgroud)

与GlassFish的web.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
  <security-role-mapping>
    <role-name>admin</role-name> …
Run Code Online (Sandbox Code Playgroud)

glassfish-3

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

Java isRollover()方法在我的swing应用程序中不会产生事件

我正在读一本名为Swing:A Beginner's guide的好书.书中有这样的代码,它创建了一个按钮和一个标签,用于警告按钮的状态变化事件:

//Demonstrate a change listener and the button model

package swingexample2_6;

import java.awt.*;
import javax.swing.*;
import javax.swing.event.*;

public class ChangeDemo {

    JButton jbtn;
    JLabel jlab;

    public ChangeDemo() {
        //Create a new JFrame container
        JFrame jfrm = new JFrame("Button Change Events");

        //Specify FlowLayout for the layout manager
        jfrm.getContentPane().setLayout(new FlowLayout());

        //Give the frame an initial size
        jfrm.setSize(250, 160);

        //Terminate the program when the user closes the application
        jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        //Create an empty label
        jlab = new JLabel();

        //Make a button
        jbtn …
Run Code Online (Sandbox Code Playgroud)

java swing jbutton changelistener

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

如何让Maven 3.0.4使用Java7?

我刚刚使用官方网站上编译的二进制文件将maven从3.0.3更新到3.0.4.现在我运行mvn -version,它说它使用旧的java 6版本,而不是我使用的java 7版本安装在我的机器上(macbook pro).如果我从其文件夹中运行3.0.3版本的maven二进制文件,它将使用java 7版本.如何配置maven 3.0.4以便它使用Java 7版本?谢谢.

PS:Java 7是我系统(山狮)的默认java版本.

java maven-3 maven osx-mountain-lion

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

当Tomcat运行IntelliJ Idea Ultimate 12时,我无法访问Tomcat 7管理器

我试图通过使用访问tomcat管理器

http://localhost:8080/manager
Run Code Online (Sandbox Code Playgroud)

但输入密码后我总是被拒绝进入.我收到以下消息:

403访问被拒绝

您无权查看此页面.

如果您已将Manager应用程序配置为允许访问,并且您已使用浏览器后退按钮,使用已保存的书签或类似标记,那么您可能已触发已为HTML启用的跨站点请求伪造(CSRF)保护Manager应用程序的界面.您需要返回主Manager页面重置此保护.返回此页面后,您将能够继续正常使用Manager应用程序的HTML界面.如果您继续看到此拒绝访问消息,请检查您是否具有访问此应用程序所需的权限.

如果您尚未更改任何配置文件,请检查安装中的文件conf/tomcat-users.xml.该文件必须包含允许您使用此Web应用程序的凭据.

例如,要将manager-gui角色添加到名为tomcat且密码为s3cret的用户,请将以下内容添加到上面列出的配置文件中.

请注意,对于Tomcat 7以上,使用管理器应用程序所需的角色已从单个管理器角色更改为以下四个角色.您需要分配您希望访问的功能所需的角色.

manager-gui - 允许访问HTML GUI和状态页面manager-script - 允许访问文本界面和状态页面manager-jmx - 允许访问JMX代理和状态页面manager-status - 允许访问仅限状态页面HTMLF接口受CSRF保护,但文本和JMX接口不受保护.为了保持CSRF保护:

具有manager-gui角色的用户不应被授予manager-script或manager-jmx角色.如果通过浏览器访问text或jmx接口(例如,为了测试,因为这些接口用于工具而非人类),则必须在之后关闭浏览器以终止会话.有关更多信息,请参阅Manager App HOW-TO.

这是我的tomcat-users.xml:

<tomcat-users> 
<role rolename="tomcat"/>
  <role rolename="role1"/>
  <role rolename="manager-gui"/>
  <user username="tomcat" password="s3cret" roles="admin-gui,standard,manager-gui"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>
</tomcat-users>
Run Code Online (Sandbox Code Playgroud)

我通过intellij idea 12终极运行tomcat 7.我正在使用Mountain Lion操作系统.谢谢.

tomcat intellij-idea tomcat7

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

如何更改JSplitPane的颜色

我写了一个小程序,在读一本关于swing的书时,在两个标签之间创建了一个JSplitPane.问题是JSplitPane几乎看不到(至少在我的操作系统中 - MAC OS Lion)并且在它上面设置一些属性(如前景色)似乎不起作用.

这是代码:

//Demonstrate a simple JSplitPane


package swingexample4_6;

import javax.swing.*;
import java.awt.*;

public class SplitPaneDemo {

    //constructor
    public SplitPaneDemo()
    {
        //Create a new JFrame container.
        //Use the default border layout
        JFrame jfrm = new JFrame("Split Pane Demo");

        //Give the frame an initial size
        jfrm.setSize(380, 150);

        //Terminate the program when the user closes the application
        jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        //--Make two labels to show the split pane
        JLabel jlab = new JLabel(" Left side: ABCDEFGHIJKLMNOPQRSTUVWXYZ");
        JLabel jlab2 = new JLabel(" …
Run Code Online (Sandbox Code Playgroud)

java swing

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

缺少资源的Tomcat 7 jndi - javax.naming.NameNotFoundException

我正在尝试使用jndi部署spring应用程序,但是我收到了一个错误.这些都是细节:

server.xml中

<?xml version='1.0' encoding='utf-8'?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in …
Run Code Online (Sandbox Code Playgroud)

spring tomcat tomcat7

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

如何正确更改spring configuation xml文件以从Hibernate 3迁移到Hibernate 4?

我正在阅读"Pro Spring 3"一书,作者使用Hibernate 3作为应用程序.

本书的spring-config.xml如下:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
    xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
    xsi:schemaLocation="
        http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">

    <jdbc:embedded-database id="dataSource" type="H2">
        <jdbc:script location="classpath:schema.sql"/>
        <jdbc:script location="classpath:test-data.sql"/>
    </jdbc:embedded-database>

    <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory"/>
    </bean>    

    <tx:annotation-driven/>

    <context:component-scan base-package="com.apress.prospring3.ch9" />

    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
        <property name="dataSource" ref="dataSource"/>
        <property name="packagesToScan" value="com.apress.prospring3.ch9.domain"/>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">org.hibernate.dialect.H2Dialect</prop>
                <prop key="hibernate.max_fetch_depth">3</prop>
                <prop key="hibernate.jdbc.fetch_size">50</prop>
                <prop key="hibernate.jdbc.batch_size">10</prop>
                <prop key="hibernate.show_sql">true</prop>
            </props>
        </property>        
    </bean>

</beans>
Run Code Online (Sandbox Code Playgroud)

我尝试使用Hibernate 4的实验性spring-config.xml如下:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:tx="http://www.springframework.org/schema/cache"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd …
Run Code Online (Sandbox Code Playgroud)

java spring hibernate

3
推荐指数
1
解决办法
4910
查看次数

Promise的解决和拒绝功能的返回类型是什么?

我试图找到我使用typescript创建的Promise的返回类型和拒绝函数,以便tslint不会根据typedef规则进行投诉.

这是代码:

promises.ts

const promise: Promise<number> = new Promise((resolve, reject): void => {
    //the resolve / reject functions control the fate of the promise
    resolve(123);
});

//The promise fate can be subscribed to using .then (if resolved) or .catch (if rejected)
promise.then((res) => {
    console.log('I get called:', res === 123);      //I get called: true
});
Run Code Online (Sandbox Code Playgroud)

tslint.json

{
    "defaultSeverity": "error",
    "extends": [
        "tslint:recommended"
    ],
    "jsRules": {},
    "rules": {
        "eofline": false,
        "no-console": false,
        "no-consecutive-blank-lines": false,
        "comment-format": false,
        "no-trailing-whitespace": false,
        "quotemark": false,
        "typedef": …
Run Code Online (Sandbox Code Playgroud)

javascript promise webstorm typescript es6-promise

3
推荐指数
1
解决办法
4760
查看次数

如何右对齐一列数字?

我有以下python代码:

#This program converts the speeds 60 KPH
#through 130 KPH (in 10 kph increments)
#to MPH

#Global constants
START = 60
END = 131
INCREMENT = 10
CONVERSION_FACTOR = 0.6214

def main():
    #Print the table headings
    print('KPH\t\tMPH')
    print('----------------')

    #Print the speeds
    for kph in range(START, END, INCREMENT):
        mph = kph * CONVERSION_FACTOR
        print(kph, '\t\t', format(mph, '.1f'))

#Call the main function
main()
Run Code Online (Sandbox Code Playgroud)

运行此代码我得到以下结果:

KPH     MPH
----------------
60       37.3
70       43.5
80       49.7
90       55.9
100          62.1
110          68.4
120          74.6 …
Run Code Online (Sandbox Code Playgroud)

python python-3.x

2
推荐指数
1
解决办法
7337
查看次数