小编Alb*_*ban的帖子

如何知道D3.js中的当前缩放级别

几天后我有一个问题.我有一个图表,当我使用缩放行为它工作,但我需要知道何时达到最大缩放以加载新的给定

// Specifies the zoom scale's allowed range, [min, max]
d3.behavior.zoom().x(x).scaleExtent([1,10]).on("zoom", draw)
Run Code Online (Sandbox Code Playgroud)

看我的代码 http://jsfiddle.net/albanlopez/D4MRP/

javascript events graph zoom d3.js

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

如何减少庞大的excel文件

我在*.XLS中只有一个小而简单的文件,只有一张表,在这张表上只有许多单元格上有小文本的单元格.(文件大小24Kb)

但我做了很多改动,复制和粘贴,扩展公式,保存...之后我删除了大部分这些更改,并使用少量数据制作了4张重复的表格.

现在我的新文件非常庞大:2.5Mb!

隐藏数据在哪里?如何删除它?

我在真实文件上遇到同样的问题,每张300张和1张图片:文件大小280Mb

size excel vba file

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

如何着色Format-Table的PowerShell输出

如果值大于100 MB,我尝试将列RAM着色为红色:

Get-Process | Format-Table @{ Label = "PID"; Expression={$_.Id}},
            @{ Label = "Name"; Expression={$_.Name}},
            @{ Label = "RAM (MB)"; Expression={[System.Math]::Round($_.WS/1MB, 1)}},
            @{ Label = "Responding"; Expression={$_.Responding}}
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

我尝试使用Write-Host -nonewline,但结果是错误的.

Get-Process | Format-Table @{ Label = "PID"; Expression={$_.Id}},
            @{ Label = "Name"; Expression={$_.Name}},
            @{ Label = "RAM (MB)"; Expression={write-host -NoNewline $([System.Math]::Round($_.WS/1MB, 1)) -ForegroundColor red}},
            @{ Label = "Responding"; Expression={ write-host -NoNewline $_.Responding -fore red}}
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

console powershell colors

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

如何运行参数名称可变的powershell命令

我需要对一个属性及其值运行相同的命令Get-QadUserSet-QadUser但我的属性是一个变量。

我的代码(设置不起作用!):

$property = 'MobilePhone' # OK
$value = ($User | get-QadUser -IncludedProperties $property).$property # OK
$user | Set-QadUser -$PropertyName $NewValue # NOK
Run Code Online (Sandbox Code Playgroud)

syntax powershell

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

如何在vba函数中返回array()以在单元格中使用它数组公式(matricial formula):用于多单元格中的split texte

我正在VBA中编写一个函数以在excel公式中使用,如果我的函数返回一个值,则可以:

=MYVALUE(A1)
Run Code Online (Sandbox Code Playgroud)

现在我写了另一个返回数组(1,2,3,4,...)的函数,我用Array公式替换了我的excel公式:

{=MYARRAY(A1)}
Run Code Online (Sandbox Code Playgroud)

但是当我拉伸公式时,所有单元格都会显示我的数组第一个值.为什么?

这是我的VBA源代码(complement.xlam):

Function MYVALUE(x as integer)
    MYVALUE = 123
End Eunction

Function MYARRAY(x as integer)
    MYARRAY = Array(10,20,30)
End Eunction
Run Code Online (Sandbox Code Playgroud)

arrays excel vba split excel-vba excel-formula

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

如何在powershell中的excel.Worksheet中添加VBA代码?

我需要Private Sub **Worksheet_BeforeDoubleClick** (ByVal Target As Range, Cancel As Boolean)在我的表格中包含一个(1).

我能够正确地打开和写入单元格,但我不知道如何将VBA代码放在工作表中(而不是在VBA模块中).

$excel = New-Object -ComObject Excel.Application
$workbook = $excel.Workbooks.Add()
$worksheet = $workbook.WorkSheets.item(1)
$worksheet.range("c1","g6").value = "str"
...
$workbook.SaveAs($xlFlie, 50)
$Excel.Application.Quit()
Run Code Online (Sandbox Code Playgroud)

我试过这个:

$xlmodule = $workbook.VBProject.VBComponents.Add()
$xlmodule.CodeModule.AddFromString($code)
Run Code Online (Sandbox Code Playgroud)

但我得到了这个错误:

Can not call a method in an expression Null.
Au caractère .\Build-ADGrpsMembers2Excel.ps1:273 : 5
+     $xlmodule = $workbook.VBProject.VBComponents.Add(1)
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation : (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Run Code Online (Sandbox Code Playgroud)

excel powershell vba excel-vba

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

如何使用属性和方法创建[PsCustomObject]

我尝试使用这样的自定义方法定义对象,但是我的语法错误:

$Obj = [pscustomobject]@{
    A = @(5,6,7)
    B = 9
    Len_A = {return $this.A.count;}
    Sum_A = {return (SumOf $this.A);}
}
Run Code Online (Sandbox Code Playgroud)

使用方式如下:

$Obj.Len_A()       # return 3
$Obj.A += @(8,9)   # @(5,6,7,8,9)
$Obj.Len_A()       # return 5
Run Code Online (Sandbox Code Playgroud)

methods powershell object

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

d3.json()失败,但jQuery $ .getJSON()使用相同的URL和PHP代码正常工作

我使用d3.js和CodeIgniter,当我运行此代码时,当我使用d3.json获取json数据时,我遇到了问题:

var url = "http://probe.dev/draw/windRose?station=vp2&sensors=wind&Since=2012-10-15T00:00:00&StepUnit=DAY&StepNbr=6;
d3.json(url, function(d) {
    console.log(d); // print NULL in console
}
Run Code Online (Sandbox Code Playgroud)

但它适用于

$.getJSON(url, function(d) {
    console.log(d); // print my data object correctly
}
Run Code Online (Sandbox Code Playgroud)

我的PHP代码是:

<?php
@ob_end_clean();
 header('Content-Type: "application/json"');
 header('Content-Disposition: attachment; filename="data.json"');
 header("Content-Transfer-Encoding: binary");
 header('Expires: 0');
 header('Pragma: no-cache');
 header("Content-Length: ".strlen($data));
  exit($data);
Run Code Online (Sandbox Code Playgroud)

我不明白为什么d3.json不起作用?

php json get download d3.js

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