走过海棠暮

文章 评论 浏览 25

走过海棠暮 2024-08-18 21:46:36

顺便说一句:我通过编码解决了这个问题:

eval("var jsonobject=" + obj_json);

现在它可以工作了!现在我可以写:

for(ii in jsonobject){
    var intii = parseInt(ii);
    if (!isNaN(intii)){
        var street = jsonobject[ii].street;
        alert(street)
    }
}

Btw: I fixed this Problem by coding:

eval("var jsonobject=" + obj_json);

now it works! Now I can write:

for(ii in jsonobject){
    var intii = parseInt(ii);
    if (!isNaN(intii)){
        var street = jsonobject[ii].street;
        alert(street)
    }
}

json 错误:“元素列表后缺少 ]”或者只是“未定义”

走过海棠暮 2024-08-18 17:50:43

这根本不被认为是一件坏事。事实上,C# 维护者已经开始使用 var 关键字来减少繁琐的样板文件,其中

MyContainer<MyType> cont = new MyContainer<MyType>();

完全等同于

var cont = new MyContainer<MyType>();

尽管您会看到很多人会反对 < code>var 用法,这表明很多人不熟悉具有类型推断的强类型语言;类型推断被误认为是动态/软类型。

It isn't considered a bad thing at all. In fact, C# maintainers are already moving a bit towards reducing the tiring boilerplate with the var keyword, where

MyContainer<MyType> cont = new MyContainer<MyType>();

is exactly equivalent to

var cont = new MyContainer<MyType>();

Although you will see many people who will argue against var usage, which kind of shows that many people is not familiar with strong typed languages with type inference; type inference is mistaken for dynamic/soft typing.

为什么 DRY 对于类型声明不被认为是一件好事?

走过海棠暮 2024-08-18 11:37:33

正确的答案是您不......您让单元测试的工具为您完成工作:

// return '' if host invalid --
private function setHostname($host = '')
{
    $ret = (!empty($host)) ? $host : '';
    if(filter_var('http://'.$ret.'/', FILTER_VALIDATE_URL) === false) {
        $ret = '';
    }
    return $ret;
}

进一步阅读:https://www.w3schools.com/php/filter_validate_url.asp

The correct answer is that you don't ... you let a unit tested tool do the work for you:

// return '' if host invalid --
private function setHostname($host = '')
{
    $ret = (!empty($host)) ? $host : '';
    if(filter_var('http://'.$ret.'/', FILTER_VALIDATE_URL) === false) {
        $ret = '';
    }
    return $ret;
}

further reading :https://www.w3schools.com/php/filter_validate_url.asp

如何在 PHP 中验证域名?

走过海棠暮 2024-08-18 09:14:07

由于 LTI 滤波器的系数是时域脉冲响应,因此您可以通过指定振幅向量和相位向量在 matlab 中创建频率响应,然后对它们进行反向 FFT 以获得系数,例如,类似 A = [ 1 .9 .8 .5 .2 .1 0]theta=[0 0 0 0 0 0 0],然后 H=A.*exp (j*theta) 然后 coefs = ifft(H)

Since the Coefficients to a LTI filter are the time domain impulse response, you could create the frequency response in matlab by specifying an Amplitude vector, and and Phase Vector, then Inverse FFT them to get your coefficients, for example, soemthing like A = [ 1 .9 .8 .5 .2 .1 0], theta=[0 0 0 0 0 0 0], then H=A.*exp(j*theta) then coefs = ifft(H)

如何使用 Matlab 制作简单的 FIR 滤波器?

走过海棠暮 2024-08-18 09:12:51

九年了,仍然没有关于 float、double、long double最小大小的直接答案。


C 中的类型有保证的最小大小吗?

对于浮点类型...

实用的角度来看,float最小大小为32位double64 位。 C 允许 doublelong double 具有相似的特征,因此 long double 可以和 double 一样小:示例1或80位或128位或者...

