小编Vik*_*sal的帖子

GULP:没有定义gulp

如下面的屏幕截图所示,我无法运行gulp以连接JavaScript文件.它的说法gulp is not defined.

我尝试了以下命令:

npm install -g gulp
npm install gulp
npm install gulp --save-dev
Run Code Online (Sandbox Code Playgroud)

我还设置了如下环境变量:

C:\Users\<user>\AppData\Roaming\npm;C:\Python27;C:\Users\<user>\AppData\Roaming\npm\node_modules;C:\Users\<user>\AppData\Roaming\npm\node_modules\gulp;
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

var concat = require('gulp-concat');  
var rename = require('gulp-rename');  
var uglify = require('gulp-uglify');  


//script paths
var jsFiles = 'scripts/*.js',  
    jsDest = 'dist/scripts';

gulp.task('scripts', function() {  
    return gulp.src(jsFiles)
        .pipe(concat('scripts.js'))
        .pipe(gulp.dest(jsDest));
});
Run Code Online (Sandbox Code Playgroud)

npm gulp

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

更改后如何恢复/撤消桌面壁纸?

我正在创建一个屏幕共享应用程序.启动屏幕共享时,我将桌面墙纸颜色更改为黑色.

问题 如何恢复以前的壁纸或Windows主题?

我使用代码将背景更改为纯色,如下所示

此外,此代码存在问题,一旦使用此代码更改背景,我无法将图像设置为壁纸,但我可以应用主题.

public class wallpaperHelper
    {
        public static void SetColor(Color color)
        {

            // Remove the current wallpaper
            NativeMethods.SystemParametersInfo(
                NativeMethods.SPI_SETDESKWALLPAPER,
                0,
                "",
                NativeMethods.SPIF_UPDATEINIFILE | NativeMethods.SPIF_SENDWININICHANGE);

            // Set the new desktop solid color for the current session
            int[] elements = { NativeMethods.COLOR_DESKTOP };
            int[] colors = { System.Drawing.ColorTranslator.ToWin32(color) };
            NativeMethods.SetSysColors(elements.Length, elements, colors);

            // Save value in registry so that it will persist
            RegistryKey key = Registry.CurrentUser.OpenSubKey("Control Panel\\Colors", true);
            key.SetValue(@"Background", string.Format("{0} {1} {2}", color.R, color.G, color.B));
        }

        private static class …
Run Code Online (Sandbox Code Playgroud)

c#

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

Nodejs IOREDIS:如何设置密钥的过期时间?

我正在使用下面给出的代码连接到 Redis 哨兵

var Redis = require('ioredis');
var redis = new Redis({
    sentinels: [{ host: '99.9.999.99', port: 88888 }],
    name: 'mymaster'
});
Run Code Online (Sandbox Code Playgroud)

我正在使用以下代码设置键的值:

function (key, data) {

        var dataInStringFormat = JSON.stringify(data); /// conbverting obj to string

        /// making promise for returning
        var promise = new Promise(function (resolve, reject) {
            /// set data in redis
            redis.set(key, dataInStringFormat)
                .then(function (data) {
                    resolve(data);
                }, function (err) {
                    reject(err);
                });
        });

        return promise;

    }
Run Code Online (Sandbox Code Playgroud)

您能否通过提供解决方案来设置键值的过期时间(例如 12 小时)来帮助我

redis node.js ioredis

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

AXIOS:如何并发运行http请求并在请求失败时获取所有请求事件的结果

我试图使服务器同时获取请求,为了做到这一点,我编写了以下函数。

问题

如果单个调用失败,那么我将无法获得其余请求的响应。

export const getAll = async (collection) => {
    return new Promise((resolve, reject) => {
        const requests = collection.map(req => {
            const config = {
                headers: req.headers,
                params: req.params
            }
            return axios.get(req.url, config);
        })

        axios.all(requests)
            .then(axios.spread((...args) => {
                // all succerss
                resolve(args);
            }))
            .catch(function (error) {
                // single call fails and all calls are lost
                reject(error)
            });
    })
}
Run Code Online (Sandbox Code Playgroud)

是否可以获取所有请求的结果,无论失败还是成功?

javascript promise reactjs axios

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

如何在 OSX 中使用 Objective C 获取所有已安装的应用程序

我需要使用 Objective c 获取 OSX 上所有已安装的应用程序

我用谷歌搜索,发现有人建议使用终端命令执行此操作:

我正在终端上运行这个命令

“system_profiler SPApplicationsDataType -xml”

找到所有应用程序,但我无法从后面的代码中检索终端数据。

请提供一种获取所有已安装应用程序的方法,或者至少请让我知道从 Objective C 获取终端命令结果。

提前致谢

macos cocoa objective-c

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

无法获得管理员权限。错误域=CFErrorDomainLaunchd 代码=2“操作无法完成。(CFErrorDomainLaunchd 错误 2。)

我正在尝试获得用户许可以卸载应用程序。为了获得权利。我正在关注Apple 发表的这篇文章。

这篇文章正在使用这个库

#include <ServiceManagement/ServiceManagement.h>
Run Code Online (Sandbox Code Playgroud)

我在做什么? Github 项目:这里

错误

错误域=CFErrorDomainLaunchd 代码=2“操作无法完成。(CFErrorDomainLaunchd 错误 2。)

cocoa objective-c

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

Showdown Markdown 编辑器:如何调整图像大小以适应内容?

我正在尝试通过其 Angularjs 模块ng-showdown使用堆栈流Markdown 编辑器摊牌

一切都很顺利,但所包含的图像是其实际/原始尺寸。

如何调整它们的大小以适合文本?

下面给出的是一个显示相同问题的假人。

非常感谢!!!

<html ng-app="theShowdown">

<head>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.0/angular.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.0/angular-route.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.0/angular-animate.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/1.2.1/ui-bootstrap-tpls.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.3.0/showdown.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.0/angular-sanitize.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/ng-showdown/1.1.0/ng-showdown.min.js"></script>
  <script>
    var theShowdown = angular.module('theShowdown', ['ngRoute', 'ngSanitize', 'ngAnimate', 'ui.bootstrap', 'ng-showdown']);

    theShowdown.config(function() {

    })

     theShowdown.controller('theMain', function($scope, $showdown) {

      $scope.mymarkdown = `**Hello** _Stackover Flow_ ![Showdown][sd-logo]

[sd-logo]: http://logz.io/wp-content/uploads/2016/02/stack-overflow-logo.png`;

      var htmlValue = $showdown.makeHtml($scope.mymarkdown)

    })
  </script>
</head>

<body ng-controller="theMain">
  <p markdown-to-html="mymarkdown"></p>
  <textarea rows="4" cols="150" ng-model="mymarkdown"></textarea>
</body>

</html>
Run Code Online (Sandbox Code Playgroud)

javascript markdown angularjs pagedown showdown

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

如何通过使用Objective-C转义所有特殊字符将NSString转换为JSON

我创建了一个函数,以便创建一个完美的JSON字符串:

-(NSString *)NSStringToJson:(NSString *)str
{
    NSMutableString *s = [NSMutableString stringWithString:str];
    [s replaceOccurrencesOfString:@"\"" withString:@"\\\\" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [s length])];
    [s replaceOccurrencesOfString:@"/" withString:@"\\/" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [s length])];
    [s replaceOccurrencesOfString:@"\n" withString:@"\\n" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [s length])];
    [s replaceOccurrencesOfString:@"\b" withString:@"\\b" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [s length])];
    [s replaceOccurrencesOfString:@"\f" withString:@"\\f" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [s length])];
    [s replaceOccurrencesOfString:@"\r" withString:@"\\r" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [s length])];
    [s replaceOccurrencesOfString:@"\t" withString:@"\\t" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [s length])];
    [s replaceOccurrencesOfString:@"\{" withString:@"\\{" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [s length])];
    [s replaceOccurrencesOfString:@"}" withString:@"\\}" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [s length])];
    return [NSString stringWithString:s];
}
Run Code Online (Sandbox Code Playgroud)

