半城柳色半声笛

文章 评论 浏览 26

半城柳色半声笛 2024-12-04 13:34:10

如果不是插件,那么至少如何获取它,甚至尝试自己编写它。

使用 jQuery UI,您可以创建可拖动元素。您还可以创建可放置元素

尝试使用表格和表格单元格来搞乱这些演示,看看您自己能走多远。如果您陷入了困境,请回来,一旦您有了一些代码,也许有人可以帮助您!

If not a plugin, then at least how to get to it and even try to write it myself.

Using jQuery UI you can create draggable elements. You can also create droppable elements.

Try messing around with those demos using a table and table cells and see how far you can get by yourself. If you hit a dead-end, come back and someone may be able to help you out once you have some code!

用于表格单元格替换的 jQuery 插件

半城柳色半声笛 2024-12-03 23:00:53

我使用了与 Omu 发布的读取来自 XML 的 ExpandoObject 相同的方法。由于所有属性都以“字符串”形式出现,因此我使用“Convert.ChangeType”方法稍微调整了@Omu的答案:

public class FromExpando : KnownSourceValueInjection<ExpandoObject>
{
    protected override void Inject(ExpandoObject source, object target)
    {
        var d = source as IDictionary<string, object>;
        if (d == null) return;
        var tprops = target.GetProps();

        foreach (var o in d)
        {
            var tp = tprops.GetByName(o.Key);
            if (tp == null) continue;

            var newValue = Convert.ChangeType(o.Value, tp.PropertyType); 

            tp.SetValue(target, newValue);
        }
    }
}

I have used the same approach as Omu posted reading from a ExpandoObject that comes from a XML. As all the properties comes in as ´string´, so I have tweaked @Omu's answer a little using the ´Convert.ChangeType´ method:

public class FromExpando : KnownSourceValueInjection<ExpandoObject>
{
    protected override void Inject(ExpandoObject source, object target)
    {
        var d = source as IDictionary<string, object>;
        if (d == null) return;
        var tprops = target.GetProps();

        foreach (var o in d)
        {
            var tp = tprops.GetByName(o.Key);
            if (tp == null) continue;

            var newValue = Convert.ChangeType(o.Value, tp.PropertyType); 

            tp.SetValue(target, newValue);
        }
    }
}

使用 ValueInjecter 从 ExpandoObject 注入

半城柳色半声笛 2024-12-03 18:46:46

为了获得正确的 XML,您可以使用 API 测试工具 。您还可以选择要使用的 API 版本。只需选择您想要进行的调用,您就会获得 XML。该文档通常已经过时。

In order to get the correct XML you can use the API test tool. You can also choose which API version you would like to use. Just choose the call you want to make, and you will get the XML. The documentation is often outdated.

PHP eBay API GeteBayOfficialTime 调用返回“不支持的 API 调用”错误

半城柳色半声笛 2024-12-03 18:22:25

我认为,如果类成员的排序可以提高代码的可读性,那么它很有用。排序方案不应该太严格,但要足够严格以提高代码的可读性。我更喜欢这种排序方案:

  • 静态字段
  • 实例字段
  • 构造函数
  • 方法

每个调用另一个方法(大部分是私有的)的方法,被调用的方法应该位于调用方法的下面。

正如上面所指出的,对类成员进行排序的唯一原因应该是更好的可读性,因为您编写一次代码,但会阅读一百次,因此拥有一个(团队)接受的排序系统可以提高生产力。

订购代码来解决 RCS 的缺陷本身不会带来更好的可读性,因此不会提高生产力。在大多数情况下,这样的排序方法会失败。我怀疑字母顺序方法是否可以带来更好的可读性。

I consider sorting of class members useful if it results in better readability of code. A sorting scheme should not be too strict but strict enough to add to better code readability. I prefer this sorting scheme:

  • static fields
  • instance fields
  • constructor
  • methods

Each method that calls another method (mostly private) the called method should be below the calling method.

As pointed out above the only reason to order class members should be better readability because you write code once but read it a hundred times, so having an accepted (by the team) order system can boost productivity.

Ordering code to work around inabilities of RCS will not per se lead to better readability and thus will not boost productivity. In most cases such an ordering method will fail. I'm in doubt if an alphabetic order method could lead to better readability.

班级成员应该排序吗?

半城柳色半声笛 2024-12-03 11:57:41