我可以想象一个符合 C 标准的 48 位 double 可能已经存在 - 但不知道有什么。


现在,让我们想象一下,我们富有的叔叔去世了,给我们留下了一笔财富,用于支付www.smallest_C_float.com的开发和文化推广。

C 指定:

  1. float 有限范围至少为 [1E-37…1E+37]。请参阅FLT_MIN、FLT_MAX

  2. (1.0f + FLT_EPSILON) – 1.0f <= 1E-5

  3. float 支持正值和负值。

    设 X:数字 1-9
    设 Y:数字 0-9
    令E:值-37到36
    设 S:+ 或 -
    设b:0或1

我们的 float 可以使用以 10 为基数的 SX.YYYYY*10^E 最低限度地表示所有组合。

还需要 0.0±1E+37(另外 3 个)。我们不需要 -0.0、次正常值、±无穷大或非数字。

即 2*9*105*74 + 3 个组合或 133,200,003,至少需要 27 位进行编码 - 不知何故。回想一下,目标是最小尺寸。

使用经典的基数为 2 的方法,我们可以假设隐含的 1 并得到
S1.bbbb_bbbb_bbbb_bbbb_b*2e 或 2*217*226 组合或 26 位。

如果我们尝试以 16 为基数,则需要大约 2*15*16(4 或 5)*57 个组合或至少 26 到 30 位。

结论:AC float 至少需要 26 位编码。


C 的double 不需要表达比float 更大的指数范围,它仅具有不同的最小精度要求。 1E-9

S1.bbbb_bbbb_bbbb_bbbb_ bbbb_ bbbb_ bbbb_bb*2e --> 2*230*226 组合或 39 位。


在我们的想象一下计算机上,我们可以有一个 13 位 char,因此可以对 float、double、long double 进行编码,而无需填充。这样我们就可以实现一个非填充的26位float和39位double, long double


1Microsoft Visual C++ for x86,它使 long double double 的同义词


[编辑] 2020

额外的 double 要求可能需要 41 位。可能必须使用 42 位 double 和 28 位 float。需要复查。叔叔会不高兴的。

Nine years and still no direct answer about the minimum size for float, double, long double.


Any guaranteed minimum sizes for types in C?

For floating point type ...

From a practical point-of-view, float minimum size is 32-bits and double is 64- bits. C allows double and long double to share similar characteristics, so a long double could be as small as a double: Example1 or 80-bit or 128-bit or ...

I could imagine a C compliant 48-bit double may have existed – yet do not know of any.


Now, let us imagine our rich uncle dies and left us a fortune to pay for the development and cultural promotion for www.smallest_C_float.com.

C specifies:

  1. float finite range is at least [1E-37… 1E+37]. See FLT_MIN, FLT_MAX

  2. (1.0f + FLT_EPSILON) – 1.0f <= 1E-5.

  3. float supports positive and negative values.

    Let X: Digit 1-9
    Let Y: Digit 0-9
    Let E: value -37 to 36
    Let S: + or -
    Let b: 0 or 1

Our float could minimally represent all the combinations, using base 10, of SX.YYYYY*10^E.

0.0 and ±1E+37 are also needed (3 more). We do not need -0.0, sub-normals, ±infinity nor not-a-numbers.

That is 2*9*105*74 + 3 combinations or 133,200,003 which needs at least 27 bits to encode - somehow. Recall the goal is minimal size.

With a classic base 2 approach, we can assume an implied 1 and get
S1.bbbb_bbbb_bbbb_bbbb_b*2e or 2*217*226 combinations or 26 bits.

If we try base 16, we then need about 2*15*16(4 or 5)*57 combinations or at least 26 to 30 bits.

Conclusion: A C float needs at least 26 bits of encoding.


A C’s double need not express a greater exponential range than float, it only has a different minimal precision requirement. 1E-9.

