小编Aar*_*ron的帖子

F#获取随机数列表

我正在尝试用随机数字填充列表,并且我很难获得随机数部分.我现在拥有10次随机数字,我想要的是打印10个不同的随机数

   let a = (new System.Random()).Next(1, 1000)


   let listOfSquares = [ for i in 1 .. 10->a]
    printfn "%A" listOfSquares
Run Code Online (Sandbox Code Playgroud)

任何提示或建议?

f#

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

如何进入Eclipse中的命令行

我无法弄清楚如何进入Eclipse中的命令行.我正在使用mac.

eclipse macos android

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

以MySQL身份登录其他用户

我创建了一个不同的用户,当我尝试登录mysql时它不会让我.我想我错过了一步.我正在使用Windows 7.当我自动登录时会要求我输入密码.如果我输入root密码,我可以使用mysql.如果我输入我为用户创建的密码,我会收到一个无法读取的错误,程序将退出.我是否需要先以root用户身份登录,然后以新用户身份登录.我很迷茫.我用来创建新用户的代码在这里:

无法以非root用户身份登录mysql

mysql

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

在Google Maps api中尝试抓取错误消息

我使用javascript并收到一条消息,表示我已超出此API的每日请求配额.有没有办法在try catch块中捕获此错误消息,因此当我查看配额时,我可以执行另一段代码.我看过几篇类似的帖子,但没什么有用的.这是我的代码.

(function (window, google, lat, lng) {
           var options = {
               center: {
                   lat: Number(lat),
                   lng: Number(lng)
               },
                 zoom: 5,
                 disableDefaultUI: true,
                 scrollwheel: true,
                 draggable: false
           },
           element = document.getElementById('map-canvas')
           var map = new google.maps.Map(element, options)
       }(window, window.google, result[i]['latitude'], result[i]['longitude']));
Run Code Online (Sandbox Code Playgroud)

javascript google-maps

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

使用正则表达式替换除最后四位之外的所有数字.

我在javascript中使用正则表达式并希望替换除最后四个之外的数字中的所有数字'#'.我已经想出如何更换所有数字'#',我该怎么做才能不替换最后四个?到目前为止,这是我的代码. return cc.replace(/[0-9]/g, "#")

javascript regex

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

试图获得$(document).on('Click')来为ap标签工作

我试图让我的document.on函数在用户点击具有名为card的类的p标记时起作用.到目前为止,该功能没有响应.我应该更改什么,以便当我点击具有名为card的类的p标签时,该功能将响应.这是我的HTML和JQuery代码.

<!DOCTYPE HTML>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="description" content="Contacts">
    <title>Contacts</title>
    <link rel="stylesheet" type="text/css" href="style.css">
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){

        $('button').click(function(){
            var first = $('input.first').val();
            var last = $('input.last').val();
            var desc = $('textarea').val();

            $('div.right').append("<p class='card'><h1>"+ first +' '+last+"</h1><h4>'Click for description!'</h4></p><p class='back'>"+desc+"</p>");

            return false; 
        });

        $(document).on('click', 'p.card', function(){ //this is the function I am trying to get to work.  
            alert("test");
        });
    });
    </script>
</head>
<body>
    <div class="wrapper">
        <div class="left">
            <form action="#">
                <p >First name: <input type="text" name="fname" class="first"></p>
                <p …
Run Code Online (Sandbox Code Playgroud)

html javascript css jquery

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

在重新启动 dotnet 错误之前等待文件更改

我正在使用 asp.net core、razor 引擎和实体框架。当我尝试使用 dotnet watch run 在 VS code 中运行我的代码时,出现此错误。这是完整的错误。

Project c-login (.NETCoreApp,Version=v1.0) was previously compiled. Skipping compilation.
A JSON parsing exception occurred in [/Users/aaronmk2/Desktop/CodingDojo/c#/asp.net/entity/c-
login/bin/Debug/netcoreapp1.0/c-login.deps.json]: * Line 1, Column 2 Syntax error: Malformed
token
Error initializing the dependency resolver: An error occurred while parsing /Users/aaronmk2/D
esktop/CodingDojo/c#/asp.net/entity/c-login/bin/Debug/netcoreapp1.0/c-login.deps.json
[DotNetWatcher] fail: dotnet exit code: 139
[DotNetWatcher] info: Waiting for a file to change before restarting dotnet...
Run Code Online (Sandbox Code Playgroud)

