小编ato*_*eki的帖子

如何从指示的索引中删除arraylist中的元素

如图所示,一次运行一个方法后,我想删除旧项目,并准备下次计算,但我想知道如何从指示的索引中删除arraylist中的元素,如队列,服从FIFO算法? Q1

java queue element arraylist

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

Yeoman发电机总是会出现一些错误

当我尝试使用yeoman web生成器时,虽然它正在工作,但是通过查看整个生成进度,它总是在下面给我一些错误,无论我使用什么生成器,它们总是在那里.

npm ERR! phantomjs@1.9.7-6 install: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the phantomjs@1.9.7-6 install script.
npm ERR! This is most likely a problem with the phantomjs package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node install.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls phantomjs
npm ERR! There is likely additional logging output above.

npm …
Run Code Online (Sandbox Code Playgroud)

phantomjs yeoman yeoman-generator

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

如何在Laravel 5中调用firebase / php-jwt类

目前,我想在laravel 5中实现firebase / php-jwt

我已经composer require firebase/php-jwt在laravel 5项目下运行了命令,

"require": {
    ...
    "firebase/php-jwt": "^3.0"
},
Run Code Online (Sandbox Code Playgroud)

在package.json中

从config / app.php,我需要注入这个库,但是不知道该怎么做。


解:

请改用tymondesigns / jwt-auth
并遵循JSON Web令牌教程:Laravel和AngularJS中的示例

即使您的前端不使用角度,也没关系

php laravel-5

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

Java:如何对自定义类型ArrayList进行排序

我有一个自定义类型Position(x,y,z),现在我创建了一个ArrayList<Position>,我想按z的值排序这个数组,从小到大,我该怎么做呢Collections.sort或者还有其他有效的排序方法吗?

当我尝试使用时

public class PositionComparator implements Comparator<Position> {

        @Override
        public int compare(Position o1, Position o2) {
            // TODO Auto-generated method stub
            return o1.height().compareTo(o2.height());

        }

    }
Run Code Online (Sandbox Code Playgroud)

得到一个错误

Cannot invoke compareTo(double) on the primitive type double
Run Code Online (Sandbox Code Playgroud)

java collections mergesort arraylist quicksort

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

如何让grunt usemin更新JS以引用我们的转换图像?

如何让grunt usemin更新JS以引用我们的转换图像?从yeoman网络应用程序生成器,它只重写css和html的链接,但没有js.

如果我的JS文件有一些图像需要压缩,但无法链接:(

这是我目前grunt.js的部分

    useminPrepare: {
        options: {
            dest: '<%= config.dist %>'
        },
        html: ['<%= config.app %>/*.php', '<%= config.app %>/*.html']
    },

    // Performs rewrites based on rev and the useminPrepare configuration
    usemin: {
        options: {
            assetsDirs: ['<%= config.dist %>', '<%= config.dist %>/images']
        },
        html: ['<%= config.dist %>/{,*/}*.php','<%= config.dist %>/{,*/}*.html'],
        css: ['<%= config.dist %>/styles/{,*/}*.css']
    },

    // The following *-min tasks produce minified files in the dist folder
    imagemin: {
        dist: {
            files: [{
                expand: true,
                cwd: '<%= config.app %>/images',
                src: '{,*/}*.{gif,jpeg,jpg,png}', …
Run Code Online (Sandbox Code Playgroud)

javascript node.js grunt-usemin

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

如何重定向到React Native中的页面?

this.props.navigator.push({
  component: MainView,
  passProps: {selectedTab: 'home', message: 'this is the messages'},
});
Run Code Online (Sandbox Code Playgroud)

这是重定向页面的唯一方法吗?也就是说,当条件命中时,我想渲染另一个页面,在React Native中做什么是正确的方法?

react-jsx react-native

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

Junit测试无法通过所有测试用例一次

我有一个非常奇怪的问题,当我尝试使用多个测试用例运行JUnit测试时,它只会传递第一个测试用例并显示IndexOut of Bound错误

public class ABCTest {
    @Test
    public void basicTest1(){...}
    @Test
    public void basicTest2(){...}
    ...
Run Code Online (Sandbox Code Playgroud)

但如果我赞扬其余的测试用例,一个接一个地测试它们,它将通过所有测试用例.

public class ABCTest {    
    @Test
    public void basicTest1(){...}
    //@Test
    //public void basicTest2(){...}
    //...
Run Code Online (Sandbox Code Playgroud)

java junit

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

C#返回值在循环中调用变量

这是文本文件

country1: 93#country2: 355#country3: 213#country4: 376#country5: 244#country6: 54#country7: 374#
Run Code Online (Sandbox Code Playgroud)

对于这个ASP.NET Web服务,当我声明字符串temp ouside"for"循环时,错误"使用未分配的局部变量'temp'"

  [webMethod]
    public string[] getContryCode ()

        {
            string temp;

            string[] data = File.ReadAllLines(@"countryCode.txt");

            string[] country = data[0].Split('#');

            for (int i = 0; i < country.Length; i++ )
            {
                temp = country[i];

            }
                //const string f = "countryCode.txt";

            return temp.Split(':');


        }
Run Code Online (Sandbox Code Playgroud)

如果我在循环中声明字符串temp,我不能返回值"temp.Split(':')".需要找到解决它的方法

originl文件格式:#country1:code1#country2:code2# 数组列表'country':[0] country1 code1 country2 code2- 我可以得到这个工作b split temp.split(':'):应该得到这样的东西[0]country1 [1] code1 [2] country2 [3] code2

c# variables for-loop return

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

如何使用php变量查询sqlite3

<?php
/**
 * Simple example of extending the SQLite3 class and changing the __construct
 * parameters, then using the open method to initialize the DB.
 */
class MyDB extends SQLite3
{
    function __construct()
    {
        $this->open('wifin.db');
    }
}
$db = new MyDB();

$mac = 'test';
$ssid = $_POST['ssid'];
$lat = $_POST['lat'];
$lon = $_POST['lon'];

$db->exec("INSERT INTO wifinTb (mac,ssid,lat,lon) VALUES ($mac,$ssid,$lat,$lon)");

$result = $db->query('SELECT * FROM wifinTb WHERE mac=$mac');

var_dump($result->fetchArray());

?>
Run Code Online (Sandbox Code Playgroud)

我不知道如何在php5中使用变量,$mac应该是一个字符串,当我直接使用时mac=$mac,它返回bool(false),这意味着找不到,但是当我使用时mac='test',它给了我结果。

php sqlite

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