S1.bbbb_bbbb_bbbb_bbbb_ bbbb_ bbbb_ bbbb_bb*2e --> 2*230*226 combinations or 39 bits.


On our imagine-if-you-will computer, we could have a 13-bit char and so encode float, double, long double without padding. Thus we can realize a non-padded 26-bit float and 39-bit double, long double.


1: Microsoft Visual C++ for x86, which makes long double a synonym for double


[Edit] 2020

Additional double requirements may require 41 bits. May have to use 42-bit double and 28-bit float. Will need to review. Uncle will not be happy.

C 中的类型有保证最小尺寸吗?

走过海棠暮 2024-08-18 07:52:46

如果你有一个指向字符串的指针,

"            string with leading spaces"
 ^ pointer

只需移动它......

"            string with leading spaces"
             ^ pointer

例如:

#include <ctype.h>
/* ... */
char mystring[] = "            string with leading spaces";
char *pointer = mystring;
while (*pointer && isspace((unsigned char)*pointer)) ++pointer;
/* pointer now points to a (possibly empty) string with no leading spaces */

If you have a pointer to the string

"            string with leading spaces"
 ^ pointer

just move it ...

"            string with leading spaces"
             ^ pointer

for example:

#include <ctype.h>
/* ... */
char mystring[] = "            string with leading spaces";
char *pointer = mystring;
while (*pointer && isspace((unsigned char)*pointer)) ++pointer;
/* pointer now points to a (possibly empty) string with no leading spaces */

如何在 C 中将空格和制表符替换为空?

走过海棠暮 2024-08-18 05:35:48

