走过海棠暮

文章 评论 浏览 25

走过海棠暮 2024-10-05 02:46:53
using System.Xml.Schema;
using System.IO;
using System.Reflection;

这应该可以工作,可能会引发一些错误,因为我没有在 IDE 中编译它,因为我不在开发机器 atm 上。

string xsd = "example.xsd";

FileStream fs;
XmlSchema schema;

fs = new FileStream(xsd, FileMode.Open);
schema = XmlSchema.Read(fs, new ValidationEventHandler(ShowCompileError));

foreach (XmlSchemaObject externalSchema in schema.Includes)
{
    string schemaLoc = (XmlSchemaExternal)externalSchema.SchemaLocation.ToString();
}
using System.Xml.Schema;
using System.IO;
using System.Reflection;

This should work, might throw some errors, as I didnt compile it in an IDE as im not on a Dev machine atm.

string xsd = "example.xsd";

FileStream fs;
XmlSchema schema;

fs = new FileStream(xsd, FileMode.Open);
schema = XmlSchema.Read(fs, new ValidationEventHandler(ShowCompileError));

foreach (XmlSchemaObject externalSchema in schema.Includes)
{
    string schemaLoc = (XmlSchemaExternal)externalSchema.SchemaLocation.ToString();
}

在 C# XmlSchema 中查找 schemaLocation

走过海棠暮 2024-10-05 02:18:20

要按月排序,请使用以下命令:

  ORDER BY DATEPART(Month,Created) ASC

DatePart() 返回指定部分的整数,1 表示一月,2 表示二月等。


您的 SQL 可以使用 COALESCE() 和 ISNULL( ) 函数。这与您的第一个选择相同:

SELECT
    COALESCE(tmpActivity.Year,tmpCreated.Year,tmpContactsCreated.Year) as Year, 
    COALESCE(tmpActivity.Month,tmpCreated.Month,tmpContactsCreated.Month) as Month,
    ISNULL(tmpActivity.ActiveAccounts,0) AS ActiveAccounts, 
    ISNULL(tmpCreated.NewAccounts,0) AS NewAccounts, 
    ISNULL(tmpContactsCreated.NewContacts,0) AS NewContacts

我认为您的选择中有一个错误,我相信您的最后一行必须是这样的:

) as tmpContactsCreated ON (tmpContactsCreated.Year = tmpCreated.Year AND tmpContactsCreated.Month = tmpCreated.Month) OR
                           (tmpContactsCreated.Year = tmpActivity.Year AND tmpContactsCreated.Month = tmpActivity.Month)     

但我必须对此进行测试以确定。


添加汇总很难做到——通常这是在控件中的 SQL 或任何显示结果的外部完成的。您可以这样做(人为的示例):

SELECT 1 as reportOrder, date, amount, null as total
FROM invoices
UNION ALL
SELECT 2 , null, null, sum(amount)
FROM invoices
ORDER BY reportOrder, date

或者您不能拥有“额外”总计列并将其放入金额列中。

To order by the month use the following:

  ORDER BY DATEPART(Month,Created) ASC

DatePart() returns an integer for the part specified 1 for January, 2 for Febuary etc.


You're SQL could be helped with the COALESCE() and ISNULL() functions. This is the same as your first select:

SELECT
    COALESCE(tmpActivity.Year,tmpCreated.Year,tmpContactsCreated.Year) as Year, 
    COALESCE(tmpActivity.Month,tmpCreated.Month,tmpContactsCreated.Month) as Month,
    ISNULL(tmpActivity.ActiveAccounts,0) AS ActiveAccounts, 
    ISNULL(tmpCreated.NewAccounts,0) AS NewAccounts, 
    ISNULL(tmpContactsCreated.NewContacts,0) AS NewContacts

I think there is a bug in your select, I believe your last line has to be this:

) as tmpContactsCreated ON (tmpContactsCreated.Year = tmpCreated.Year AND tmpContactsCreated.Month = tmpCreated.Month) OR
                           (tmpContactsCreated.Year = tmpActivity.Year AND tmpContactsCreated.Month = tmpActivity.Month)     

But I would have to test this to be sure.


Adding in rollups is hard to do -- typically this is done externally to the SQL in the control or whatever displays the results. You could do something like this (contrived example):

SELECT 1 as reportOrder, date, amount, null as total
FROM invoices
UNION ALL
SELECT 2 , null, null, sum(amount)
FROM invoices
ORDER BY reportOrder, date

or you could not have the "extra" total column and put it in the amount column.

关于我的 SQL 脚本的两个问题。如何添加小计/总计行以及排序问题

走过海棠暮 2024-10-05 00:11:02

我发现了问题。如果您没有唯一的元素名称,XML 解串器似乎会感到困惑。

