小编thr*_*eez的帖子

Jenkins构建管道 - 在阶段重新启动

我将以下构建管道设置为作业:

Stage 1 - verify all dependencies exist
Stage 2 - build the new jar
Stage 3 - Run integration tests
Stage 4 - Deploy to staging environment (manual step)
Stage 5 - Deploy to production environment (manual step)
Run Code Online (Sandbox Code Playgroud)

我正在寻找一种方法,以便在发生瞬态故障时从特定阶段启动构建管道.例如,假设用户单击以部署到生产时出现网络问题.我不认为从第1阶段启动管道是有意义的......我想再次尝试这一步并继续从那里开始.我没有在Build Pipeline Plugin中看到这样的任何功能.

谢谢!!

jenkins jenkins-workflow jenkins-pipeline

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

设置nginx以允许子域的跨域请求

我有两个域名:

domain.com sub.domain.com

domain.com需要向sub.domain.com发出ajax请求.我意识到如果请求被硬编码为sub.domain.com,浏览器将阻止此操作.我尝试了以下nginx conf:

server {
    server_name domain.com;

    rewrite ^/api/(.*)$ http://sub.domain.com/api/$1; }
Run Code Online (Sandbox Code Playgroud)

但是,我仍然在浏览器(Chrome)中收到以下错误:

No 'Access-Control-Allow-Origin' header is present on the requested resource.
Run Code Online (Sandbox Code Playgroud)

如何设置nginx以指示浏览器允许domain.com和sub.domain.com之间的跨域请求?

谢谢!

nginx cross-domain

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

在AWS EC2上安排作业

我有一个在AWS EC2上运行的网站.我需要创建一个夜间作业,生成站点地图文件并将文件上传到各种浏览器.我在AWS上寻找一个允许此功能的实用程序.我考虑过以下几点:

1)生成对Web服务器的请求,以触发它执行此任务

  • 我不喜欢这种方法,因为它占用服务器线程并在主机上使用cpu周期

2)在运行Web服务器的计算机上创建一个cron作业以执行此任务

  • 同样,我不喜欢这种方法,因为它需要cpu周期远离Web服务器

3)创建另一个EC2实例并设置一个cron作业来运行该任务

  • 这解决了Web服务器资源问题,但为什么要支付额外的EC2实例来运行作业<5分钟?浪费钱!

还有其他选择吗?这是ElasticMapReduce的工作吗?

cron jobs amazon-ec2 amazon-web-services elastic-map-reduce

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

实体不持久 - Spring + Hibernate + JPA

我正在使用Spring + Hibernate + JPA,我遇到的情况是我无法让我的实体持久存储到数据库中.我已经设置了一个使用@Transactional注释的服务类.它使用包含注入的EntityManager的DAO.当我在服务对象上调用该函数时,我看到DAO正在执行的读取的一堆选择,但是由于我的DAO发出的合并和删除没有更新/删除.当然我的设置有问题,但我看不到它.

persistence.xml中

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
    version="1.0">
    <persistence-unit name="pu">
        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.InformixDialect" />
            <property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider" />
            <property name="hibernate.showsql" value="true" />
            <property name="hibernate.cache.use_second_level_cache"
                value="false" />
        </properties>
    </persistence-unit>
Run Code Online (Sandbox Code Playgroud)

config.xml中

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:security="http://www.springframework.org/schema/security"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:p="http://www.springframework.org/schema/p"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
                http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
                http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
                http://www.springframework.org/schema/security
                http://www.springframework.org/schema/security/spring-security-3.0.3.xsd
                http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">

    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
        destroy-method="close">
        <property name="driverClassName" value="org.postgresql.Driver" />
        <property name="url" value="jdbc:postgresql://localhost:5432/testdb" />  
        <property name="username" value="username" />
        <property name="password" value="password" />
    </bean>

    <bean id="entityManagerFactory"
        class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="persistenceUnitName" value="pu" />
        <property …
Run Code Online (Sandbox Code Playgroud)

spring hibernate transactions transactional entitymanager

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

Spring 3 Interceptor Order

我有一个实现两个拦截器的Spring 3 Web App.我使用注释@Configuration的配置类.代码如下:

    @Override
public void addInterceptors(InterceptorRegistry registry) {
    // TODO Auto-generated method stub
    super.addInterceptors(registry);
    registry.addInterceptor(homeInterceptor()).addPathPatterns("/");
    registry.addInterceptor(allInterceptor());
}
Run Code Online (Sandbox Code Playgroud)

无论我将拦截器添加到注册表的顺序是什么,allInterceptor的preHandle函数总是在homeInterceptor的preHandle之前调用.有谁知道如何控制拦截器被调用的顺序?

谢谢!

spring spring-mvc interceptor

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

为什么在firefox中键入textarea会导致屏幕滚动?

我正在遇到一个令人难以置信的问题,只有firefox中的同位素插件.我的每个同位素元素都有一个textarea,当我向下滚动到底部并键入其中一个textareas时,屏幕会跳到顶部.我在jsfiddle中重现了这个:

http://jsfiddle.net/galtschul/WfTZ5/

我一直在看这个几个小时,无法弄清楚是什么导致这个卷轴甚至开火.会爱一些帮助!