是的。 operator&&operator|| 的重载版本不会短路 - 即使左侧操作数“确定”结果,它们也会评估两个操作数。 (来源

话虽这么说,不要重载 operator&&operator||。善待维护程序员,他们会查看 &&|| 并假设它们发生了短路。

Yes. The overloaded versions of operator&& and operator|| do not short-circuit — they evaluate both operands even if the left-hand operand "determines" the outcome... (Source)

That being said, don't overload operator&& or operator||. Be nice to your maintenance programmers who will look at && or || and assume that they do short circuit.

是否存在非短路逻辑“与”?在 C++ 中?

走过海棠暮 2024-08-18 04:55:14

除非你用 做一些棘手的事情代理认证&审核您将只能登录该应用程序。否则,我会按处理器进行许可。

Unless you do something tricky with proxy authentication & auditing you will only have a login for the application. Otherwise, I would license by processor.

SQL Server - 我“真正”需要多少用户?

走过海棠暮 2024-08-18 04:25:30

这是另一个想法(实际上是我们如何解决配置问题)。也许这更适合您的需求。

我们的配置文件也相当大,但唯一真正改变的是配置字符串。

我们为每个配置都有一个文件,其中包含特定的配置字符串(用于开发的数据库、用于构建的数据库、用于 QA 的数据库)。这些文件如下所示:

<templates>
  <template key="db" value="development server connection string"/>
  <template .../>
</templates>

这些文件以它们使用的环境命名(devel.xml、build.xml、qa.xml

在配置文件中,连接字符串被占位符替换( ${db})。

我们为每个环境(开发、构建、质量保证)提供了构建配置。构建此类配置时,构建后事件会将配置文件中的占位符替换为模板文件中存储的值。这将为每个环境生成正确的配置文件。

这个想法取自使用预构建事件管理多个配置文件环境,但扩展为模板替换。

Here is another idea (actually how we solve our config problem). Maybe this fits your needs better.

Our config files are rather big too but the only thing that really changes are the configuration strings.

We have a file for each configuration which contains the specific configuration string (database for development, database for build, database for QA). The files looks like this:

<templates>
  <template key="db" value="development server connection string"/>
  <template .../>
</templates>

These files are named after the environment they are used in (devel.xml, build.xml, qa.xml)

In the configuration files the connection strings are replaced by place holders (${db}).

We have build configurations for each environment (devel, build, qa). When building such a configuration a post build event replaces the place holders in the config files with the values stored in the template files. This generates the correct config files for each environment.

The idea is taken from Managing Multiple Configuration File Environments with Pre-Build Events but extended with the template replacement.

多个应用程序共享相同的配置文件

走过海棠暮 2024-08-17 18:26:39

不确定您是问 2 个问题还是仅问 1 个问题,即将整个类别复制为新类别(即复制类别)还是将现有类别重新分配给新的父类别 - 每个问题/解决方案都不同,但是让我们从复制整个类别开始。

首先,如果您使用基于身份的列,则在不使用“set Identity_insert on”选项的情况下,唯一的方法是将光标从根节点开始遍历整个树并向下工作(即插入顶级类别,获取新创建的标识值,插入第二级类别等)。如果您处于可以使用“set Identity_insert on”的场景,或者可以用显式数字替换身份的使用,那么您可以利用下面的代码。

在此代码中,您会注意到使用了 CTE、< a href="http://msdn.microsoft.com/en-us/library/ms186243.aspx" rel="nofollow noreferrer">递归 CTE 和 排名函数,因此假定 Sql 2005 或更高版本。此外,lvl、path 和 cnt 列仅出于演示目的而包含,您可以根据需要查看,但在任何最终解决方案中都不需要:

declare @root_category_id bigint,
        @start_new_id_value bigint;

-- What category id do we want to move?
select  @root_category_id = 3;
-- Get the current max id and pad a bit...
select  @start_new_id_value = max(categoryId)
from    Category;
select  @start_new_id_value = coalesce(@start_new_id_value,0) + 100;

-- Show our values
select  @root_category_id, @start_new_id_value;

begin tran;
set identity_insert Category on;

-- This query will give you the entire category tree
with subs (catId, parentCatId, catName, lvl, path, new_id, new_parent_id, cnt) as (
    -- Anchor member returns a row for the input manager
    select  catId, parentCatId, catName, 0 as lvl,
            cast(cast(catId as varchar(10)) as varchar(max)) as path,
            @start_new_id_value + row_number() over(order by catId) - 1 as new_id, 
            cast(parentCatId as bigint) as new_parent_id, 
            count(*) over(partition by 0) as cnt
    from    Category
    where   catId = @root_category_id

    union all

    -- recursive member returns next level of children
    select  c.catId, c.parentCatId, c.catName, p.lvl + 1,
            cast(p.path + '.' + cast(catId as varchar(10)) as varchar(max)),
            p.cnt + row_number() over(order by c.catId) + p.new_id - 1 as new_id,
            p.new_id as new_parent_id,
            count(*) over(partition by p.lvl) as cnt
    from    subs as p -- Parent
    join    Category as c -- Child
    on      c.parentCatId = p.catId
)
-- Perform the insert
insert  Category 
        (categoryId, Name, parentCategoryId)
select  s.catId, s.catName, s.parentCatId
from    subs s
--order by path;

set identity_insert Category off;
commit tran;

Not sure if you're asking 2 questions or just 1, i.e. replicating an entire category as a new category (i.e. copying a category) vs. re-assigning an existing category to a new parent - each would be different problems/solutions, but let's start with copying an entire category.

First, if you're using an identity-based column, the ONLY way you can do it without using the "set identity_insert on" option would be to cursor through the entire tree, starting from the root nodes and working down (i.e. insert the top-level category(ies), get the newly created identity values, insert the second-level categories, etc.). If you are in a scenario where you can make use of "set identity_insert on", or if you can replace the use of identities with explicit numbers, then you can leverage the code below.

In this code, you'll notice the use of CTE's, recursive CTE's, and ranking functions, so this assumes Sql 2005 or above. Also, the lvl, path, and cnt columns are simply included for demo purposes you can use to view if you like, not required in any final solution:

declare @root_category_id bigint,
        @start_new_id_value bigint;

-- What category id do we want to move?
select  @root_category_id = 3;
-- Get the current max id and pad a bit...
select  @start_new_id_value = max(categoryId)
from    Category;
select  @start_new_id_value = coalesce(@start_new_id_value,0) + 100;

-- Show our values
select  @root_category_id, @start_new_id_value;

begin tran;
set identity_insert Category on;

-- This query will give you the entire category tree
with subs (catId, parentCatId, catName, lvl, path, new_id, new_parent_id, cnt) as (
    -- Anchor member returns a row for the input manager
    select  catId, parentCatId, catName, 0 as lvl,
            cast(cast(catId as varchar(10)) as varchar(max)) as path,
            @start_new_id_value + row_number() over(order by catId) - 1 as new_id, 
            cast(parentCatId as bigint) as new_parent_id, 
            count(*) over(partition by 0) as cnt
    from    Category
    where   catId = @root_category_id

    union all

    -- recursive member returns next level of children
    select  c.catId, c.parentCatId, c.catName, p.lvl + 1,
            cast(p.path + '.' + cast(catId as varchar(10)) as varchar(max)),
            p.cnt + row_number() over(order by c.catId) + p.new_id - 1 as new_id,
            p.new_id as new_parent_id,
            count(*) over(partition by p.lvl) as cnt
    from    subs as p -- Parent
    join    Category as c -- Child
    on      c.parentCatId = p.catId
)
-- Perform the insert
insert  Category 
        (categoryId, Name, parentCategoryId)
select  s.catId, s.catName, s.parentCatId
from    subs s
--order by path;

set identity_insert Category off;
commit tran;

SQL - 循环 - 复制类别

走过海棠暮 2024-08-17 17:02:56
var pages=["[www.google.co.uk] This is the WWW. ","[www.yahoo.co.uk] This is also the WWW. ";

function findScoresC(s){ 
  var scores=[];
  var words=[];
  s=s.toLowerCase();
  for(i=0;i<pages.length; i++)
  {
     scores[i]=0;
     var lowerCaseContents=(pages[i].substring(pages[i].indexOf("]")+1,pages[i].lastIndexOf(" "))).toLowerCase();
     words=lowerCaseContents.split(" ");
     for(j=0;j<words.length;j++)
     {
        if(words[j].match(s))
        {
          scores[i] += 1;
        }
      }
  }
  return scores;
}
alert(findScoresC("w"));

有几件事。我将内部索引的“i”替换为“j”。右括号后不需要加分号。说明后应该有一个分号(缺少几个分号)。

可能主要问题(在“i”问题之后)是分数[i]应该设置在内循环之外。如果将 cosing 括号分成单独的行,而不是像“scores[i] =indexScore[i]}};”,这会更清楚。

事实证明,变量 indexScore 不是必需的。这使我可以将 scores[i] 引入内部循环以直接累积单词点击量。

最后,我更愿意将 pages 变量作为参数传递给函数,而不是假设它在全局空间中可用。如果可以的话,我倾向于避免全局变量。

var pages = [...];
function findScoresC(pages, s)
{
   ...
}
alert(findScoresC(pages, "w"));
var pages=["[www.google.co.uk] This is the WWW. ","[www.yahoo.co.uk] This is also the WWW. ";

function findScoresC(s){ 
  var scores=[];
  var words=[];
  s=s.toLowerCase();
  for(i=0;i<pages.length; i++)
  {
     scores[i]=0;
     var lowerCaseContents=(pages[i].substring(pages[i].indexOf("]")+1,pages[i].lastIndexOf(" "))).toLowerCase();
     words=lowerCaseContents.split(" ");
     for(j=0;j<words.length;j++)
     {
        if(words[j].match(s))
        {
          scores[i] += 1;
        }
      }
  }
  return scores;
}
alert(findScoresC("w"));

There were a few things. I replaced "i" with "j" for the inner index. You don't require a semicolon after a closing paren. You should have a semicolon after instructions (a couple were missing).

Probably the main issue (after the "i" issue) was that scores[i] should have been set outside the inner loop. This would have been clearer if the cosing parens had been separated out onto separate lines, instead of like "scores[i] =indexScore[i]}};".

It turned out that the variable indexScore was not required. That allowed me to bring scores[i] inside the inner loop to accumulate word hits directly.

Finally, I would prefer to communicate the pages variable to the function as an argument than to assume that it is available in the global space. I tend to avoid globals if I can.

var pages = [...];
function findScoresC(pages, s)
{
   ...
}
alert(findScoresC(pages, "w"));

谁能看出我的 Javascript 有什么问题吗?

走过海棠暮 2024-08-17 16:46:54

我知道这是一个老问题(从 2009 年开始),但我想补充一下,以防有人在 Liferay 6 中遇到同样的问题。

实际上,您只需进入部署目录就可以非常轻松地开​​发主题:
/deploy/

进入其中后,查找默认的 seven-cogs-theme.war 文件夹。我最初所做的是复制和复制将该文件夹粘贴到我的桌面(或任何开发位置)进行编辑。我使用 Notepad++ 修改了 XML 文件以反映我的主题名称(以及重命名目录)。

然后,您可以将主题修改为您认为合适的方式(速度模板/CSS/图像/JavaScript 包含/等)。

您可以在 Liferay 6 上开发主题 LIVE(F5 刷新并查看更改),您必须设置门户以启用开发人员模式(禁用 js 最小化器/CSS 缓存/最小化器/图像缓存/等)。

您可以通过搜索找到其中的每一个部分(门户的开发人员模式等;)。

总的来说,您可以使用 Liferay 来根据自己的喜好进行修改。

我目前正在使用 Liferay 和 Coldfusion 9 进行 portlet 开发。希望对某人有帮助。

I know this is an old question (from 2009) but I wanted to add in case someone is struggling with the same thing in Liferay 6.

You can actually develop a theme very easily by just going into the deploy directory:
/deploy/

Once in there, look for the default seven-cogs-theme.war folder. What I did was initially copy & paste that folder to my desktop (or any dev location) to edit. I modified the XML files using Notepad++ to reflect my theme name (as well as renaming the directory).

You can then modify the theme to how you see fit (velocity templates / css / images / javascript includes / etc).

You can develop the theme LIVE on Liferay 6 (F5 to refresh and view changes), you would have to setup your portal to enable developer mode (disables js minimizer / css caching / minizers / image caching / etc).

Each of those pieces you can find by doing a search (developer mode for portal etc;).

Overall you can work with Liferay to modify things to your liking.

I am currently using Liferay with Coldfusion 9 for portlet development. Hope that helps someone.

从 Liferay 开始,对如何开始有点不知所措

走过海棠暮 2024-08-17 07:39:16

在本地测试时,iis7 往往会向您显示一般错误消息,除非您向 httpErrors 添加属性 errorMode="Custom"。您需要编辑C:\Windows\System32\inetsrv\config\applicationHost.config以允许这样做。

When testing locally, iis7 will tend to show you a generic error message unless you add an attribute to httpErrors, errorMode="Custom". You'll need to edit C:\Windows\System32\inetsrv\config\applicationHost.config to allow this.

IIS7 上 ASP.net 站点的自定义 404 页面,用于非 asp.net URL

走过海棠暮 2024-08-17 07:10:10

jQuery 是一个 JavaScript 库,其目的是使一些浏览器脚本任务变得更容易。它不是 JavaScript 的替代品。不要试图将它用于所有事情。

另外,在链接中使用 onclick 比使用 javascript: 伪协议更好,并且您应该为链接提供真实的 URL,以便用户在使用 JavaScript 时进行操作关闭:

<a href="non_js_alternative.html" onclick="abc(1, 2, 3);">click here to check value of abc </a>

jQuery is a JavaScript library whose purpose is to make some browser scripting tasks easier. It is not a replacement for JavaScript. Don't try to use it for everything.

Also, using onclick is preferable to using the javascript: pseudo-protocol in a link, and you should provide a real URL for the link to take the user when they have JavaScript turned off:

<a href="non_js_alternative.html" onclick="abc(1, 2, 3);">click here to check value of abc </a>

我怎样才能用jquery编写下面的程序

走过海棠暮 2024-08-17 03:35:53

为了创建一个“点”,您使用“椭圆形”形状,即一个小圆圈,您可以将线条和填充颜色设置为相同,即

Sub DoDot()

    'create a circular shape    
    ActiveWindow.Selection.SlideRange.Shapes.AddShape(msoShapeOval, 144.5, 150.88, 11.38, 11.38).Select

    With ActiveWindow.Selection.ShapeRange

        ' color it
        .Line.ForeColor.SchemeColor = ppAccent1
        .Line.Visible = msoTrue
        .Fill.ForeColor.SchemeColor = ppAccent1
        .Fill.Visible = msoTrue
        .Fill.Solid

        ' move it
        .Top = 10
        .Left = 10

    End With
End Sub

我在这里使用了SchemeColor属性来为形状着色,您当然可以使用以及明确的 RGB 颜色。

稍后,如果您想用线连接点,您将需要移动点并
(重新)在它们之间创建线条,或者使用点状线条末端类型

Sub LineWithEndType()
    ActiveWindow.Selection.SlideRange.Shapes.AddLine(195.62, 162.25, 439.38, 309.75).Select
    With ActiveWindow.Selection.ShapeRange
        .Line.Visible = msoTrue
        .Fill.Transparency = 0#
        .Line.BeginArrowheadStyle = msoArrowheadOval
        .Line.EndArrowheadStyle = msoArrowheadOval
        .Line.BeginArrowheadLength = msoArrowheadLong
        .Line.BeginArrowheadWidth = msoArrowheadWide
        .Line.EndArrowheadLength = msoArrowheadLong
        .Line.EndArrowheadWidth = msoArrowheadWide
    End With

End Sub

希望有帮助
祝你好运麦克D

in order to create a "dot" you use the "oval" shape, i.e. a small circle, where you can set line and fill colors to the same, i.e.

Sub DoDot()

    'create a circular shape    
    ActiveWindow.Selection.SlideRange.Shapes.AddShape(msoShapeOval, 144.5, 150.88, 11.38, 11.38).Select

    With ActiveWindow.Selection.ShapeRange

        ' color it
        .Line.ForeColor.SchemeColor = ppAccent1
        .Line.Visible = msoTrue
        .Fill.ForeColor.SchemeColor = ppAccent1
        .Fill.Visible = msoTrue
        .Fill.Solid

        ' move it
        .Top = 10
        .Left = 10

    End With
End Sub

I used the SchemeColor property here to color the shape, you can of course use an explicit RGB color as well.

Later on, if you want to connect dots with lines, you will need to either move the dots and
(re)create lines in between them, or you use dot-shaped line end types

Sub LineWithEndType()
    ActiveWindow.Selection.SlideRange.Shapes.AddLine(195.62, 162.25, 439.38, 309.75).Select
    With ActiveWindow.Selection.ShapeRange
        .Line.Visible = msoTrue
        .Fill.Transparency = 0#
        .Line.BeginArrowheadStyle = msoArrowheadOval
        .Line.EndArrowheadStyle = msoArrowheadOval
        .Line.BeginArrowheadLength = msoArrowheadLong
        .Line.BeginArrowheadWidth = msoArrowheadWide
        .Line.EndArrowheadLength = msoArrowheadLong
        .Line.EndArrowheadWidth = msoArrowheadWide
    End With

End Sub

Hope that helps
Good luck MikeD

如何在 Power Point VBA 中创建点,将它们向不同方向移动,同时保持它们与直线连接?

我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文