小编Ala*_*an2的帖子

C#中的inherits和implements之间有什么区别

我有以下代码:

public class HitController : MonoBehaviour, ICentroidHitListener
Run Code Online (Sandbox Code Playgroud)

我理解它的方式.HitController继承自MonoBehaviour并实现ICentroidHitListener中的方法.

但是,如果我只想在ICentroidListener中实现方法,我怎么能编码?我这样编码:

public class HitController : ICentroidHitListener
Run Code Online (Sandbox Code Playgroud)

在这种情况下,看起来像HitController继承自ICentroidHitListener

c#

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

如何使用gulp替换文件中的字符串?

我正在使用gulp uglify并准备好我的javascript文件进行制作.我所拥有的是这段代码:

var concat = require('gulp-concat');
var del = require('del');
var gulp = require('gulp');
var gzip = require('gulp-gzip');
var less = require('gulp-less');
var minifyCSS = require('gulp-minify-css');
var uglify = require('gulp-uglify');

var js = {
    src: [
        // more files here
        'temp/js/app/appConfig.js',
        'temp/js/app/appConstant.js',
        // more files here
    ],

gulp.task('scripts', ['clean-js'], function () {
    return gulp.src(js.src).pipe(uglify())
      .pipe(concat('js.min.js'))
      .pipe(gulp.dest('content/bundles/'))
      .pipe(gzip(gzip_options))
      .pipe(gulp.dest('content/bundles/'));
});
Run Code Online (Sandbox Code Playgroud)

我需要做的是替换字符串:

dataServer: "http://localhost:3048",
Run Code Online (Sandbox Code Playgroud)

dataServer: "http://example.com",
Run Code Online (Sandbox Code Playgroud)

在'temp/js/app/appConstant.js'文件中,

我正在寻找一些建议.例如,也许我应该复制appConstant.js文件,更改(不确定如何)并在js.src中包含appConstantEdited.js?

但我不确定如何制作文件的副本并替换文件中的字符串.

你给予的任何帮助将不胜感激.

javascript gulp gulp-concat gulp-replace

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

每次更新应用程序时是否需要创建新的SQLite数据库?

我有一个我想开发的Xamarin Forms应用程序.它将有一个SQLite数据库,我希望在iOS和Android上提供它.数据库将使用来自云上的SQL Server数据库的数据填充初始种子数据.我想这将是大约500行数据,每行大约1Kb.

我不明白的是何时以及如何填充这个.我是否应该尝试将数据放入CSV文件并在安装应用程序或首次启动时填充数据库?除了使用大量插入语句填充代码中的行之外,填充种子数据的常规方法是什么.

关于如何正常完成的任何帮助或建议(我认为大多数人都以同样的方式完成)将不胜感激.

谢谢

sqlite xamarin.ios xamarin.android xamarin

21
推荐指数
2
解决办法
2099
查看次数

将click事件发送到按钮时,$ apply是否已在进行中?

我的页面上有一个按钮,页面上有一个id ="viewQuestions":

    <body ng-keydown="key($event);">
Run Code Online (Sandbox Code Playgroud)

我的代码正在检查这样的关键命中:

    $scope.key = function ($event) {
        $scope.$broadcast('key', $event.keyCode)
    }
Run Code Online (Sandbox Code Playgroud)

并在控制器中:

 $scope.$on('key', function (e, key) {
        if (key == 13) {
            if (ts.test.current && ts.test.userTestId) {
                document.getElementById("viewQuestions").click();
            }               
        }
    });
Run Code Online (Sandbox Code Playgroud)

当我运行代码并单击ENTER然后我收到此错误:

 Error: [$rootScope:inprog] $apply already in progress
http://errors.angularjs.org/1.3.7/$rootScope/inprog?p0=%24apply
    at REGEX_STRING_REGEXP (http://localhost:2757/lib/angular/angular.js:63:12)
    at beginPhase (http://localhost:2757/lib/angular/angular.js:14735:15)
    at Scope.$get.Scope.$apply (http://localhost:2757/lib/angular/angular.js:14479:11)
    at HTMLButtonElement.<anonymous> (http://localhost:2757/lib/angular/angular.js:22945:23)
    at HTMLButtonElement.eventHandler (http://localhost:2757/lib/angular/angular.js:3009:21)
    at http://localhost:2757/app/tests/controllers/TestsController.js:24:62
    at Scope.$get.Scope.$broadcast (http://localhost:2757/lib/angular/angular.js:14700:28)
    at Scope.AppController.$scope.key (http://localhost:2757/app/appController.js:30:20)
    at $parseFunctionCall (http://localhost:2757/lib/angular/angular.js:12330:18)
    at ngEventDirectives.(anonymous function).compile.element.on.callback (http://localhost:2757/lib/angular/angular.js:22940:17)
Run Code Online (Sandbox Code Playgroud)

任何人都可以给我这方面的建议.我只想在按下ENTER键时模拟按钮的单击.我确实尝试过使用表单的解决方案,但它不符合我相当复杂的需求.

javascript events angularjs angularjs-digest

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

Eclipse消息说List无法解析为一个类型

我在eclipse中尝试以下代码:

public class A {    
    List<Integer> intList = new ArrayList<Integer>();
}
Run Code Online (Sandbox Code Playgroud)

但是它给我一个错误说:List无法解析为一个类型而且ArrayList无法解析为一个类型.

我需要添加一些库吗?我该怎么做?

java eclipse

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

使用jQuery AJAX捕获404状态

我有这个代码:

$.ajax({ cache: false,
    url: "/Admin/Contents/GetData",
    data: { accountID: AccountID },
    success: function (data) {
        $('#CityID').html(data);
    },
    error: function (ajaxContext) {
        alert(ajaxContext.responseText)
    }
});
Run Code Online (Sandbox Code Playgroud)

我仍然对ajaxContext以及如何捕获404返回码感到困惑.不过我有另一个问题.我正在阅读有关成功编码和失败的内容,并且在最近的jQuery版本中不再使用错误.

所以我应该改变我的代码使用完成和失败.那怎么能检查404?

jquery http-status-code-404

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

我应该使用什么类型的Typescript返回值进行$ http调用,除了成功之外什么也不返回?

我使用Typescript创建了一个服务:

class ConfigService implements IConfigService {

    public admin = {};
    public adminBackup = {};
    public user = {};
    public loaded = false;

    constructor(
        private $http: ng.IHttpService,
        private $q: ng.IQService
        ) {

    }

    static $inject = [
        '$http',
        '$q'
    ];

    put = ():ng.IHttpPromise<> => {
        var defer = this.$q.defer();
        if (angular.equals(this.admin, this.adminBackup)) {
            return defer.resolve();
        } else {
            this.$http({
                data: {
                    adminJSON: JSON.stringify(this.admin),
                    userJSON: JSON.stringify(this.user)
                },
                url: '/api/Config/Put',
                method: "PUT"
            })
                .success(function (data) {
                    this.adminBackup = angular.copy(this.admin);
                    this.userBackup = angular.copy(this.user)
                    return …
Run Code Online (Sandbox Code Playgroud)

angularjs typescript

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

如何使用glob来忽略以下划线开头的文件?

我在gulp使用这个文件匹配:

'content/css/*.css'
Run Code Online (Sandbox Code Playgroud)

但我想只包含以下划线开头的文件.谁能告诉我怎么做到这一点?

这是代码:

gulp.task('less', function () {
    gulp.src('content/less/*.less')
        .pipe(less())
        .pipe(gulp.dest('content/css'));
});
Run Code Online (Sandbox Code Playgroud)

glob gulp

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

如何修改ui.bootstrap.dropdown以响应鼠标悬停在拖放按钮上?

我想使用ui.bootstrap.dropdown消息框以与ui.bootstrap.popover类似的方式显示文本信息(而不是链接).我想修改这个指令,因为它完成了我需要的99%,我不想添加popover所需的所有额外的JS.

换句话说,我希望当用户将鼠标悬停在向下箭头上时显示"下拉列表区域",然后当他们将鼠标从向下箭头移开时离开.

有没有办法可以为ui.bootstrap.dropdown添加一个选项,所以将鼠标悬停在箭头上会显示并隐藏下拉框.我不想在此框中放置任何链接.

我希望有人有一些想法可以帮助我建议如何更改ui.bootstrap.dropdown附带的这个指令:

.directive('dropdownToggle', function () {
    return {
        require: '?^dropdown',
        link: function (scope, element, attrs, dropdownCtrl) {
            if (!dropdownCtrl) {
                return;
            }

            dropdownCtrl.toggleElement = element;

            var toggleDropdown = function (event) {
                event.preventDefault();

                if (!element.hasClass('disabled') && !attrs.disabled) {
                    scope.$apply(function () {
                        dropdownCtrl.toggle();
                    });
                }
            };

            element.bind('click', toggleDropdown);

            // WAI-ARIA
            element.attr({ 'aria-haspopup': true, 'aria-expanded': false });
            scope.$watch(dropdownCtrl.isOpen, function (isOpen) {
                element.attr('aria-expanded', !!isOpen);
            });

            scope.$on('$destroy', function () {
                element.unbind('click', toggleDropdown);
            });
        }
    };
Run Code Online (Sandbox Code Playgroud)

angularjs angular-ui-bootstrap

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

有没有办法让标签从左到右填充空间?

这是我的代码:

<StackLayout>
   <Label x:Name="emptyLabel1" FontSize="18" XAlign="Start" TextColor="Gray" />
   <Label x:Name="emptyLabel2" FontSize="18" XAlign="Center" TextColor="Gray" />
   <Label x:Name="emptyLabel3" FontSize="18" XAlign="Center" TextColor="Gray" />
</StackLayout>
Run Code Online (Sandbox Code Playgroud)

第一个多行标签从左侧开始,但在右侧的某些行上有空格.第2和第3个多行标签居中,左右两侧各有空格.

有没有什么方法可以让所有行的标签完全填满行,从左到右完全填充o每行的第一个字符总是在左边排成一行,每行的最后一个字的最后一个字符总是行在右边?请注意,这将需要每行中的一些单词在它们之间具有不同的间隙.

xamarin xamarin.forms

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