单击图像时,您可以使用事件对象找到用户单击的坐标。

$("imageSelector").click(function(e){
  var pos = $(this).position();
  //The following are the x/y coordinates of the mouse click relative to image.
  var x = e.pageX - pos.left;
  var y = e.pageY - pos.top;
});

On image click you can find the coordinates where the user clicked using the event object.

$("imageSelector").click(function(e){
  var pos = $(this).position();
  //The following are the x/y coordinates of the mouse click relative to image.
  var x = e.pageX - pos.left;
  var y = e.pageY - pos.top;
});

获取用户点击的图像部分

半城柳色半声笛 2024-12-03 04:54:08

我正在尝试 iPhone 开发,并购买了 Dave Mark 和 Jeff LaMarche 编写的《Beginning iPhone Development》(ISBN13:978-1-4302-1626-1),并且很享受阅读这些章节的过程。我有 Win32 Delphi 背景和一点 .NET,所以 Objective C 对我来说非常陌生。

其中一章是关于 OpenGL 和 Quartz 的,您可能会感兴趣。我还没有做到这一点,所以我无法真正评论它对你自己有多大用处,但写作风格非常容易理解,而且节奏很好(无论如何对我来说)。

最初的章节通过对 Xcode 和 InterfaceBuilder 的良好介绍准确地解释了如何开始运行。

I'm having a play with iPhone development for a bit of fun and bought Beginning iPhone Development by Dave Mark and Jeff LaMarche (ISBN13: 978-1-4302-1626-1) and am enjoying working through the chapters. I have a Win32 Delphi background with a bit of .NET and so Objective C is very new to me.

One of the chapters is on OpenGL and Quartz which may be of interest to you. I've haven't got that far yet so I can't really comment on how useful it will be for yourself but the writing style is very accessible and it's paced well (for me anyway).

The initial chapters explain exactly how to get up an running with a good introduction to Xcode and InterfaceBuilder.

想要在 iPhone 上显示 3D 模型:如何开始?

半城柳色半声笛 2024-12-02 23:55:19

创建该类型的对象,并调用该对象的方法

Dim ha As New HostAnalytics.HostAnalyzer.HostAnalyzer()  'Edit, need New
result = ha.setSubstituteVarMDXType(cubeid, strDimCode, strMdxFormula)

Make an object of that type, and invoke the method on that

Dim ha As New HostAnalytics.HostAnalyzer.HostAnalyzer()  'Edit, need New
result = ha.setSubstituteVarMDXType(cubeid, strDimCode, strMdxFormula)

无法解决错误“对非共享成员的引用需要对象引用”。 vb.net”

半城柳色半声笛 2024-12-02 12:29:20

这段代码应该适合您:

 $PHPExcel->getActiveSheet()
        ->getStyle('A1')
        ->getFill()
        ->setFillType(PHPExcel_Style_Fill::FILL_SOLID)
        ->getStartColor()
        ->setRGB('FF0000')

但是如果您一次又一次地使用它,我建议使用 applyFromArray

This code should work for you:

 $PHPExcel->getActiveSheet()
        ->getStyle('A1')
        ->getFill()
        ->setFillType(PHPExcel_Style_Fill::FILL_SOLID)
        ->getStartColor()
        ->setRGB('FF0000')

But if you bother using this over and over again, I recommend using applyFromArray.

在 PHPExcel 中设置背景单元格颜色

半城柳色半声笛 2024-12-02 07:53:55

请务必查看 Java Web Start。它可以从链接启动 JFrame,并提供许多部署优势。

Definitely check out Java Web Start. It can launch a JFrame from a link, and offers many deployment advantages.

小程序以外的选项

半城柳色半声笛 2024-12-02 07:15:07

PDF417.mobi 应该可以处理扭曲的条形码。我们尝试过打孔、弄脏、切断甚至沾上酱汁的代码。有一个相关视频

免责声明:我在 PDF417.mobi SDK 团队工作。我们开发这个 SDK 是出于对其他库不够可靠的沮丧。

PDF417.mobi should work with distorted barcodes. We have tried with codes that are perforated, smudged, cut-off and even covered with sauce. There is a video about that.

Disclaimer: I work for PDF417.mobi SDK team. We developed this SDK out of frustration that other libraries weren't reliable enough.

如何使用软件(不是 Zxing)在 Android 上可靠地解码 PDF417 条形码?

