小编Adr*_*sbe的帖子

如何通过命令行选项加载不同的zshrc文件?

我以前用bash做这个...

/bin/bash --rcfile /home/sindhu/bin/misc_scripts/shellrc/.bashrc_1
Run Code Online (Sandbox Code Playgroud)

我怎么能用zsh完成同样的事情?

谢谢.

bash zsh

12
推荐指数
2
解决办法
5797
查看次数

在scala中动态创建类,我应该使用解释器吗?

我想在Scala中运行时创建一个类.现在,只考虑一个简单的例子,我想用相似的java bean来创建一些属性,我只在运行时知道这些属性.

如何创建scala类?我愿意从Scala的源文件创建,如果有编译它,并在运行时加载的方式,我可能要为我有时候有一些复杂的功能,我想添加到类.我该怎么做?

我担心我读到的scala解释器是沙盒化它加载的解释代码,以便托管解释器的一般应用程序无法使用它?如果是这种情况,那么我将无法使用动态加载的scala类.

无论如何,问题是,如何在运行时动态创建一个scala类并在我的应用程序中使用它,最好的情况是在运行时从scala源文件加载它,类似于interpreterSource("file.scala")它并加载到我当前的运行时,第二最好的情况是通过调用方法来创建. createClass(...)在运行时创建它.

谢谢,菲尔

interpreter scala runtime javabeans

12
推荐指数
1
解决办法
3614
查看次数

部署到heroku资产管道Sprockets :: fileNotFound

我正在尝试将我的应用程序部署到Heroku.Heroku没有加载我的jscss文件

我跑了RAILS_ENV=production bundle exec rake assets:precompile ,它仍然无法正常工作.

然后我跑了 heroku rake assets:precompile

我在Heroku日志中收到此错误:

Error compiling asset application.css:
 Sprockets::FileNotFound: couldn't find file 'jquery.ui.datepicker'
 (in /app/app/assets/stylesheets/application.css.scss:13)

Served asset /application-989f5e5266d9b066eb316183d7db5c77.css - 500 Internal Server Error


 Error compiling asset application.js:
 Sprockets::FileNotFound: couldn't find file 'jquery.ui.datepicker'
 (in /app/app/assets/javascripts/application.js:16)
Served asset /application-d81c946c6f47242e5e97de9bca4938be.js - 500 Internal Server Error
Run Code Online (Sandbox Code Playgroud)

config production.rb:

config.cache_classes = true
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true
  config.serve_static_assets = true
  config.assets.compress = true
  config.assets.compile = true
  config.assets.initialize_on_precompile = false …
Run Code Online (Sandbox Code Playgroud)

configuration heroku ruby-on-rails-3 asset-pipeline

12
推荐指数
1
解决办法
5550
查看次数

Maven依赖关系无法解决

我正在使用Apache Maven3,因为两三天后一些依赖项无法解决,首先没有问题.更具体一点:

  1. maven-findbgs-plugin:plugin:1.3.1
  2. maven-cobertura-plugin:plugin:1.3

它们不应该被maven本身包括在内吗?