谢谢!

javascript firefox javascript-events jquery-isotope

8
推荐指数
1
解决办法
629
查看次数

为什么推送Docker镜像失败,"拨打tcp:查找cdn-registry-1.docker.io on 192.168.1.1:53:read udp 192.168.1.1:53:i/o timeout"?

我正在推动Docker Hub上的私有docker存储库,我不断收到此错误:

2726b5968341: Image successfully pushed 
2fd0731064ec: Image successfully pushed 
49328a658a81: Image successfully pushed 
6beafaa9c78d: Image successfully pushed 
bb8b822852f4: Image successfully pushed 
6a0d258340b1: Pushing 
FATA[0457] Failed to upload metadata: Put https://cdn-registry-1.docker.io/v1/images/6a0d258340b180fd569ec687653d805ebb70e77c1943ca6cfc9d296392ad79ee/json: dial tcp: lookup cdn-registry-1.docker.io on 192.168.1.1:53: read udp 192.168.1.1:53: i/o timeout 
Run Code Online (Sandbox Code Playgroud)

我在Mac OS上运行Docker boot2docker.在运行push命令7次以上它最终成功完成后,但我想我还是会问.

有谁看过这个吗?关于如何解决的提示?

macos docker boot2docker dockerhub docker-registry

8
推荐指数
1
解决办法
5071
查看次数

RestKit响应无法反序列化为对象

我在使用RestKit发布请求期间将响应映射回对象时遇到问题.

这是代码:

请求:

// mapping for the response. response is an object: {"response":"message","success":bool}
RKObjectMapping *responseMapping = [RKObjectMapping mappingForClass:[GenericResponse class]];
    [responseMapping addAttributeMappingsFromArray:@[@"success",@"response"]];
    responseMapping.setDefaultValueForMissingAttributes = YES;
    RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:responseMapping pathPattern:@"/authenticate" keyPath:nil statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];

    // mapping for the request body
    RKObjectMapping *requestMapping = [RKObjectMapping requestMapping];
    [requestMapping addAttributeMappingsFromArray:@[@"username", @"password"]];
    RKRequestDescriptor *requestDescriptor = [RKRequestDescriptor requestDescriptorWithMapping:requestMapping objectClass:[LoginCriteria class] rootKeyPath:nil];

    // set up the request
    RKObjectManager *manager = [RKObjectManager managerWithBaseURL:[NSURL URLWithString:@"http://localhost:8080"]];
    [manager addResponseDescriptor:responseDescriptor];
    [manager addRequestDescriptor:requestDescriptor];
    [manager setRequestSerializationMIMEType:@"application/json"];

    // set up the LoginCriteria object
    LoginCriteria* loginCriteria = …
Run Code Online (Sandbox Code Playgroud)

ios restkit restkit-0.20

7
推荐指数
1
解决办法
2279
查看次数

Adler32非常快速地重复

我正在使用adler32校验和算法从数据库ID生成一个数字.因此,当我在数据库中插入一行时,我会获取该行的标识并使用它来创建校验和.我遇到的问题是我刚刚在数据库中插入了207个后才生成重复校验和.这比我预期的要快得多.这是我的代码:

String dbIdStr = Long.toString(dbId);
byte[] bytes = dbIdStr.getBytes();
Checksum checksum = new Adler32();
checksum.update(bytes, 0, bytes.length);
result = checksum.getValue();
Run Code Online (Sandbox Code Playgroud)

我在做什么/怎么做有什么问题吗?我应该使用不同的方法来创建唯一的字符串吗?我这样做是因为我不想在url中使用db id ...对db结构的更改将破坏世界上所有的链接.

谢谢!

java encryption checksum cryptography adler32

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

RestKit使UI无响应

我正在使用RestKit版本0.2,当我调用RKRequestOperation时,我看到它阻止了UI(意思是,UI变得不连贯/无响应),如下所示:

- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset {
NSString *urlString = [NSString stringWithFormat:@"http://localhost:8080/models?offset=%d&rows=%d", _offset, _numRows];
    NSURL *url = [NSURL URLWithString:urlString];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    RKObjectRequestOperation *operation = [[RKObjectRequestOperation alloc] initWithRequest:request responseDescriptors:@[_responseDescriptor]];
    [operation setCompletionBlockWithSuccess:^(RKObjectRequestOperation *operation, RKMappingResult *result) {
        NSLog(@"Got models: %@", [result array]);
        [self addModelsToView:[results array]];
    } failure:^(RKObjectRequestOperation *operation, NSError *error) {
        NSLog(@"FAILED!");
    }];

    [operation start];
}
Run Code Online (Sandbox Code Playgroud)

更多背景:

我这样做是为了将新的模型视图加载到无限的视图中UIScrollView.我检测到用户滚动到视图底部(坐标逻辑编辑)时,使用上面的RestKit加载下一组视图,当模型返回时,我将它们加载到滚动视图中addModelsToView.即使我发表评论时addModelsToView,仍然存在不稳定的逻辑,所以我确定它与RestKit有关(至少我是如何使用它的).

根据我对RestKit的理解,它确实以异步方式加载,因此我无法找到原因/发生波动的原因.

提前致谢!

ios restkit

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