小编Kou*_*nha的帖子

如何通过Eclipse插件将SparkJava REST API应用程序部署到Google App Engine?

我使用SparkJava为我的项目构建了一个REST API,现在我想将它部署到Google App Engine.但是在Eclipse中安装Google App Engine插件后,我不知道如何做到这一点.我已将我之前项目中的src文件复制到新的Web应用程序项目,并将main()重命名为init(),如http://www.sparkjava.com/readme.html#title18所述,我还更新了web.xml如上所述.但该项目没有运行.请指导!

java google-app-engine spark-java

5
推荐指数
0
解决办法
986
查看次数

Gulp Angular 构建模板缓存问题

build.js正在使用ngHtml2js将指令中的部分转换为 js 文件。

gulp.task('partials', function () {
  return gulp.src('src/{components,app}/**/*.html')
    .pipe($.ngHtml2js({
      moduleName: 'testApp'
    }))
    .pipe(gulp.dest('.tmp'))
    .pipe($.size());
});
Run Code Online (Sandbox Code Playgroud)

其中,我的指令位于 components->directives 中的 components 文件夹中。

问题是,当我尝试部署 dist 文件夹时,来自路由 JS 文件的静态部分调用被触发,并且我得到 404。

angular.module(ModuleName)
        .directive('collapseWindow', ['$parse', function (parse) {

            return {
                templateUrl:'/components/directives/collapse.html',
                transclude:true,
                restrict: 'A'
Run Code Online (Sandbox Code Playgroud)

在我的理解中,ngHtml2js 将部分转换为 module.run 块作为

module.run(['$templateCache', function($templateCache) {
  $templateCache.put('components/directives/collapse.html',
    '<div class="collapsible">\n' ...
Run Code Online (Sandbox Code Playgroud)

但是,为什么我会收到 404 错误,例如

 GET http://localhost:3000/components/directives/collapse.html 404 (Not Found)
Run Code Online (Sandbox Code Playgroud)

javascript angularjs gulp

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

如何在Gulp中添加特定的bower组件作为IE8条件块

我有几个亭子部件,其中我需要像一些部件json3,respondjs,es5shim以在IE8条件块被添加(在构建以及服务)这样的:

<!--[if lt IE 9]> <script src="bower_components/json3/json3.js"></script> <![endif]-->

我该如何着手编写任务?我找不到任何合适的例子gulp-inject以及wiredep这个问题.请指教

javascript internet-explorer-8 gulp gulp-inject wiredep

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

改造实施最佳实践

我们正在使用 Retrofit 构建一个应用程序,其中我们有一个单独的模块来连接我们的后端。按照目前的设计方式,在模块中,我们有一个 RestClient 类,其中包含用路由定义的其余适配器和接口。为简单起见,我提供了一个示例休息端点。

// Rest adapter instance
    private static RestAdapter getRestAdapter() {

        if (!isDebuggable) {
            URL = URL_PROD;
        } else {
            URL = URL_UAT;
        }

        if (mRestAdapter != null) {
            return mRestAdapter;
        }
        return mRestAdapter = new RestAdapter.Builder()
                .setEndpoint(URL)
                .setRequestInterceptor(authHeader())
                .setLogLevel(RestAdapter.LogLevel.FULL)
                .build();
    }


private interface IApiClient {

        @POST("/register")
        void register(@Body JsonObject dataObject, Callback<SignInResponse> signInResponseCallback);

}
Run Code Online (Sandbox Code Playgroud)

对应的客户端定义如下:

public static void register(JsonObject jsonObject, final ErrorNetworkResponse<SignInResponse> listener) {
        getRestAdapter().create(IApiClient.class).register(jsonObject, new Callback<SignInResponse>() {
            @Override
            public void success(SignInResponse signInResponse, Response response) {

                if …
Run Code Online (Sandbox Code Playgroud)

android retrofit

5
推荐指数
0
解决办法
2479
查看次数

R:麻烦使用SMOTE包"无效'标签'"

使用DMwR库中的SMOTE包.加载数据框后,我尝试按如下方式执行采样:

crime_bal$target <- as.factor(crime_bal$target)
crime_bal <- SMOTE(target ~ .,crime_bal,perc.under = 200, perc.over = 100)
Run Code Online (Sandbox Code Playgroud)

但它总是会导致这个错误:

Error in factor(newCases[, a], levels = 1:nlevels(data[, a]), labels = levels(data[,  : 
  invalid 'labels'; length 0 should be 1 or 2
In addition: Warning messages:
1: NAs introduced by coercion 
2: NAs introduced by coercion 
Run Code Online (Sandbox Code Playgroud)

我的数据集的详细信息:

> summary(crime_bal)
     text               url            target  
 Length:6326        Length:6326        0:5994  
 Class :character   Class :character   1: 332  
 Mode  :character   Mode  :character
Run Code Online (Sandbox Code Playgroud)

为什么我总是以错误结束?

r data-mining

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

Matplotlib 设置条形起始点值

我有一个数据集,我在 python 的 matplotlib 的帮助下绘制如下:

import matplotlib.pyplot as plt
%matplotlib inline

n_groups = 10
fig, ax = plt.subplots()
fig.set_size_inches(15,10)
index = np.arange(0, n_groups * 2, 2)
print index
bar_width = 0.35
opacity = 0.4
error_config = {'ecolor': '0.3'}

rects1 = plt.bar(index, df.Quant[0:10], bar_width,
                 alpha=opacity,
                 color='b',
                 error_kw=error_config,
                 label='Quant')

rects2 = plt.bar(index + bar_width, df.English[0:10], bar_width,
                 alpha=opacity,
                 color='r',
                 error_kw=error_config,
                 label='English')

rects3 = plt.bar(index + bar_width * 2, df.Logical[0:10], bar_width,
                 alpha=opacity,
                 color='g',
                 error_kw=error_config,
                 label='Logical')

plt.xlabel('Group')
plt.ylabel('Scores')
plt.title('Scores by Designation')
plt.xticks(index + bar_width, df.Designation[0:10], …
Run Code Online (Sandbox Code Playgroud)

python matplotlib

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

弄乱了numpy安装 - "GFORTRAN_1.4"找不到bug

直到两天前我的机器一切都很好,然后我碰巧手动构建ffmpeg并手动安装其依赖项.现在在virtualenv numpy加载失败与此错误:

ImportError: /home/koustuv/miniconda/lib/libgfortran.so.3: version `GFORTRAN_1.4' not found (required by /usr/lib/liblapack.so.3)

我已经尝试了我的正常conda安装没有virtualenv它工作正常,但在一个新的virtualenv(即使设置python位置到Ubuntu除了miniconda之一)numpy无法导入这个奇怪的错误.试图安装gfortan但它已经在最新的包中.请帮忙!所有作业都被卡住了:(

python ubuntu numpy miniconda

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

如何在gulp中创建重复管道?

我有一个gulp任务,在index.html中注入几个依赖项,如下所示:

return gulp.src(config.serve.html)
          .pipe($.inject(gulp.src(prependSource(config.inject.source.indexes)), {
            read: false,
            starttag: config.inject.indexes,
            addRootSlash: false,
            addPrefix: prefix,
            ignorePath: ignore
          }))
          .pipe($.inject(gulp.src(managerList), {
            read: false,
            starttag: config.inject.managers,
            addRootSlash: false,
            addPrefix: prefix,
            ignorePath: ignore
          }))
          .pipe($.inject(gulp.src(prependSource(config.inject.source.directives)), {
            read: false,
            starttag: config.inject.directives,
            addRootSlash: false,
            addPrefix: prefix,
            ignorePath: ignore
          }))

          .pipe($.inject(gulp.src(prependSource(config.inject.source.routes)), {
            read: false,
            starttag: config.inject.routes,
            addRootSlash: false,
            addPrefix: prefix,
            ignorePath: ignore
          }))
          .pipe($.inject(gulp.src(prependSource(config.inject.source.css)), {
            read: false,
            starttag: config.inject.css,
            addRootSlash: false,
            addPrefix: prefix,
            ignorePath: ignore
          }))


          .pipe($.size())
          .pipe(gulp.dest(dest));
};
Run Code Online (Sandbox Code Playgroud)

如您所见,所有管道都以某种方式重复(除了managerList).所以我想要的是在一系列注入的帮助下将重复管道合并到一个单独的管道中.如何实现相同?

javascript node.js angularjs gulp

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

使用should.js如何检查数组中是否存在字符串?

想检查一个字符串是否存在于数组中someArray.should.contain('str'),但是我找不到对此进行的否定情况检查.

javascript mocha.js should.js

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

C++中<Pointer,String>的unordered_map

我正在尝试创建一个unordered_mapfor <xml_node*,string>对,其中xml_node是来自pugixml库的xml元素,我希望将其指针存储为键.我已经宣布了这样的地图:

unordered_map<xml_node*,string> label_hash;
Run Code Online (Sandbox Code Playgroud)

现在insert功能运行良好.但每当我尝试find像这样的哈希元素:

string lb = string(label_hash.find(node));
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

no matching function for call to ‘std::basic_string<char>::basic_string(std::_Hashtable<pugi::xml_node*, std::pair<pugi::xml_node* const, std::basic_string<char> >, std::allocator<std::pair<pugi::xml_node* const, std::basic_string<char> > >, std::_Select1st<std::pair<pugi::xml_node* const, std::basic_string<char> > >, std::equal_to<pugi::xml_node*>, std::hash<pugi::xml_node*>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, false, false, true>::iterator)’|
Run Code Online (Sandbox Code Playgroud)

现在我需要为地图实现哈希函数和相等的函数吗?我试图像下面这样实现它们,但它不起作用:

struct hashing_func {
    unsigned long operator()(const xml_node* key) const {
        uintptr_t ad = (uintptr_t)key;
        return (size_t)((13 * ad) ^ (ad >> 15));
        //return hash<xml_node*>(key);
    }
};

struct key_equal_fn { …
Run Code Online (Sandbox Code Playgroud)

c++ xml dictionary unordered-map pugixml

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