小编Chi*_*ani的帖子

在ruby中创建哈希数组

我想在ruby中创建一个哈希数组:

 arr[0]
     "name": abc
     "mobile_num" :9898989898
     "email" :abc@xyz.com

 arr[1]
     "name": xyz
     "mobile_num" :9698989898
     "email" :abcd@xyz.com
Run Code Online (Sandbox Code Playgroud)

我见过哈希数组文档.在我发现的所有内容中,我必须做类似的事情

c = {}
c["name"] = "abc"
c["mobile_num"] = 9898989898
c["email"] = "abc@xyz.com"

arr << c
Run Code Online (Sandbox Code Playgroud)

循环中的上述语句中的迭代允许我填充arr.我实际上像一行一样排空["abc",9898989898,"abc@xyz.com"].有没有更好的方法来做到这一点?

ruby arrays hashmap

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

如何使用 Edge 浏览器在 VSCode 中调试 Angular 应用程序?

我正在使用Edge 扩展。以下是配置launch.json

"configurations": [
    {
      "name": "ng serve",
      "type": "edge",
      "request": "launch",
      "url": "http://localhost:4200/",
      "webRoot": "${workspaceFolder}",
      "sourceMaps": true
    }]
Run Code Online (Sandbox Code Playgroud)

根据VS Code 中的文档,这里有更详细的步骤:

  1. npm install -g @angular/cli, ng new my-app
  2. 安装边缘扩展
  3. 重新加载项目
  4. 启动
  5. 转到 Debug 视图 ( Ctrl+ Shift+ D) 并单击齿轮按钮以创建 launch.json 调试器配置文件。从“选择环境”下拉列表中选择 Chrome。使用上面 launch.json 中显示的代码更新配置。
  6. 在 app.component.ts 中设置断点
  7. F5- 它现在应该命中断点。但是在断点悬停时收到消息 - “未验证的断点”。断点没有被击中。

我尝试清除所有断点,重新启动 vs 代码(和机器),关闭所有浏览器实例,但仍然得到相同的行为。调试器能够在浏览器中启动 angular 应用程序,但无法命中断点。

那么,是否有任何其他配置可以使其与 Edge 浏览器一起使用。当前配置适用于 chrome 浏览器(只需在 launch.json 中用 chrome 替换 edge)。

debugging visual-studio-code microsoft-edge angular vscode-debugger

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

在Ruby on Rails中压缩资产3

我在production.rb中有以下配置

 # Disable Rails's static asset server (Apache or nginx will already do this)
  config.serve_static_assets = false

  # Compress JavaScripts and CSS
  config.assets.compress = true

  # Choose the compressors to use
  config.assets.js_compressor  = :uglifier
  config.assets.css_compressor = :yui

  # Don't fallback to assets pipeline if a precompiled asset is missed
  config.assets.compile = true

  # Generate digests for assets URLs.
  config.assets.digest = true
Run Code Online (Sandbox Code Playgroud)

但是当生产服务器上的ruby on rails应用程序出现以下错误:

Error compiling CSS asset

LoadError: cannot load such file -- yui-compressor
Run Code Online (Sandbox Code Playgroud)

在评论线上LoadError: cannot load such …

ruby-on-rails yui-compressor sprockets asset-pipeline

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

用 'bar' 重命名包含子字符串 'foo' 的文件

我想重命名包含子字符串 ' foo' 的所有文件,并bar在给定文件夹中将其替换为 ' '。我怎样才能做到这一点?

更新:

for i in ./*foo*; do mv "$i" "${i//foo/bar}";done 
Run Code Online (Sandbox Code Playgroud)

作品!!!

regex unix linux shell command-line

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

如何在 UWP XAML/C# 中通过滚动查看器更改滚动量?

我正在使用 ListView 来显示一些项目,比如高度为 100。如果有很多项目,垂直滚动条将通过 ScrollViewer 属性显示。然而,当用户滚动列表时,它有时会滚动一半屏幕,因此只需滚动一下,它就会覆盖整个列表视图。

我想要一些代码来设置滚动量,比如当时的 100 高度。我尝试搜索文档但找不到任何内容。实际上,数据来自绑定,项目的数量各不相同,但每个项目都有固定的高度是可以的。

示例代码:

<ListView Name="lvSummaryList" ScrollViewer.VerticalScrollMode="Enabled"
                                              ScrollViewer.IsVerticalRailEnabled="True"
                                              VerticalAlignment="Bottom"
                                              SelectionMode="None"                                          ScrollViewer.VerticalScrollBarVisibility="Auto"   
                                              ScrollViewer.HorizontalScrollMode="Disabled"              ScrollViewer.IsVerticalScrollChainingEnabled="True"
                                              Margin="0,5,10,0"
                                              MaxHeight="600" >
                <ListView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <ItemsWrapGrid Orientation="Horizontal" GroupPadding="1"  Margin="1" MinHeight="100" MaxHeight="200" MaximumRowsOrColumns="4" VerticalAlignment="Center"/>
                    </ItemsPanelTemplate>
                </ListView.ItemsPanel>
 </ListView>
Run Code Online (Sandbox Code Playgroud)

我该如何实现这一点,是否有属性甚至可以覆盖当前行为?

c# scrollviewer uwp uwp-xaml

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