我在一行上创建了2个按钮,并且使用我正在使用的模板正确设置样式有一些问题.
该按钮有4种状态,但当客户端处于活动状态时会出错.
第一个状态是没有任何事情发生.
第二个状态是+符号处于活动状态或处于悬停状态
在第三个状态,当我将鼠标悬停在客户端上时,我得到了:这是正常的.
但是当客户端处于活动状态时,我会得到与没有活动时相同的结果.那么我能做些什么来使活动状态等于图3中的悬停状态.
html是这样的:
<li ui-sref-active="active" class="clearfix li-button"> <a class="btn btn-primary-li-left" ui-sref="app.clients" ripple=""><em class="sidebar-item-icon icon-head"></em> Clients </a> <a class="btn btn-primary-li-right " ui-sref="app.addclient" >+</a> </li>
Run Code Online (Sandbox Code Playgroud)
我使用app.html作为模板,我有这个:
<aside ng-include="'html/main/templates/sidebar.html'" ng-class="app.theme.sidebar"></aside>
Run Code Online (Sandbox Code Playgroud)
app.theme.sidebar类==#bg-white
我添加的CSS是没有模板的情况下工作:
.li-button a{
float:left;
display: block;
}
.li-button a:first-child{
width: 77%;
}
.li-button a:last-child{
width: 15%;
margin-left: 2%;
margin-right: 2%;
color: #ffffff;
}
.btn-primary-li-left {
text-align: left;
vertical-align: middle;
font-weight: 900;
height: 40px;
}
.btn-primary-li-right {
height: 40px;
text-align: center;
vertical-align: middle;
font-weight: 900;
}
.li-button a:last-child:hover { …
Run Code Online (Sandbox Code Playgroud) 我还是单元测试的新手.我开始读一本关于它的书.但最重要的一点是,测试必须是第一个(快速,隔离,可重复,自我验证,及时).
好的,现在我已准备好进行一些练习.但是当我在春季靴子中构建单元测试时.我喜欢让他们分开.
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = UnitTestApplication.class, loader = SpringApplicationContextLoader.class)
@WebIntegrationTest("server.port:9000")
public class FirstTestClassTest{
...
}
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = UnitTestApplication.class, loader = SpringApplicationContextLoader.class)
@WebIntegrationTest("server.port:9001")
public class SecondTestClassTest{
...
}
Run Code Online (Sandbox Code Playgroud)
这给我的问题是,对于每个测试类,都有一个新的实例启动了应用程序.
所以,假设我介绍了一个新功能,并希望测试bug.我在命令行中使用mvn test.然后运行所有测试,但我认为通过大量测试的实际应用程序需要很长时间.
我有一种方法,只有一个实例启动并保持测试快速但我可以在不同的类中保持测试?
所以我有一个简单的 UsersDao
public interface UserDao extends JpaRepository<User, Long> {
}
Run Code Online (Sandbox Code Playgroud)
在我的用户控制器中,我想做这样的事情:
@RequestMapping(value = "/register",method = RequestMethod.POST)
public void addUser(@RequestBody User user) {
//How do i check if user already exist with email instead of id
// i managed to do this but can i search on something else than the id
User user1 = userDao.findOne(1);
if (user.getEmail().equals(user1.getEmail()))
{
// And how should i give one error to the front end if the email
//already exist I'm using angular js
} …
Run Code Online (Sandbox Code Playgroud) 所以我有一个 Java (Spring Boot) 应用程序,我在其中使用了 Amazon 的 RSA 密钥。目前这是.pem
格式并存储在我的项目中的本地文件夹中。
但是,当我将应用程序部署到 Web (AWS) 时,我应该在哪里存储它:
可以以其他格式存储它并最好在 application.properties 中使用它吗?
我可以使用 RSA 密钥作为字符串还是它总是来自文件?
*或者我是否需要将其存储在服务器中的安全位置,它会在哪里以及它的安全性如何?
我正在练习如何处理日期。但是当我想使用 javafx 日期选择器时我陷入了困境。因为它只适用于 java.time.LocalDate 我正在尝试这样的事情。
// here i import java.time.LocalDate to get the date from the datepicker;
LocalDate dueDate = datepickerInvoiceDueDate.getValue();
int year = dueDate.getYear();
int month = dueDate.getMonthValue();
int day = dueDate.getDayOfMonth();
//but here i want to import org.joda.time.LocalDate;
LocalDate dueDatejt = new LocalDate(year, month, day);
Run Code Online (Sandbox Code Playgroud)
有解决方法吗?是否可以将Localdate(joda时间)存储在mysql数据库中?
我找到了一个临时解决方案,但我认为这不是正确的方法?
java.time.LocalDate dueDate = datepickerInvoiceDueDate.getValue();
int year = dueDate.getYear();
int month = dueDate.getMonthValue();
int day = dueDate.getDayOfMonth();
//import org.joda.time.LocalDate;
LocalDate dueDatejt = new LocalDate(year, month, day);
Run Code Online (Sandbox Code Playgroud) 我使用时在服务器上创建了一个pdf:
function GetPdf(document) {
//Stores the data and creates the html,pdf file
$http.post('createpdf/', document).success(function(data){
console.log(data.filename);
window.open('download2/'+data.filename+".pdf", "_self");
});
Run Code Online (Sandbox Code Playgroud)
我在谷歌浏览器中弹出了阻止弹出的错误消息.当我使用该网站的选项启用弹出窗口时,一切正常.有没有办法解决 ?因为这可能会让一些用户感到困惑.
但是当我使用时:
window.open('download2/'+data.filename+".pdf", "_self");
Run Code Online (Sandbox Code Playgroud)
它打开页面没有警告,但然后主应用程序被pdf取代,这不是我想要的结果.
刷新令牌始终为空,我翻阅了文档并进行了大量实验。但是我无法获得 refreshToken 来更新访问令牌以供离线使用。
我正在使用 react-google-login 来获取我的离线令牌。我认为这是正确设置的。
以防万一这里是设置:
<GoogleLogin
clientId="***"
buttonText="Login"
accessType="offline"
responseType="code"
scope={"https://www.googleapis.com/auth/calendar"}
onSuccess={responseGoogle}
onFailure={responseGoogle}
/>
Run Code Online (Sandbox Code Playgroud)
但是当我使用授权码时,只返回一个有效期为 3600 秒的访问令牌。我可以使用 accessToken 访问 api。但似乎没有提供刷新令牌。
GoogleTokenResponse tokenResponse =
new GoogleAuthorizationCodeTokenRequest(
new NetHttpTransport(),
JacksonFactory.getDefaultInstance(),
"https://www.googleapis.com/oauth2/v4/token",
clientSecrets.getDetails().getClientId(),
clientSecrets.getDetails().getClientSecret(),
AUTH_CODE,
REDIRECT_URL)
.execute();
String refreshToken = tokenResponse.getRefreshToken();
String accessToken = tokenResponse.getAccessToken();
Run Code Online (Sandbox Code Playgroud)
任何线索出了什么问题?
所以我试图使用hibernate和jpa的自定义查询
@Transactional
public interface EstimateOptionsDao extends JpaRepository<EstimateOptions, Integer> {
@Query("from estimateOptions options inner join options.company company inner join company.user user where user.name = :userName\n")
EstimateOptions EstimateOptions(String userName);
}
Run Code Online (Sandbox Code Playgroud)
但是EstimateOptions
给了我以下错误:
Can't resolve symbol 'EstimateOptions' less... (Ctrl+F1)
This inspection controls whether the Persistence QL Queries are error-checked
Run Code Online (Sandbox Code Playgroud)
所以我发现这篇文章为什么Hibernate查询在IntelliJ中有编译错误?.
所以我添加了一个方面来测试这个:
现在我有这样的hibernate.cfg.xml:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.url"/>
<property name="connection.driver_class"/>
<property name="connection.username"/>
<property name="connection.password"/>
<!-- DB schema will be updated if needed …
Run Code Online (Sandbox Code Playgroud) 每次我创建一个新类我都想知道创建构造函数的最佳方法是什么.如果我使用IntelliJ中的默认构造函数,它将创建一个像示例A的构造函数.但在学校我们学会使用方法B.
A和B之间有一些很大的区别吗?
是否有一些首选方式或只是程序员的选择?
例A:
public Model(int modelNumber) {
this.modelNumber = modelNumber;
}
Run Code Online (Sandbox Code Playgroud)
例B
public Model(int modelNumber) {
setModelNumber(modelNumber);
}
public void setModelNumber(int modelNumber) {
this.modelNumber = modelNumber;
}
Run Code Online (Sandbox Code Playgroud) 我正在学习 udemy 上的教程。在教程中他使用的是 eclipse。但我正在关注 intellij 的课程。每件事都工作正常,但我一直注意到的一件事是,当他运行 servlet 或 jsp 页面时,它总是在 servlet 之前显示项目名称(http://localhost:8080/myapp/index.jsp)。但是当我在 intellij 上创建一个 Web 应用程序时,它只显示 http://localhost:8080/index.jsp。
那么问题是如何获取/index.jsp之前的项目名称。
我尝试将其添加到 web.xml 文件中,但它似乎不起作用
<display-name>myApp</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
Run Code Online (Sandbox Code Playgroud) 我在为custom指令分配一个默认值时遇到了一些麻烦:如果我这样做:vm.client= 'Dhr.';
然后将ng模型更改为ng-model="vm.client"
它可以工作.但我想如果我使用ng-model="vm.client.salutation"
它不起作用.任何想法为什么会发生这种情况?
<div ng-controller="AddClientController as vm">
<form name="form_addClient" ng-submit="vm.add()">
<div class="row">
<!-- salutation -->
<div class="col-md-4">
<bootstrap-dropdown ng-model="vm.client.salutation" data-placeholder="Aanhef" data-dropdown-data="servicesData.listOfServiceNames"></bootstrap-dropdown>
</div>
</div>
....
Run Code Online (Sandbox Code Playgroud)
这是我的控制器:
(function () {
'use strict';
angular
.module('app')
.controller('AddClientController', AddClientController);
AddClientController.$inject = ['ClientService', '$location', '$scope' ];
function AddClientController(ClientService, $location, $scope) {
var vm = this;
vm.add = add;
$scope.form = {};
vm.client.salutation = 'Dhr.';
$scope.servicesData = {
listOfServiceNames : [
"Mevrouw",
"Mw.",
"Dhr.",
"Dr.",
"Heer"
]
}
function add() {
console.log("add …
Run Code Online (Sandbox Code Playgroud) java ×8
javascript ×3
spring ×3
angularjs ×2
hibernate ×2
html ×2
jpa ×2
css ×1
google-api ×1
html5 ×1
javafx ×1
jodatime ×1
jsp ×1
maven ×1
oop ×1
popup ×1
rsa ×1
servlets ×1
spring-boot ×1
spring-mvc ×1
tomcat ×1
unit-testing ×1
url-routing ×1