我的pom.xml档案:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <artifactId>xyz</artifactId>
  <name>xyz</name>
  <description>xyz</description>
  <repositories>
      <repository>  
        <id>prime-repo</id>  
        <name>PrimeFaces Maven Repository</name>  
        <url>http://repository.primefaces.org</url>  
        <layout>default</layout>  
    </repository>  
  </repositories>
  <dependencies>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${springframework-version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.webflow</groupId>
        <artifactId>spring-faces</artifactId>
        <version>${springwebflow-version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-core</artifactId>
        <version>${springsecurity-version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-config</artifactId>
        <version>${springsecurity-version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-web</artifactId>
        <version>${springsecurity-version}</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${org.slf4j-version}</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</artifactId>
        <version>${org.slf4j-version}</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>${org.slf4j-version}</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.16</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>javax.inject</groupId> …
Run Code Online (Sandbox Code Playgroud)

maven-plugin maven-3

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

Spring内部的war无法在内部jar文件中找到classpath资源

我有一个像这样组织的项目:

core
  -- /src/main/resources/company/config/spring-config.xml
webapp
  -- /WEB-INF/applicationContext.xml
Run Code Online (Sandbox Code Playgroud)

webapp取决于我在部署时core.jar正确包含的内容WEB-INF/lib.

web.xml我有:

<param-value>
    /WEB-INF/applicationContext.xml
</param-value>
Run Code Online (Sandbox Code Playgroud)

applicationContext.xml我有:

<import resource="classpath:/company/config/spring-config.xml" />
Run Code Online (Sandbox Code Playgroud)

但是当我跑步时,我收到了这个错误:

2012-10-04 20:03:39,156 [localhost-startStop-1] springframework.web.context.ContextLoader ERROR: Context initialization failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:/company/config/spring-config.xml]
Offending resource: ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [company/config/spring-config.xml]; nested exception is java.io.FileNotFoundException: class path resource [company/config/spring-config.xml] cannot be opened because it does not exist
    at …
Run Code Online (Sandbox Code Playgroud)

spring tomcat war classpath

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

当使用Joi和Hapi时,如何在一个键上设置要求但允许任何和所有其他键?

我正在尝试为进入Hapi处理程序的JSON对象编写Joi验证.到目前为止代码看起来像这样:

server.route({
    method: 'POST',
    path: '/converge',
    handler: function (request, reply) {
        consociator.consociate(request.payload)
            .then (function (result) {
                reply (200, result);
            });
    },
    config: {
        validate: {
            payload: {
                value: Joi.object().required().keys({ knownid: Joi.object() })
            } 
        }
    }
});
Run Code Online (Sandbox Code Playgroud)

到目前为止,您可以在上面的config:validate:code部分中看到Joi对象验证.进入的JSON看起来像这样.

"key": '06e5140d-fa4e-4758-8d9d-e707bd19880d-testA',
"value": {
    "ids_lot_args": {
        "this_id": "stuff",
        "otherThign": "more data"
    },
    "peripheral_data": 'Sample peripheral data of any sort'
}
Run Code Online (Sandbox Code Playgroud)

在上面的JSON中,需要对象根目录的键和值,并且ids_lot_args需要调用的部分.以peripheral_data开头的部分可以在那里,也可以是任何其他JSON有效负载.没关系,只ids_lot_args需要根级别和值内部的键和值.

到目前为止,我一直在努力让Joi验证工作. 有关如何设置的任何想法?Joi的代码仓库位于https://github.com/hapijs/joi,如果想要查看它.到目前为止,我一直在尝试允许对象上的所有函数无效.

javascript validation json hapijs

10
推荐指数
1
解决办法
4240
查看次数

如何优雅地解析org-element的org-mode

org-element是一个新的模块org-mode,我认为这对解析org文件很好,并且不想用旧方法用match-string解析它.但玩了几个小时之后,我不得不承认我没有足够的org-mode经验,所以主人能给我一些线索,非常感谢!

我的要求很简单,我希望得到所有标题和内容.

* headline

:PROPERTIES

** subheadline

content1

** subheadline

content2
Run Code Online (Sandbox Code Playgroud)

emacs parsing org-mode

9
推荐指数
1
解决办法
1951
查看次数

以树为单位显示递归列的列名

是否有(built'in/easy)方法以递归方式显示names作为树的互连列表?(可能输出类似于treeshell命令.)

例如,对于列表X,具有两个列A和B,A包含在两个子列a1和a2中

nametree(x)
X
??? A
?   ??? a1
?   ??? a2
??? B
Run Code Online (Sandbox Code Playgroud)

names(X) 只会显示 [1] "A" "B"

r

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

使用Spring Boot配置Spring Security

我是使用Java Config配置Spring Security的新手.我试图关注这个帖子.但是,当我运行我的应用程序时,我会对所有URL 进行基本Auth挑战,包括.输入下面的任一userid/pass组合似乎不起作用./

我的控制器:

package com.xxx.web;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/")
/**
 * Controller to handle basic "root" URLs
 * 
 * @author xxx
 * @version 0.1.0
 */
public class RootController {

    /**
     * Handles '/'
     * @param model
     * @return
     */
    @RequestMapping
    public String index(Model model) {
        return "index";
    }

    /**
     * Handles '/signup'
     * @param model
     * @return
     */
    @RequestMapping("/signup")
    public String signup(Model model) {
        return …
Run Code Online (Sandbox Code Playgroud)

spring spring-mvc spring-security spring-boot spring-java-config

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

策展人 - InterProcessMutex锁不会删除节点

有谁知道Curator锁配方中的哪一个会产生短暂的节点?

我测试了InterProcessMutex锁,但据我所知(使用zkClient),它不会在释放后删除节点或关闭会话.

这是我用于锁定密钥的代码.

public void lock(final LockKey lockkey, final LockAcquiredListener listener) throws Exception {

    final String lockKeyPath = lockkey.toString();

    LOGGER.info("Trying to acquire the lock {}", lockKeyPath);

    final InterProcessMutex lock = new InterProcessMutex(client, LOCKS_PREFIX + lockKeyPath);

    if (!lock.acquire(LOCK_MS_TIME_OUT, TimeUnit.MILLISECONDS)) {
        LOGGER.info("Could not acquire the lock {}", lockkey.toString());
        throw new LockAcquisitionTimeOutException("Could not acquire the lock: " + lockKeyPath);
    }
    try {
        if (listener != null) {
            LOGGER.info("Lock acquired for key {}", lockKeyPath);
            listener.lockAcquired(lockkey);
        }
    } finally {
        LOGGER.info("Release …
Run Code Online (Sandbox Code Playgroud)

java apache-zookeeper apache-curator

8
推荐指数
0
解决办法
712
查看次数