我知道我可以在我的个人资料中创建代表文件夹路径的变量.例如,
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
Run Code Online (Sandbox Code Playgroud)
有一种简单的方法可以在PowerShell中为目录创建别名吗?
创建别名
PS> Create-FolderAlias -name $foo -path "C:\Program Files"
Run Code Online (Sandbox Code Playgroud)
根据其他别名创建别名
PS> Create-FolderAlias -name $bar -path $foo + "\Microsoft"
Run Code Online (Sandbox Code Playgroud)
按预期使用别名
PS> cd $foo
Run Code Online (Sandbox Code Playgroud)
如果在会话之间保留这些别名会很好.
这个Graphviz代码:
digraph models_diagram {
graph[rankdir=LR, overlap=false, splines=true]
struct1 [shape=record, label="Table 0|<f0> ID: integer|<f1> TABLE_1_ID: integer"]
struct2 [shape=record, label="Table 1|<f0> ID: integer|<f1> NAME: string"]
struct2:f0 -> struct1:f1;
}
Run Code Online (Sandbox Code Playgroud)
将创建此 ERD:

我想对每个矩形的标题(例如“表1”)应用特殊格式(例如背景颜色;字体粗细)。
我考虑过将一个形状嵌入到另一个形状中,然后我可以设置style=filled, color=lightgrey其中一个形状,但我无法让语法起作用。
这可能吗?
有没有办法使用Read-Hostcmdlet 捕获多行?
我目前的方法有点尴尬(并且实际上不起作用):
PS> Send-MailMessage -SmtpServer 'smtp.domain.xxx' -From 'First Last <flast@domain.xxx>' -To 'First Last <first.last@company.com>' -Subject 'Testing' -Body (Read-Host 'Enter text')
Enter text: line one `n line two `n line three
Run Code Online (Sandbox Code Playgroud)
生成的电子邮件正文不是三行:
line one `n line two `n line three
我在SQL Server中创建了一个内联表值函数(ITVF),它返回一个值表(为了讨论的目的简化了查询):
CREATE FUNCTION dbo.VehicleRepairStatus()
RETURNS TABLE
AS
RETURN
SELECT VehicleID, CurrentStatus
FROM VehicleRepairHistory
...
Run Code Online (Sandbox Code Playgroud)
我可以在查询中引用:
SELECT
v.ID, v.Name,
r.CurrentStatus
FROM
Vehicle v
LEFT OUTER JOIN
dbo.VehicleRepairStatus() r on v.ID = r.VehicleID
Run Code Online (Sandbox Code Playgroud)
我希望能够在Linq查询中使用它:
var vehicles = await _databaseContext.Vehicles
.Join() // join ITVF here?
.Where(v => v.Type == 'Bus' )
.OrderBy(v => v.Name)
.ToAsyncList();
Run Code Online (Sandbox Code Playgroud)
在某些时候,我可能会更改ITVF以包含一个参数:
CREATE FUNCTION dbo.VehicleRepairStatus(@id AS INT)
RETURNS TABLE
AS
RETURN
SELECT VehicleID, CurrentStatus
FROM VehicleRepairHistory
...
WHERE VehicleID = @id
Run Code Online (Sandbox Code Playgroud)
并称之为标量:
SELECT v.ID, v.Name
,(SELECT val FROM …Run Code Online (Sandbox Code Playgroud) c# linq entity-framework-core asp.net-core-2.0 entity-framework-core-2.1
我已经开发了4个子报告的水晶报告.子报告的数据量取决于报告的需求.当我在细节块中放入那些子报告时,它会根据数据量相互重叠.当我把它们放在单独的页面标题中时,通过添加更多的章节,它会在每个页面中重复,因为报告有多个页面.如何克服这个问题?版本Crystal Report 8.5
从CLI运行AsciiDoctor会创建一个带有嵌入式样式表的HTML文档:
$ asciidoctor mysample.adoc
....
<title>My First Experience with the Dangers of Documentation</title>
<style>
/* Asciidoctor default stylesheet | MIT License | http://asciidoctor.org */
article, aside, details, figcaption, figure, footer, header, hgroup, main, nav, section, summary { display: block; }
...
Run Code Online (Sandbox Code Playgroud)
但是,在Ruby文件中运行Asciidoctor不会:
r.rb:
#!/usr/bin/env ruby
require 'asciidoctor'
Asciidoctor.render_file('mysample.adoc', :in_place => true)
$ ./r.rb
...
<title>My First Experience with the Dangers of Documentation</title>
<link rel="stylesheet" href="./asciidoctor.css">
...
Run Code Online (Sandbox Code Playgroud)
该文件并不表示应该有任何区别.我错过了什么?
细节:
我有两个模型有has_one关系:
class Entity < ActiveRecord::Base
has_one :location, as: :locatable, dependent: :destroy
accepts_nested_attributes_for :location, allow_destroy: true
...
default_scope {joins(:location).includes(:location)}
...
# has a properties 'name' and 'url'
end
class Location < ActiveRecord::Base
belongs_to :locatable, polymorphic: true
# has a property named 'address'
end
Run Code Online (Sandbox Code Playgroud)
我注意到通过表单更改模型的name或url属性Entity将导致关联的Location记录被删除然后插入。这是一个不太理想的行动。
** 编辑 **
在进一步的测试中,我注意到这些设置与 SQL 策略无关:
polymorphic 加入allow_destroy: truedependent: :destroy- 除了在Locations表中留下孤立记录default_scope问题:
Entity属性的更改会导致对Location模型的更改?DELETE/ INSERT …我试图在面板标题的右侧嵌入一个搜索表单:
<div class="panel-heading">
<h3 class="panel-title">Results <span class="badge">6</span></h3>
<form class="form-inline pull-right" role="search" method="get" action="/tbl">
<div class="form-group">
<input type="text" name="criteria" class="form-control" value="<%= params[:criteria] if params[:criteria] %>" placeholder="<%= params[:criteria]? params[:criteria] : 'Enter search criteria (e.g. FOOBAR_%)' %>">
<div class="input-group-btn">
<button class="btn btn-primary"><i class="glyphicon glyphicon-search"></i></button>
</div>
</div>
</form>
</div>
Run Code Online (Sandbox Code Playgroud)
不幸的是,我遇到了对齐问题:
在Safari(8.0.3)中:

在Firefox(35.0.1)中:

有没有办法做到这一点,最好没有自定义CSS?
我希望创建一个参数,其默认值是'当前目录'(.).
例如,Path参数Get-ChildItem:
PS> Get-Help Get-ChildItem -Full
Run Code Online (Sandbox Code Playgroud)
-Path指定一个或多个位置的路径.允许使用通配符.默认位置是当前目录(.).
Run Code Online (Sandbox Code Playgroud)Required? false Position? 1 Default value Current directory Accept pipeline input? true (ByValue, ByPropertyName) Accept wildcard characters? true
我创建了一个带有Path参数的函数,该参数接受来自管道的输入,默认值为.:
<#
.SYNOPSIS
Does something with paths supplied via pipeline.
.PARAMETER Path
Specifies a path to one or more locations. Wildcards are permitted. The default location is the current directory (.).
#>
Function Invoke-PipelineTest {
[cmdletbinding()]
param(
[Parameter(Mandatory=$False,ValueFromPipeline=$True,ValueFromPipelinebyPropertyName=$True)]
[string[]]$Path='.'
)
BEGIN {}
PROCESS {
$Path …Run Code Online (Sandbox Code Playgroud) 我想根据变量将单个数组转换为一组较小的数组。所以,0,1,2,3,4,5,6,7,8,9将成为0,1,2,3,4,5,6,7,8,9当大小为3。
我目前的做法:
$ids=@(0,1,2,3,4,5,6,7,8,9)
$size=3
0..[math]::Round($ids.count/$size) | % {
# slice first elements
$x = $ids[0..($size-1)]
# redefine array w/ remaining values
$ids = $ids[$size..$ids.Length]
# return elements (as an array, which isn't happening)
$x
} | % { "IDS: $($_ -Join ",")" }
Run Code Online (Sandbox Code Playgroud)
产生:
IDS: 0
IDS: 1
IDS: 2
IDS: 3
IDS: 4
IDS: 5
IDS: 6
IDS: 7
IDS: 8
IDS: 9
Run Code Online (Sandbox Code Playgroud)
我希望它是:
IDS: 0,1,2
IDS: 3,4,5
IDS: …Run Code Online (Sandbox Code Playgroud) powershell ×4
css ×2
arrays ×1
asciidoctor ×1
c# ×1
graphviz ×1
linq ×1
report ×1
ruby ×1
ruby-2.0 ×1