I found the problem. It's seems that the xml deseraliser gets confused if you don't have unique element names.

可能的 xml 反序列化错误

走过海棠暮 2024-10-04 14:01:37

这对我来说适用于 Ubuntu 10.04。我只看到有关“标题”与“宝丽来”效果一起使用的文档。

#!/usr/bin/perl

use strict;
use warnings;
use Image::Magick;

my $im = new Image::Magick;
$im->Set(size => '586x1000');

my $e = $im->ReadImage('xc:black');

$im->Polaroid(
        fill => 'white',
        stroke => 'black',
        strokewidth => 3,
        gravity => 'center',
        pointsize => 78,
        caption => "Lorem ipsum etc etc"
);

$e = $im->Trim();
die $e if $e;

$e = $im->Set(page=>'0x0+0+0'); # +repage
die $e if $e;

$e = $im->Write('out.png');
die $e if $e;

替代文字

This works on Ubuntu 10.04 for me. I only see documentation for "caption" working with the "polaroid" effect.

#!/usr/bin/perl

use strict;
use warnings;
use Image::Magick;

my $im = new Image::Magick;
$im->Set(size => '586x1000');

my $e = $im->ReadImage('xc:black');

$im->Polaroid(
        fill => 'white',
        stroke => 'black',
        strokewidth => 3,
        gravity => 'center',
        pointsize => 78,
        caption => "Lorem ipsum etc etc"
);

$e = $im->Trim();
die $e if $e;

$e = $im->Set(page=>'0x0+0+0'); # +repage
die $e if $e;

$e = $im->Write('out.png');
die $e if $e;

alt text

如何在 PerlMagick 中将字幕居中?

走过海棠暮 2024-10-04 10:07:43

在您的管理仪表板上的“设置”->“永久链接,您可以为永久链接选择自定义结构,我相信这就是您正在寻找的。

On your admin dashboard, under Settings -> Permalinks, you can choose a custom structure for permalinks, I believe this is what you're looking for.

更改页面的 WordPress 永久链接结构

走过海棠暮 2024-10-04 08:45:17

使用 Boost.Thread 条件变量< /a> 如此处所示。随附的文章对 Boost.Thread 功能进行了很好的总结。

使用进程间信号量是可行的,但由于使用了不必要的重量级底层操作系统锁定原语(例如,Windows 中的命名内核对象),因此可能会给您的执行带来负担。

Use Boost.Thread condition variables as shown here. The accompanying article has a good summary of Boost.Thread features.

Using interprocess semaphores will work but it's likely to place a tax on your execution due to use of unnecessarily heavyweight underlying OS locking primitives (named kernel objects in Windows, for example).

在单个多线程 c++ 中使用 boost::interprocess::interprocess_semaphore 是否有缺点?过程?

走过海棠暮 2024-10-04 08:18:01

为了性能而“缓存”计算值是一个很好的做法,否则它将在每个循环中进行计算(如内部循环的位置):

DateTime tomorrow = DateTime.Today.AddDays(1);
DateTime now = DateTime.Now;
DateTime next24hrs = now.AddHours(24);
IEnumerable<Sample> next24HoursSamples = collection.Where(sample=>sample.expires>now && sample.expires<next24hrs).ToList();
IEnumerable<Sample> sameDaySamples = next24HoursSamples.Where(sample=>sample.expires>=now && sample.expires<tomorrow).ToList();

请注意,sameDay 列表是从已过滤的列表中检索的(same day 是接下来的 24 小时),因此需要过滤的项目较少。

编辑:我更新了代码以使用立即查询执行模型,因为 @danijels 警告延迟执行。

It's a good practice to "cache" the calculated values for performance, otherwise it would be calculated in each loop(as Where does a loop internally):

DateTime tomorrow = DateTime.Today.AddDays(1);
DateTime now = DateTime.Now;
DateTime next24hrs = now.AddHours(24);
IEnumerable<Sample> next24HoursSamples = collection.Where(sample=>sample.expires>now && sample.expires<next24hrs).ToList();
IEnumerable<Sample> sameDaySamples = next24HoursSamples.Where(sample=>sample.expires>=now && sample.expires<tomorrow).ToList();

Notice that the sameDay list is retrieved from the already filtered list(same day is a subset of the next 24 hours),so there are less items to filter on.

EDIT: I updated the code to use an immediate query execution model, as @danijels warns about deferred execution.

LINQ DateTimeOffset 与今天的比较

走过海棠暮 2024-10-04 06:27:22

尝试将 Form 的 DoubleBuffered 属性设置为 true。

Try to set the DoubleBuffered property of the Form to true.

如何在表格上画一个覆盖整个工作区域的圆?