半城柳色半声笛 2024-12-02 01:20:52

除了 Score.recordNRT(这可能是更方便的方法之一,也是我不知道的方法)之外,还有很多不同的方法可以做到这一点。 DiskOut.arpathchannelsArray 作为 args。您还可以尝试 Server 具有的 .record 实例方法。以下是两者的示例(来自帮助文档):

DiskOut.ar 方式

// start something to record
x = Synth.new("bubbles");

// allocate a disk i/o buffer
b= Buffer.alloc(s, 65536, 2);

// create an output file for this buffer, leave it open
b.write("~/diskouttest.aiff".standardizePath, "aiff", "int16", 0, 0, true);
// create the diskout node; making sure it comes after the source
d = Synth.tail(nil, "help-Diskout", ["bufnum", b]);
// stop recording
d.free;
// stop the bubbles
x.free;
// close the buffer and the soundfile
b.close;
// free the buffer
b.free;

// play it back
(
x = Synth.basicNew("help-Diskin-2chan");
m = { arg buf; x.addToHeadMsg(nil, [\bufnum,buf])};

b = Buffer.cueSoundFile(s,"~/diskouttest.aiff".standardizePath, 0, 2, completionMessage: m);
)
x.free; b.close; b.free; // cleanup

Server.record 方式:

s.boot; // start the server

// something to record
(
SynthDef("bubbles", {
    var f, zout;
    f = LFSaw.kr(0.4, 0, 24, LFSaw.kr([8,7.23], 0, 3, 80)).midicps; // glissando function
    zout = CombN.ar(SinOsc.ar(f, 0, 0.04), 0.2, 0.2, 4); // echoing sine wave
    Out.ar(0, zout);
}).add;
SynthDef("tpulse", { arg out=0,freq=700,sawFreq=440.0;
    Out.ar(out, SyncSaw.ar(freq,  sawFreq,0.1) )
}).add;

)

x = Synth.new("bubbles");

s.prepareForRecord; // you have to call this first

s.record;

s.pauseRecording; // pausable

s.record // start again

s.stopRecording; // this closes the file and deallocates the buffer recording node, etc.

x.free; // stop the synths

// look in your recordings folder and you'll find a file named for this date and time    

There are lots of different ways to do this in addition to Score.recordNRT (which is maybe one of the more convenient ones, and also something I did not know about). DiskOut.ar takes path and channelsArray as args. You could also try the .record instance method that Server has. Here are examples (from the help docs) of both:

The DiskOut.ar way

// start something to record
x = Synth.new("bubbles");

// allocate a disk i/o buffer
b= Buffer.alloc(s, 65536, 2);

// create an output file for this buffer, leave it open
b.write("~/diskouttest.aiff".standardizePath, "aiff", "int16", 0, 0, true);
// create the diskout node; making sure it comes after the source
d = Synth.tail(nil, "help-Diskout", ["bufnum", b]);
// stop recording
d.free;
// stop the bubbles
x.free;
// close the buffer and the soundfile
b.close;
// free the buffer
b.free;

// play it back
(
x = Synth.basicNew("help-Diskin-2chan");
m = { arg buf; x.addToHeadMsg(nil, [\bufnum,buf])};

b = Buffer.cueSoundFile(s,"~/diskouttest.aiff".standardizePath, 0, 2, completionMessage: m);
)
x.free; b.close; b.free; // cleanup

The Server.record way:

s.boot; // start the server

// something to record
(
SynthDef("bubbles", {
    var f, zout;
    f = LFSaw.kr(0.4, 0, 24, LFSaw.kr([8,7.23], 0, 3, 80)).midicps; // glissando function
    zout = CombN.ar(SinOsc.ar(f, 0, 0.04), 0.2, 0.2, 4); // echoing sine wave
    Out.ar(0, zout);
}).add;
SynthDef("tpulse", { arg out=0,freq=700,sawFreq=440.0;
    Out.ar(out, SyncSaw.ar(freq,  sawFreq,0.1) )
}).add;

)

x = Synth.new("bubbles");

s.prepareForRecord; // you have to call this first

s.record;

s.pauseRecording; // pausable

s.record // start again

s.stopRecording; // this closes the file and deallocates the buffer recording node, etc.

x.free; // stop the synths

// look in your recordings folder and you'll find a file named for this date and time    

