小编Fun*_*uit的帖子

请求是空laravel ajax多个图像

所以我有一些功能正常的代码,但我需要添加多个图像上传到它.我用过这个插件.现在我的HTML看起来像这样:

<form class="form-horizontal full-width pull-left m-t-20" name="myForm" ng-if="showForm">
    <div class="form-group">
      <label for="Naam" class="col-sm-3 control-label">Naam</label>
      <div class="col-sm-9">
        <input type="text" class="form-control" id="Naam" ng-model="addForm.name" placeholder="Naam">
      </div>
    </div>
    <div class="form-group">
      <div class="imageselect col-sm-3">
        Afbeeldingen
        <input type="file" ngf-select ng-model="files" ngf-multiple="true" accept="image/*" />
        Drop afbeeldingen: <div ngf-drop ng-model="files" class="drop-box">Drop</div>
      </div>
      <div class="col-sm-9">
        <div ng-repeat="file in files" class="imagepreview">
          <img ng-show="myForm.file.$valid" ngf-thumbnail="file" class="thumb"><br /> <button ng-click="file = null" class="thumbremove" ng-show="file">Verwijder</button>
        </div>
      </div>
    </div>
    <div class="form-group">
      <span class="progress" ng-show="files.progress >= 0">
        <div style="width:<< files.progress >>%" ng-bind="files.progress + …
Run Code Online (Sandbox Code Playgroud)

php image-uploading laravel angularjs ng-file-upload

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

为什么这些文字没有被ncurses着色?

我想在ncurses中创建一个窗口,用一个框包围它,并在其中写入一些彩色文本.

当我尝试在标准窗口中制作简单的彩色文本时,它可以很好地工作,但是当我尝试将它放在一个新窗口时,文本在黑色上显示为白色(即默认值)

这是我尝试过的代码.为什么它不起作用?

#include <ncurses.h>

int main(int argc, char *argv[])
{
    initscreen();
    WINDOW * win = newwin(8,15,1,1);
    box(win,0,0);
    start_color();
    init_pair(1, COLOR_BLACK, COLOR_RED);
    attron(COLOR_PAIR(1));
    mvwprintw(win,1,1,"colored text");
    wrefresh(win);
    getch();
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

c++ colors ncurses

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

Android:无法解决65k问题

我已经在这两天了.我尝试了所有与multi-dexing相关的解决方案,但无济于事.我删除了所有内容,以便我可以重新开始.

应用程序gradle:

apply plugin: 'com.android.application'
android {
          compileSdkVersion 21
          buildToolsVersion "21.1.2"
          defaultConfig {
          applicationId "com.bilboldev.joestrategy"
          minSdkVersion 15
          targetSdkVersion 21
          versionCode 1
          versionName "1.0"
          multiDexEnabled true
      }
buildTypes {
    release {
        minifyEnabled false

        proguardFiles getDefaultProguardFile('proguard-android.txt'),     'proguard-rules.pro'
      }
   }
}

dependencies {
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.google.android.gms:play-services-ads:9.0.0'
}

apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)

项目gradle:

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:1.1.0'
    classpath 'com.google.gms:google-services:3.0.0'

}
}



allprojects {
repositories {
    jcenter()
}
}
Run Code Online (Sandbox Code Playgroud)

里面最明显:

 <meta-data
    android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />
 <application
    android:name="android.support.multidex.MultiDexApplication" ... …
Run Code Online (Sandbox Code Playgroud)

android android-gradle-plugin

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

写入后的空白文件?

所以我一直在尝试为我的一个朋友写一个Bukkit插件,由于某种原因,配置生成不起作用.有问题的代码如下,我很乐意添加任何人们需要帮助我的代码.当我运行该程序时,创建的配置文件最终为空白.测试文件很好(我通过简单地注释掉删除文件的行来测试)但是一旦我尝试获得多行就失败了.有人可以帮忙吗?

PrintWriter out = new PrintWriter(new FileWriter(config));
out.println("########################################");
out.println("#  hPlugin is written by newbiedoodle  #");
out.println("########################################");
out.println("#   -----  Plugin config file  -----   #");
out.println("########################################");
out.println("NOTE: Do not edit the config file besides changing the values - it may result in errors.");
out.println("--------------");
out.println("Strikes before being banned?");
out.println("3");
out.println("Godmode?");
out.println("true");
out.println("First time running the plugin?");
out.println("true");
out.println("Curse protection?");
out.println("true");
out.println("Emergency shelter?");
out.println("true");
out.println("Path building?");
out.println("true");
out.println("Blocked words/phrases (Separate with comma)");
out.println("[censored]");
out.close();
System.out.println("Successfully wrote defaults to config");
Run Code Online (Sandbox Code Playgroud)

整个事情都包含在try/catch循环中,以捕获可能弹出的任何错误.我觉得我错过了一些非常明显的东西,但我找不到它是什么.

  • config是一个File …

java printwriter bukkit

6
推荐指数
1
解决办法
8865
查看次数

在Ruby on Rails中基于频率对数组进行排序

我有一个嵌套的数字数组,排列如下:

ids = [[5,8,10],[8,7,25],[15,30,32],[10,8,7]]
Run Code Online (Sandbox Code Playgroud)

我只需要一个包含所有键的单个数组,而不重复,所以我使用了这个:

ids = ids.flatten.uniq
Run Code Online (Sandbox Code Playgroud)

这产生了这个:

ids = [5,8,10,7,25,15,30,32]
Run Code Online (Sandbox Code Playgroud)