走过海棠暮 2024-10-04 06:01:08
  1. 在设置端口下将硬件流控制设置为会对您有所帮助。(minicom -s;转到串行端口设置 >; 最后两行是硬件和软件流控制;只需设置NO)
  2. 打开echo(ctrl + A后打开minicom,然后按E)检查您是否发送了一些东西也是个好主意。
  1. Set Hardware Flow Control to No under setting port will help you.(minicom -s; go to Serial Port Setup; last two lines are Hardware and Software Flow control; just set NO both)
  2. Turn on echo (ctrl + A after turn on minicom, then press E) to check whether you send something is good idea too.

无法使用 minicom 发送字符

走过海棠暮 2024-10-04 05:09:23

其他两个选项:

  1. 一个 JS 文件,其中包含整个站点的所有 JS。根据您的缓存设置,您应该能够让用户为整个站点仅下载一个文件,并为每个其他页面使用缓存版本。
  2. 根据功能而不是页面划分 JS,并包含每个页面所需的任何功能。例如,一个页面可能需要选项卡、表单验证和动画,而另一页面可能只需要选项卡。

或者,您可以混合使用这些文件:一个包含绝大多数代码的 JS 文件和一个额外的文件(如果特定页面或模板需要)。

所提到的方法都没有错误(尽管我会尽可能跳过内联 JS 方法);哪一种最好取决于您的具体情况和您的个人喜好。

Two other options:

  1. A single JS file that contains all the JS for your entire site. Depending on your caching settings, you should be able to get the user to download just one file for the entire site and use a cached version for every other page.
  2. Divide your JS up according to function, rather than page, and include whatever functionality each page requires. E.g. one page may require tabs, form validation and animation, while another may only require tabs.

Or you can have a hybrid of these: one JS file that contains the vast majority of your code and an extra file if needed for particular pages or templates.