在 SuperCollider 中渲染文件声音的最佳方式是什么?

半城柳色半声笛 2024-12-01 19:16:46

我假设这是家庭作业,所以我给出方向,不一定是答案。

1) 如果我有关系 R(A,B,C),AB 为主键,F =
{},我可以假设 C 依赖于 AB 吗?我会说不,但我只是想问
确保。

当你没有得到任何函数依赖时,你知道如何识别函数依赖吗?在这种情况下,您会问自己以下问题:“给定 {A,B} 的值,这些值是否只能识别 {C} 的一个值?”如果答案是“是”,则说明存在函数依赖性;如果答案是“否”,那么你就不需要。

2) 我理所当然地认为 AB -> CDE 与 AB -> 相同。
C、AB-> D、AB-> E 和AB 一样-> CE、AB-> D、我说得对吗?

我不会说这“和说的一样”。我想说,从函数依赖 AB->CDE 中,您可以派生出所有其他函数依赖。

3) 取R(A,B,C,D),AB为主键,F = {AB->C}。这是
在2NF?我会说不,因为 D 不依赖于任何其他属性,让
单独的主键!

请参阅第 1 条。


扩展下面评论中的问题。 。 。

如果你说,{A,B} -> {每隔一列},那为什么不都是 1NF
2NF 中的关系?

因为并非每个 1NF 表都具有多列主键,并且并非每个具有多列主键的 1NF 表都具有仅由该键的一部分确定的其他列。

将 PK 想象为一个人的 ID。现在想象一下唯一的另一个
该关系中的属性是发现飞来的鸭子数量
97 年的亚利桑那州。 A和B之间不存在任何关系
在现实世界中,但从你所说的来看,人们会假设 A -> B.

哦,但是这两列之间存在某种关系。它们之间存在关系,因为将它们放在同一个表中。在该表中,如果您知道 A 的值,那么您就知道 B 的一个且仅有一个值。(如果 A 确定了 B 的多个值,则 A 不可能是主键。)

I'm assuming this is homework, so I'm giving direction, not necessarily answers.

1) If I have the relation R(A,B,C), being AB the primary key, and F =
{}, may I assume C depends on AB? I'd say no, but I'm asking just to
make sure.

Do you know how to identify a functional dependency when you're not given any? In this case, you ask yourself this question: "Given values for {A,B}, do those values identify one and only one value for {C}?" If the answer is "yes", you have a functional dependency; if the answer is "no", then you don't.

2) I'm taking for granted that AB -> CDE is the same as saying AB ->
C, AB -> D, AB -> E and as of saying AB -> CE, AB -> D. Am I right?

I wouldn't say it's "the same as saying". I'd say that from the functional dependency AB->CDE, you can derive all those other functional dependencies.

3) Take R(A,B,C,D), being AB the primary key with F = {AB->C}. Is this
in 2NF? I'd say no, as D doesn't depend on any other attribute, let
alone the primary key!

See number 1.


Expanding on questions in the comments below . . .

If you say, {A,B} -> {every other column}, then why aren't all 1NF
relations in 2NF?

Because not every 1NF table has a multi-column primary key, and not every 1NF table that does have a multi-column primary key has other columns determined by only part of that key.

Imagine a PK being the ID of a person. Now imagine the only other
attribute in that relation being the number of ducks found flying in
Arizona in '97. There isn't any kind of relationship between A and B
in the real world, yet from what you say, one'd assume A -> B.

Oh, but there is a relationship between those two columns. There's a relationship between them, because you put them in the same table. Within that table, if you know the value for A, then you know one and only one value for B. (If A determined more than one value for B, then A couldn't possibly be the primary key.)

几个标准化问题

半城柳色半声笛 2024-11-30 21:46:48

这是一个更简单的解决方案。您可以使用 GetPixelAddress(...) 代替所有这些 BITMAPHEADERINFO 和 SedDIBitsToDevice。我解决的另一个问题是 8 位图像,它需要定义颜色表。

CImage outImage;
outImage.Create(width, height, channelCount * 8);

int lineSize = width * channelCount;
if (channelCount == 1)
{
    // Define the color table
    RGBQUAD* tab = new RGBQUAD[256];
    for (int i = 0; i < 256; ++i)
    {
        tab[i].rgbRed = i;
        tab[i].rgbGreen = i;
        tab[i].rgbBlue = i;
        tab[i].rgbReserved = 0;
    }
    outImage.SetColorTable(0, 256, tab);
    delete[] tab;
}