问题

上面的函数无法将给定的下面的字符串形成为JSON字符串

üáñ~!@#$%^&*()_+-=[\]{}|;’:”,./<>?~ …
Run Code Online (Sandbox Code Playgroud)

json objective-c

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

是否可以在单击其他按钮时显示按钮的 Bootstrap 弹出窗口?

我试图找到一种方法来手动显示弹出窗口,而不是单击元素。

下面给出的是一个显示两个按钮的代码片段。

  1. 单击我:单击时显示弹出窗口。(这不应该发生)

  2. show click me popover: 这是假设显示click me的弹出框。

    简介:在所示酥料饼button1上的点击button2,但不显示酥料饼时,button1点击是

$(document).ready(function() {
  $('[data-toggle="popover"]').popover({
    placement: 'top',
    html: true,
    title: function() {
      return 'User Info: ' + $(this).data('title') + ' <a href="#" class="close" data-dismiss="alert">×</a>'
    },
    content: function() {
      return '<div class="media"><a href="#" class="pull-left"><img src=".." class="media-object" alt="Sample Image"></a><div class="media-body"><h4 class="media-heading">' + $(this).data('name') + '</h4><p>Excellent Bootstrap popover! I really love it.</p></div></div>'
    }
  });
});


$(document).ready(function() {
  $(document).on("click", ".popover .close", function() {
    $(this).parents(".popover").popover('hide');
  });
});
Run Code Online (Sandbox Code Playgroud)
.bs-example { …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery twitter-bootstrap

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

Visual Studio 2013:手动指定本地主机端口号。用于网站项目

我正在Visual Studio中进行一个有角度的项目。

我创建了一个Blank solution视觉工作室,然后添加了现有网站。

Open VS>>New Project>>Blank Solution>>Right click solution>>Add existing web site>>select Folder>>F5
Run Code Online (Sandbox Code Playgroud)

由于某些原因,我必须在上运行网站,localhost:8080但Visual Studio会自行设置端口。

如何将运行端口更改为8080

我在Google上搜索了很多,但发现的唯一解决方案是ASP.net。像 stackover flow一样, 微软文档

Alt+Enter is opening this property window
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

在此处输入图片说明

c# visual-studio visual-studio-2012 visual-studio-2013

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

使用for-in迭代对象时,是否需要检查hasOwnProperty?

我们使用for in如下迭代对象

var object = { "a":"foo", "b":"bar"}

for (var key in object) {
   var element = object[key];
}
Run Code Online (Sandbox Code Playgroud)

我见过我的老年人建议我在实际访问之前检查属性是否存在.为什么?因为如果一个for in给我一把钥匙就意味着它存在......

我为什么要这样写for in:

for (var key in object) {
    if (object.hasOwnProperty(key)) {
        var element = object[key];            
    }
}
Run Code Online (Sandbox Code Playgroud)

javascript

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