自从我使用以来.uniq,它消除了重复的值.但是,我想根据它们出现在子数组中的频率来排序,而不是按顺序排列它们的顺序 - 所以像这样:

ids = [8,10,7,5,25,15,30,32]
Run Code Online (Sandbox Code Playgroud)

ruby arrays ruby-on-rails

6
推荐指数
1
解决办法
411
查看次数

如何在c ++中链接头文件

我是用C++编写头文件的新手.这是我目前的代码:

//a.h
#ifndef a_H
#define a_H
namespace hello
{
  class A
  {
    int a;
    public:
      void setA(int x);
      int getA();
  };
} 
#endif

//a.cpp
#include "a.h"
namespace hello
{
   A::setA(int x)
  {
    a=x;
  }
  int A::getA()
  {
    return a;
  }
}

//ex2.cpp
#include "a.h"
#include<iostream>
using namespace std;

namespace hello
{
  A* a1;
}
using namespace hello;
int main()
{
  a1=new A();
  a1->setA(10);
  cout<<a1->getA();
  return 1;  
}
Run Code Online (Sandbox Code Playgroud)

当我尝试编译它时g++ ex2.cpp,我收到此错误:

In function `main':
ex2.cpp:(.text+0x33): undefined reference to `hello::A::setA(int)'
ex2.cpp:(.text+0x40): …
Run Code Online (Sandbox Code Playgroud)

c++ gcc compilation

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

防止Bukkit中指定玩家受到伤害?

我正在尝试制作一个允许你让任何玩家无懈可击的命令 - 也就是神模式.

到目前为止这是我的代码(虽然它是所有的样板)

@EventHandler
public void onEntityDamage(EntityDamageEvent event) {
    if(event.getEntity() instaceof Player) {
        if(godModed.containsKey(event.getPlayer())) {
            //This is where I need the code to go - something to cancel the damage.
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

godModed是一个HashMap godModed包含目前所有人的所有玩家.当他们关闭godmode时,他们将从地图中删除.

命令本身工作正常 - 我现在让它向触发它的玩家发送消息,并且如果它们尚未打开,我还将它添加到godModed.但是,我无法弄清楚如何真正防止对玩家的伤害.我想完全阻止它,而不仅仅是事后医治它们; 虽然后者可能会起作用,但如果其他模式onEntityDamage试图触发一个不应该遇到的模仿玩家不应该遇到的事情,它也可能导致不可预见的后果.

java minecraft bukkit

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

访问Map#entrySet()时出现“不兼容的类型”

我正在研究一个简单的配置文件阅读器,但很有趣,但是在编写测​​试方法时遇到了一个奇怪的错误。在其中是一个for循环,并且我已确保它会引起问题。它给了我这个编译错误:

Incompatible types:
    Required: java.util.Map.Entry
    Found: java.lang.Object
Run Code Online (Sandbox Code Playgroud)

Map声明是这样的:

Map<String, String> props = new HashMap<String, String>();
Run Code Online (Sandbox Code Playgroud)

for循环如下所示:

for (Map.Entry<String, String> entry : props.entrySet()) {
    //Body
}
Run Code Online (Sandbox Code Playgroud)

没有导入的SSCCE证明了这个问题(至少在IntelliJ中):

public class A {
    public static void main(String[] args) {
        Map<String, String> props = new HashMap<String, String>();
        for (int i = 0; i < 100; i++) {
            props.put(new BigInteger(130, random).toString(32), new BigInteger(130, random).toString(32));
        }
        for (Map.Entry<String, String> entry : props.entrySet()) {
            System.out.println(entry.getKey() + ":" + entry.getValue());
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

map …

java intellij-idea

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

使Eclipse将选定的文本括在括号中

我正在使用Eclipse Kepler.

从代码块开始到结束需要很长时间,所以我可以添加开始和结束括号.我正在使用Ctrl+ Shift和箭头键选择我的块,但我没有热键或任何东西用括号包装选择.我喜欢用Ctrl+ Shift+ (Ctrl+ Shift+之类的9命令来做这件事,但我找不到制作它们的方法.

模板无法帮助我.首选项>常规>键无法在编辑器中绑定任何内容.是的,我知道的HomeEnd按钮; 这个问题与他们无关.

我做了一个模板:

(${word_selection})${cursor} 
Run Code Online (Sandbox Code Playgroud)

这有点帮助.但是,我必须用Ctrl+ Space,然后Up Arrow,然后Enter,使用.它也适用于括号; 如果我想尝试使用角度支架,它就行不通.

据我所知,除了为eclipse制作一个插件外,没有办法用快捷方式绑定这个模板.

java eclipse

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

Gmail API是否支持JWT?

我想使用NodeJS访问Gmail API.

我正在使用服务器到服务器的方法(见这个)但是当我执行下面的代码时,我得到一个backEndError,来自Google API的代码500.

有任何想法吗?

var authClient = new google.auth.JWT(
    'email',
    'key.pem',
    // Contents of private_key.pem if you want to load the pem file yourself
    // (do not use the path parameter above if using this param)
    'key',
    // Scopes can be specified either as an array or as a single, space-delimited string
    ['https://www.googleapis.com/auth/gmail.readonly']
);

authClient.authorize(function(err, tokens) {
    if (err) 
        console.log(err);

    gmail.users.messages.list({ userId: 'me', auth: authClient }, function(err, resp) {
    // handle err and response
    if (err) { …
Run Code Online (Sandbox Code Playgroud)

node.js oauth-2.0 jwt google-oauth gmail-api

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