以前有人见过这个错误吗?解决方法是什么?

c# asp.net-mvc visual-studio razor

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

使用数组并移动重复项结束

我在接受采访时得到了这个问题,最后被告知有一种更有效的方法可以做到这一点,但仍然无法弄明白.您正在向函数传递一个整数数组和一个数组大小的整数.在数组中你有很多数字,有些例如重复1,7,4,8,2,6,8,3,7,9,10.你想获取该数组并返回一个数组,其中所有重复的数字都放在数组的末尾,以便上面的数组变成1,7,4,8,2,6,3,9,10,8,7.我使用的数字并不重要,我不能使用缓冲区数组.我打算使用BST,但必须保持数字的顺序(重复的数字除外).我无法弄清楚如何使用哈希表,所以我最终使用了一个双循环(n ^ 2可怕,我知道).如何使用c ++更有效地完成此操作.不寻找代码,只是想知道如何做得更好.

c++ theory arrays sorting duplicates

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

复制构造函数应该是私有的还是公共的

我正在编写一个抽象类,它将成为其他几个类的父类.我认为复制构造函数应该是私有的,因为你使用的是抽象类,没有什么可以复制的.但是,我不是100%肯定.

我是否正确,如果我不是为什么要公开或受到保护?

c++ private public copy-constructor

6
推荐指数
2
解决办法
1952
查看次数

'rails new'创建`validate_default_type!':选项的默认值必须与其类型匹配.(ArgumentError)错误

我正在尝试创建一个新的Ruby on Rails应用程序.每次我输入rails new后,我都会收到此错误

/usr/local/lib/ruby/gems/2.2.0/gems/thor-0.19.2/lib/thor/parser/option.rb:130:in `validate_default_type!': An option's default must match its type. (ArgumentError)
    from /usr/local/lib/ruby/gems/2.2.0/gems/thor-0.19.2/lib/thor/parser/option.rb:113:in `validate!'
    from /usr/local/lib/ruby/gems/2.2.0/gems/thor-0.19.2/lib/thor/parser/argument.rb:24:in `initialize'
    from /usr/local/lib/ruby/gems/2.2.0/gems/thor-0.19.2/lib/thor/parser/option.rb:9:in `initialize'
    from /usr/local/lib/ruby/gems/2.2.0/gems/thor-0.19.2/lib/thor/base.rb:544:in `new'
    from /usr/local/lib/ruby/gems/2.2.0/gems/thor-0.19.2/lib/thor/base.rb:544:in `build_option'
    from /usr/local/lib/ruby/gems/2.2.0/gems/thor-0.19.2/lib/thor/base.rb:278:in `class_option'
    from /usr/local/lib/ruby/gems/2.2.0/gems/railties-4.2.5/lib/rails/generators/base.rb:202:in `class_option'
    from /usr/local/lib/ruby/gems/2.2.0/gems/railties-4.2.5/lib/rails/generators/app_base.rb:71:in `add_shared_options_for'
    from /usr/local/lib/ruby/gems/2.2.0/gems/railties-4.2.5/lib/rails/generators/rails/app/app_generator.rb:160:in `<class:AppGenerator>'
    from /usr/local/lib/ruby/gems/2.2.0/gems/railties-4.2.5/lib/rails/generators/rails/app/app_generator.rb:159:in `<module:Generators>'
    from /usr/local/lib/ruby/gems/2.2.0/gems/railties-4.2.5/lib/rails/generators/rails/app/app_generator.rb:153:in `<module:Rails>'
    from /usr/local/lib/ruby/gems/2.2.0/gems/railties-4.2.5/lib/rails/generators/rails/app/app_generator.rb:3:in `<top (required)>'
    from /usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
    from /usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
    from /usr/local/lib/ruby/gems/2.2.0/gems/railties-4.2.5/lib/rails/commands/application.rb:2:in `<top (required)>'
    from /usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
    from /usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
    from /usr/local/lib/ruby/gems/2.2.0/gems/railties-4.2.5/lib/rails/cli.rb:14:in `<top (required)>'
    from /usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
    from /usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
    from …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails thor

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