None of the approaches mentioned are wrong (though I'd skip the inline JS one as much as possible); which one is best will depend on your precise situation and your personal preferences.

我应该如何将一些 javascript 集成到 php 应用程序中?

走过海棠暮 2024-10-04 03:11:43

是的,一切都是正确的,但我通常将 targetalt 属性与链接一起使用。

alt="_LITTLE_DESCRIPTION_" 当页面出现问题且图片无法加载时显示。

target="_blank" 始终在新选项卡中打开链接。这样您就可以让访问者在您的页面上停留更长时间。

<a href="_YOUR_LINK_"><img style="border:0;" src="_YOUR_PICTURE_LINK_" alt="_LITTLE_DESCRIPTION_" target="_blank" height="15" width="80"/></a>

Yes all is correct but I usually use target and alt attributes with link.

alt="_LITTLE_DESCRIPTION_" Shows up when something wrong and picture don't load in page.

target="_blank" Always open links in new tab. So you can keep visitors in your page longer.

<a href="_YOUR_LINK_"><img style="border:0;" src="_YOUR_PICTURE_LINK_" alt="_LITTLE_DESCRIPTION_" target="_blank" height="15" width="80"/></a>

Blogspot 在侧面板中添加带有链接的图像

走过海棠暮 2024-10-03 16:48:53

我不确定这是否足够,但是您可以启动解释器并执行以下操作

>>> dir(__builtins__)
['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 'BufferError', 'BytesWarning', 'DeprecationWarning', 'EOFError', 'Ellipsis', 'EnvironmentError', 'Exception', 'False', 'FloatingPointError', 'FutureWarning', 'GeneratorExit', 'IOError', 'ImportError', 'ImportWarning', 'IndentationError', 'IndexError', 'KeyError', 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'NameError', 'None', 'NotImplemented', 'NotImplementedError', 'OSError', 'OverflowError', 'PendingDeprecationWarning', 'ReferenceError', 'RuntimeError', 'RuntimeWarning', 'StandardError', 'StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit', 'TabError', 'True', 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError', 'UnicodeEncodeError', 'UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserWarning', 'ValueError', 'Warning', 'ZeroDivisionError', '_', '__debug__', '__doc__', '__import__', '__name__', '__package__', 'abs', 'all', 'any', 'apply', 'basestring', 'bin', 'bool', 'buffer', 'bytearray', 'bytes', 'callable', 'chr', 'classmethod', 'cmp', 'coerce', 'compile', 'complex', 'copyright', 'credits', 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'execfile', 'exit', 'file', 'filter', 'float', 'format', 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id', 'input', 'int', 'intern', 'isinstance', 'issubclass', 'iter', 'len', 'license', 'list', 'locals', 'long', 'map', 'max', 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property', 'quit', 'range', 'raw_input', 'reduce', 'reload', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'unichr', 'unicode', 'vars', 'xrange', 'zip']

您可以看到 dir 值

>>> dir()
['__builtins__', '__doc__', '__name__', '__package__', 'atexit']

并且从模块中,您可以将内置导入为模块

I am not sure if this suffices, but you can fire up the interpreter and do the following

>>> dir(__builtins__)
['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 'BufferError', 'BytesWarning', 'DeprecationWarning', 'EOFError', 'Ellipsis', 'EnvironmentError', 'Exception', 'False', 'FloatingPointError', 'FutureWarning', 'GeneratorExit', 'IOError', 'ImportError', 'ImportWarning', 'IndentationError', 'IndexError', 'KeyError', 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'NameError', 'None', 'NotImplemented', 'NotImplementedError', 'OSError', 'OverflowError', 'PendingDeprecationWarning', 'ReferenceError', 'RuntimeError', 'RuntimeWarning', 'StandardError', 'StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit', 'TabError', 'True', 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError', 'UnicodeEncodeError', 'UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserWarning', 'ValueError', 'Warning', 'ZeroDivisionError', '_', '__debug__', '__doc__', '__import__', '__name__', '__package__', 'abs', 'all', 'any', 'apply', 'basestring', 'bin', 'bool', 'buffer', 'bytearray', 'bytes', 'callable', 'chr', 'classmethod', 'cmp', 'coerce', 'compile', 'complex', 'copyright', 'credits', 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'execfile', 'exit', 'file', 'filter', 'float', 'format', 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id', 'input', 'int', 'intern', 'isinstance', 'issubclass', 'iter', 'len', 'license', 'list', 'locals', 'long', 'map', 'max', 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property', 'quit', 'range', 'raw_input', 'reduce', 'reload', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'unichr', 'unicode', 'vars', 'xrange', 'zip']

And you can see the dir value

>>> dir()
['__builtins__', '__doc__', '__name__', '__package__', 'atexit']

And from the modules, you can import builtin as module

python:检索所有内置函数的名称

走过海棠暮 2024-10-03 16:43:11

如果使用导入库调用 DLL,那么它会先查找当前目录,然后再查找 PATH。

但是,您不需要那样称呼它。您可以自己使用 LoadLibrary() 和 GetProcAddress(),然后做任何您想做的事情。如果您仅使用 dll 名称调用 LoadLibrary,它会使用与导入库相同的算法(当前目录 + 路径)——如果您传递完整路径,它将使用它。

COM 使用此技术根据注册表中 DLL 的完整路径来加载 DLL——您也可以在没有 COM 的情况下执行此操作。

除了 PATH 之外,您还可以通过其他方式搜索它 - 您可以不带路径进行调用,看看是否找到它,然后尝试注册表,然后在其他地方查找(每个驱动器的程序文件目录等)。

基本上,如果你自己调用LoadLibrary和GetProcAddress,你就可以做任何你想做的事情。

If you call the DLL using an import library, then it looks in the current directory, and then in the PATH.

But, you don't need to call it that way. You can use LoadLibrary() and GetProcAddress() yourself and then do whatever you want. If you call LoadLibrary with just the dll name, it uses the same algorithm as with the import library (current dir + PATH) -- if you pass a full path, it will use it.

COM uses this technique to load a DLL based on a full path to the DLL which is in the registry -- you could do this too without COM.

You could search for it in some other way besides the PATH -- you could call with no path, see if it finds it, and then try the registry, and then look elsewhere (every drive's program files directory, etc).

Basically, if you call LoadLibrary and GetProcAddress yourself, you can do whatever you want.

有没有比修改 %PATH% 更好的方法来使 dll 可在系统上使用?

走过海棠暮 2024-10-03 12:02:45

您无法在控制台应用程序中打开文件日志。

你说我有按钮,所以这一定是Win应用程序,使用

openFileDialog1.ShowDialog();失踪了

private void button3_Click(object sender, EventArgs e)
        {
           OpenFileDialog OpenFileDialog1 = new OpenFileDialog();

            openFileDialog1.Filter = " XML Files|*.xml";

            openFileDialog1.InitialDirectory = @"D:\";

            openFileDialog1.ShowDialog();

            // Get file name and use OpenFileDialog1.FileName or something like that

       }

You cant open file fialog in console app.

You say I have button, so this must be Win app, use

openFileDialog1.ShowDialog(); is missing

private void button3_Click(object sender, EventArgs e)
        {
           OpenFileDialog OpenFileDialog1 = new OpenFileDialog();

            openFileDialog1.Filter = " XML Files|*.xml";

            openFileDialog1.InitialDirectory = @"D:\";

            openFileDialog1.ShowDialog();

            // Get file name and use OpenFileDialog1.FileName or something like that

       }

OpenfileDialog - 窗口未弹出

更多

推荐作者

屌丝范

文章 0 评论 0

lcx_

文章 0 评论 0

予囚

文章 0 评论 0

朦胧时间

文章 0 评论 0

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