我正在Embarcadero Delphi 2010中编写一个简单的应用程序.一个包含两个周期的简单代码:
procedure TForm1.Button1Click(Sender: TObject);
var
a:array [0..255] of integer;
i:integer;
k,q:integer;
begin
k:=0;
for I := 0 to 255 do
begin
a[i]:=i;
end;
for I := 0 to 255 do
begin
q:= a[i];
k:=k+q;
end;
Label1.Caption:=inttostr(k);
end;
Run Code Online (Sandbox Code Playgroud)
根据监视列表,在第二个循环变量"i"从值256开始并且转到0(256,255,254,...,0),但是数组的元素是正确的(0,1,2,3,... ).变量"i"仅在本地声明,没有全局变量.为什么会这样?这是正常的行为吗?
我正在尝试使用由 ASP.NET Core 托管的 Blazor WebAssembly。实现一个页面后,我在 Chrome DevTools 中看到许多不必要的 dll 被传输到客户端。有一个情况的例子。假设解决方案中有以下项目结构:
BlazorApp.Client (contains Blazor pages)
Reference to BlazorApp.Shared
BlazorApp.Server (contains ASP.NET core)
Reference to BlazorApp.Client
Reference to BlazorApp.Shared
BlazorApp.Shared (contains shared classes)
Reference to ClassLibrary
ClassLibrary (contains some more shared classes)
NuGet reference to AWSSDK.Core
MyEnum.cs (enum, which is used in Blazor page; not using AWS SDK)
Run Code Online (Sandbox Code Playgroud)
所以基本上BlazorApp.Shared项目引用了其他一些项目,其中可能有很多 nuget 包。重现该问题的最低代码可在仓库https://github.com/GTmAster/blazor-treeshake中找到
我的假设是 Mono Linker 在发布版本中进行树摇动,因此所有未使用的代码和库都将从生成的 Web 程序集中排除。但是当我运行我的应用程序时,我看到它AWSSDK.Core.dll从服务器加载:
in 中的代码BlazorApp.Client没有使用它,以及 inBlazorApp.Server和 in 中的代码 …
我的任务是使用Helix Toolkit可视化标量的3D字段。输入数组包含双精度值,没有限制,但通常在[-50000,+50000]之间。标量值影响多维数据集的颜色:最小值具有蓝色,0-白色,最大值-红色。所有其他颜色值均与该值进行插值。
现在,我正在尝试了解HelixToolkit.Wpf.SharpDX中的颜色转移贴图如何工作。为此,我创建了一个2x2x1标量的简单字段。
MainWindow.xaml
<hx:Viewport3DX
Name="view1"
Grid.Row="1"
BackgroundColor="SkyBlue"
Camera="{Binding Camera}"
EffectsManager="{Binding EffectsManager}"
EnableDesignModeRendering="True"
UseDefaultGestures="False"
CameraRotationMode="Trackball">
<hx:Viewport3DX.InputBindings>
<KeyBinding Key="B" Command="hx:ViewportCommands.BackView" />
<KeyBinding Key="F" Command="hx:ViewportCommands.FrontView" />
<KeyBinding Key="U" Command="hx:ViewportCommands.TopView" />
<KeyBinding Key="D" Command="hx:ViewportCommands.BottomView" />
<KeyBinding Key="L" Command="hx:ViewportCommands.LeftView" />
<KeyBinding Key="R" Command="hx:ViewportCommands.RightView" />
<KeyBinding Command="hx:ViewportCommands.ZoomExtents" Gesture="Control+E" />
<MouseBinding Command="hx:ViewportCommands.Rotate" Gesture="RightClick" />
<MouseBinding Command="hx:ViewportCommands.Zoom" Gesture="MiddleClick" />
<MouseBinding Command="hx:ViewportCommands.Pan" Gesture="LeftClick" />
</hx:Viewport3DX.InputBindings>
<hx:VolumeTextureModel3D VolumeMaterial="{Binding VolumeMaterial}" />
</hx:Viewport3DX>
Run Code Online (Sandbox Code Playgroud)
MainWindowViewModel.cs
public MainWindowViewModel()
{
Nx = 2;
Ny = 2;
Nz = 1;
var m = new VolumeTextureDiffuseMaterial(); …Run Code Online (Sandbox Code Playgroud) 我正在尝试在连接到 VPN 的同时在 Windows 上使用 Docker。
当 VPN 未连接时,一切正常。
但是当我使用 Cisco AnyConnect 客户端连接到我们的公司 VPN 时,docker 容器内的网络不再工作:
docker run alpine ping www.google.com
ping: bad address 'www.google.com'
docker run alpine ping -c 5 216.58.204.36
PING 216.58.204.36 (216.58.204.36): 56 data bytes
--- 216.58.204.36 ping statistics ---
5 packets transmitted, 0 packets received, 100% packet loss
Run Code Online (Sandbox Code Playgroud)
如何解决此问题并使其正常工作?
我的设置是:
我正在尝试使用angular-cli(来自ng2-book的"Nested Routes")在Angular2中创建带子路径的简单应用程序.我有两个模块:
app.module
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AppComponent } from './app.component';
import { ProductsComponent } from './products/products.component';
import { ProductsComponentModule, routes as childRoutes } from './products/products.module'
import { HomeComponent } from './home/home.component';
const routes: Routes = [
{ path: '', redirectTo: 'home', pathMatch: 'full' },
{ path: 'home', component: HomeComponent },
{ path: 'products', component: ProductsComponent, children: …Run Code Online (Sandbox Code Playgroud)