// Copy pixel values
// Warining: does not convert from RGB to BGR
for ( int i = 0; i < height; i++ )
{
    void*       dst = outImage.GetPixelAddress(0, i);
    const void* src = /* put the pointer to the i'th source row here */;
    memcpy(dst, src, lineSize);
}

Here is a simpler solution. You can use GetPixelAddress(...) instead of all this BITMAPHEADERINFO and SedDIBitsToDevice. Another problem I have solved was with 8-bit images, which need to have the color table defined.

CImage outImage;
outImage.Create(width, height, channelCount * 8);

int lineSize = width * channelCount;
if (channelCount == 1)
{
    // Define the color table
    RGBQUAD* tab = new RGBQUAD[256];
    for (int i = 0; i < 256; ++i)
    {
        tab[i].rgbRed = i;
        tab[i].rgbGreen = i;
        tab[i].rgbBlue = i;
        tab[i].rgbReserved = 0;
    }
    outImage.SetColorTable(0, 256, tab);
    delete[] tab;
}

// Copy pixel values
// Warining: does not convert from RGB to BGR
for ( int i = 0; i < height; i++ )
{
    void*       dst = outImage.GetPixelAddress(0, i);
    const void* src = /* put the pointer to the i'th source row here */;
    memcpy(dst, src, lineSize);
}

从 Byte 数组创建 CImage

半城柳色半声笛 2024-11-26 15:55:30

解决了,有点。这里到底发生了什么仍然是个谜,但这里是问题的真正含义以及我如何解决它的准确总结。自动测试不是罪魁祸首 - 问题是在一批中运行所有测试。运行 rspec spec/**/* 会导致相同的错误。这是一个线索,表明问题与测试之间未能正确清理数据库有关。我正在使用设备,因此最终依赖 Warden 进行基于机架的身份验证。根据 Warden 文档,我调用了 Warden.test_reset!在 after(:suite) 块中。如果我将其移至 after(:all) 块,则无论单独运行、作为请求测试还是在一个块中运行所有测试,测试都会通过相同的测试。

那么我们学到了什么?我认为这个问题(至少对我来说)最终是由 rspec 挂钩的混乱命名引起的。我认为酒店的“套房”房间少于酒店的“所有”房间。但显然,rspec 示例的“套件”比“所有”示例更多。事实上,一套 rspec 示例只是“spec 目录下的所有示例”。在它们全部运行后清理典狱长没有效果。我们需要在每个规范之后清理它们 - 为此需要运行 test_reset!在 after(:all) 块中。

希望这对某人有帮助...

Solved, sort of. What is really going on here remains a mystery, but here is an accurate summary of what the problem really is, and how I resolved it. Autotest is not the culprit - the problem is running all the tests in one batch. Running rspec spec/**/* causes the same error. This is a clue that the issue is to do with a failure to clean up the database properly between tests. I am using devise, and so am ultimately relying on warden for rack-based authentication. Following the Warden documentation I put a call to Warden.test_reset! in the after(:suite) block. If I move this to the after(:all) block, the tests pass the same whether run individually, as request tests, or all the tests in one block.

So what did we learn? I think the problem (for me at least) was ultimately caused by a confusing naming of the rspec hooks. I think of a "suite" of rooms in a hotel as being less than "all" the rooms in a hotel. But apparently a "suite" of rspec examples is more than "all" the examples. In fact a suite of rspec examples is just "all the examples under the spec directory". Cleaning up warden after they have all been run has no effect. We need to clean them up after each spec - and to do that need to run test_reset! in the after(:all) block.

Hope this helps someone ...

autotest 和 rspec 给出不同的答案

半城柳色半声笛 2024-11-26 11:10:26

AFAIK replaceAll("///"","/////""); 如果你正确转义的话会起作用:转义字符是 \,而不是 /。尝试使用它来代替。

AFAIK replaceAll("///"","/////""); would work if you escaped correctly: the escape character is \, not /. Try using that instead.

Java删除包含引号的子字符串

更多

推荐作者

lee_heart

文章 0 评论 0

huangxaiorui

文章 0 评论 0

ゞ记忆︶ㄣ

文章 0 评论 0

画离情绘悲伤

文章 0 评论 0

文章 0 评论 0

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