半城柳色半声笛

文章 评论 浏览 26

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

你有很多代码。我将进行更深入的研究,但要点是,当渲染器的数据属性发生变化时,您不会更改组件。因此,渲染器如何知道何时更改其显示的值?

因此,第一个评论是,在 List 组件的初始渲染期间通常会创建单个渲染器。看到创作完成两次火灾并不罕见。

第二条评论是,对于任何初始化代码来说,creationComplete 通常都是一个可怕的地方。阅读 Spark 或 <一个href="http://livedocs.adobe.com/flex/3/html/help.html?content=ascomponents_advanced_2.html" rel="nofollow">光环。如果您想访问组件的子组件,则预初始化事件更好,或者初始化事件更好。

第三,您需要研究并阅读渲染回收。要点是,当您滚动列表时,每个渲染器都会被重复使用。数据发生变化。它不会被再次创建。 List 组件只是传入新数据并期望渲染器知道要做什么。您的“creationComplete”代码很可能需要移至 dataChange 事件处理程序。

第四,您应该利用 Flex 组件生命周期。看起来您的渲染和调整大小显示方法应该移至 updateDisplayList() 中,该方法应该处理子组件的大小调整和定位。

重新编写渲染器将花费相当多的时间;所以我半途放弃了。但是,请仔细阅读我提供的一些链接,尝试一下,如果遇到问题再回来。

You have a lot of code. I'll take a more in depth look, but the gist is that you are not changing your component when the data property of your renderer changes. As such, how will the renderer know when to change the values it displays?

So, first comment is that a single renderer is often created during the List component's initial rendering. This is not unusual to see a creationComplete fire twice.

Second comment is that creationComplete is often a horrible place for any initializing code. Read up on the Flex Component LifeCycle for Spark or Halo. The pre-initialize event is better, or the the initialze event if you want to access a component's children.

Third, you need to research and read about render recycling. The gist is that as you scroll through the list, each renderer is re-used. The data changes. It is not created again. The List component just passes in new data and expects the renderer to know what to do. Your 'creationComplete' code will most likely need to move to a dataChange event handler.

Fourth you should make use of the Flex Component LifeCycle. It looks like your render and resize display methods should move into updateDisplayList() which is supposed to handle sizing and positioning of the components children.

It's going to take quite a bit of time to re-write your renderer; so I gave up half way through. But, read through some of the links I provided, give a crack at it and come back if you have problems.

s:UIComponent 列表未通过自定义 ItemRenderer 很好地呈现

半城柳色半声笛 2024-12-25 06:25:10

这个问题是多余的。

如何忽略二进制序列化的事件类成员?

您在类中错过了 [Serialized] 属性,并且由于事件不可序列化,您需要将其标记为委托事件的 [field: NonSerialized]

This question is redundant.

How to ignore Event class member for binary serialization?

You missed [Serializable] attribute in your class and also because event is not serialable you need to mark it as [field: NonSerialized] to your delegate event.

我不知道为什么我的类无法序列化

半城柳色半声笛 2024-12-25 03:29:19

为父级提供某种类名或 id,然后使用它:

$('#s1').parent('.parent').toggle(false);

Give the parent some sort of classname or an id, and use that:

$('#s1').parent('.parent').toggle(false);

切换顶部父级
使用jquery从子元素

半城柳色半声笛 2024-12-25 02:27:56

就我而言,只需将此行添加到deploy.rb 文件中

set :scm, :git

In my case it was a matter of adding this line into deploy.rb file

set :scm, :git

Capistrano 不会创建版本

半城柳色半声笛 2024-12-24 22:48:20

我想说,由于问题中缺乏输入数据,移植需要 2-3 个月的时间。当然,如果这意味着同时学习 Obj-C,那将是一场艰苦的战斗。

OpenGL 在每个运行时都是相同的,因此移植应该很简单,甚至可以在本机应用程序的上下文中运行 JS。

Apple 并不关心你向 App Store 提交的内容,只要它有效即可。

I'd say it takes 2-3 months to port, with the lack of input data in the question. Of course if this means learning Obj-C simultaneously it will be some uphill battle.

OpenGL is all the same in every run-time, so porting should be straightforward, or even running JS in the context of a native app.

Apple doesnt care what you submit to App Store as long as it works.

将 WebGL 游戏移植到 iPhone 的原生 OpenGL?

半城柳色半声笛 2024-12-24 20:42:13

如果您只有一个应用程序使用 SQL Server,那么使用 SSRS 托管报告还有什么意义?

是的。

我认为只有当您要托管由多个单独的应用程序使用的报告时,SSRS 才有意义。

我可以想到针对单个应用程序进行 SSRS 部署的两个用例(尽管我确信还有更多):

  • 如果您有复杂的报告要求。需要大量 CPU 周期来构建的计算成本较高的报告(瓶颈:客户的 Celeron)、需要大量数据来构建的简单报告(瓶颈:客户的 ADSL)或介于两者之间的任何报告都属于此类。在功能强大的服务器上进行所有处理,然后将结果返回给客户端是有意义的。

  • 如果您希望轻松管理独立于应用程序版本的报告。我帮助维护一个应用程序,该应用程序在每个版本中都分发了应用程序和报告。因为新版本通常是一件大事,所以我们尽可能避免它们。这意味着,如果应用程序不需要维护,我们可以在发布之间间隔 3 个月。这意味着对报告的小修复不会尽快推送给客户。新报告也是如此(客户喜欢新报告)。如果一切都通过 SSRS 控制,我们可以根据需要添加/编辑/删除报告。

后一种用例需要随时访问 SSRS 才有意义,它可能最适合多租户应用程序。

Is there any point in using SSRS to host your reports if you are only going to have one application using your SQL Server?

Yes.

I would have thought SSRS makes sense only if you are going to host reports that are going to be consumed by several separate applications.

I can think of two use cases for SSRS deployments for single applications (although I'm sure there are more):

  • If you have complex reporting requirements. Computationally expensive reports that require lots of CPU cycles to construct (bottleneck: Client's Celeron), simple reports that require lots of data to build (bottleneck: Client's ADSL), or anything in between will fall in to this category. It makes sense to do all the processing on powerful servers, and then render the result back to the client.

  • If you want easy management of reports separate to application releases. I help maintain an application which has both the application and reports distributed in each release. Because new releases are typically a big deal, we avoid them where possible. This means that if there's no maintenance required in the application, we can go 3 months between releases. This means small fixes to reports aren't pushed out to clients as fast as possible. Same goes for new reports (clients love new reports). If everything was controlled via SSRS, we could add/edit/remove reports as required.

The latter use case requires readily available access to SSRS to make sense, it's probably best suited to multi-tenant applications.

SQL Server Reporting Services 具有单个离散应用程序?

半城柳色半声笛 2024-12-24 18:09:48

奇怪的是你不能创建 10000 个元素的长数组。我相信你的问题不是数组长度而是特定数组元素的值。无论如何,如果您需要更大的数组,请使用列表。具体来说是java.util.LinkedList。

It is strange that you cannot create 10000 elements long array. I believe that your problem is not the array length but the value of particular array element. Anyway if you need bigger arrays use Lists instead. Specifically java.util.LinkedList.

Java中如何处理大数组

半城柳色半声笛 2024-12-24 15:56:49

假设您的 Flash 对象位于 id 为“mydiv”的 div 内:

<div id="mydiv">
<!--Your flash object goes here -->
</div>

假设您在文档中导入了 JQuery。
然后,当您想要删除 Flash 视频时,您可以执行以下操作:

$("#mydiv").html("");

这基本上会清空 div 的内容,从而删除视频。
链接到演示效果的小提琴:http://jsfiddle.net/xCc5H/2/

注意:
unloadmovie是在actionscript中而不是在javascript中

Let's say your flash object is inside a div with the id "mydiv":

<div id="mydiv">
<!--Your flash object goes here -->
</div>

Let's assume that you imported JQuery in your document.
Then, as soon as you want to delete the flash video you do:

$("#mydiv").html("");

This will basically empty the content of the div, removing the video.
Link to a fiddle that demonstrates the effect: http://jsfiddle.net/xCc5H/2/.

NB:
unloadmovie is in actionscript and not javascript

播放后从 HTML 中删除 .swf

半城柳色半声笛 2024-12-24 13:02:01

在 C++ 中,您需要在调用函数之前定义或至少声明它们。

到目前为止,您正在尝试做的是这样的:

int main()
{
   cout << b;
   int b = 10;
}

所以您也可以这样尝试:

#include <iostream>
using namespace std;  

void HelloWorld();

int main()  
{
    HelloWorld();
    return 0;  
}
void HelloWorld()
{
  cout << "Hello, World" << endl;  
} 

在 C++ 中,在主函数之前定义所有其他函数是一个很好的做法。

in C++ you need to define or at least declare the functions before calling them.

What you are trying to do till now is something like this :

int main()
{
   cout << b;
   int b = 10;
}

So you can also trying like this :

#include <iostream>
using namespace std;  

void HelloWorld();

int main()  
{
    HelloWorld();
    return 0;  
}
void HelloWorld()
{
  cout << "Hello, World" << endl;  
} 

It is a good practice in C++ to define all other functions before the main function.

为什么我的 HelloWorld 函数没有在此范围内声明?

半城柳色半声笛 2024-12-24 10:31:28

您需要将对项目 A 的引用添加到项目 B - 右键单击​​解决方案资源管理器中的项目节点,选择引用,然后选择项目,然后选择项目 A。

然后您将可以访问项目 A 中的所有类型。

请参阅 MSDN 上的此操作方法

You need to add a reference to Project A to project B - right click on the project node in the solution explorer, select references, then projects then Project A.

You will then have access to all the types in Project A.

See this How To on MSDN.

在项目之间共享变量

半城柳色半声笛 2024-12-24 10:04:53

我的答案看起来更像是评论,但它太长,无法放入评论(并且无法正确格式化)。

如何循环范围

我建议您查看 Chip Pearson 页面 了解有关优化 VBA,尤其是 VBA 中的范围循环。

当您遍历范围时,您应该使用 foreach 语句,如本示例中所述:

Dim WS as Worksheet
For Each WS In Worksheets
    MsgBox WS.Name
Next WS

Dim i as Integer
For i = 1 To Worksheets.Count
    MsgBox Worksheets(i).Name
Next i

查找最后一个空单元格

您的代码似乎尝试查找最后一个空单元格。您可以轻松地使用

With ActiveWorkbook.Worksheets("Sheet1")
    .Cells(.Rows.Count,1).End(xlUp)
End With

您可以在 ozgrid 上找到更多提示(即使它们不要使用rows.count

避免选择

如果您尝试选择循环中的每个单元格,您的代码将会非常非常慢

你最好使用VBA的对象模型
例如,如果您只想复制单元格的

不做

Range("A1").Select
Selection.Copy
Range("A2").Select
Selection.Paste

Range("A2").Value = Range("A1").Value

My answer will better look like a comment but it is too long to fit in a comment (and cannot be formatted properly).

How to loop over a range

I advise you to have a look at Chip Pearson page about optimizing VBA, especially looping over range in VBA.

When you loop over range, you shoul use the for each statement as described in this example:

Dim WS as Worksheet
For Each WS In Worksheets
    MsgBox WS.Name
Next WS

Dim i as Integer
For i = 1 To Worksheets.Count
    MsgBox Worksheets(i).Name
Next i

Finding the last empty cell

Your code seems to try to find the last empty cell. You can do it easily with

With ActiveWorkbook.Worksheets("Sheet1")
    .Cells(.Rows.Count,1).End(xlUp)
End With

You can find some more tips on ozgrid (even if they don't use rows.count)

Avoiding Selects

Your code will be very very slow if you are trying to Select every cell in a loop.

You'd better use the object model of VBA.
For instance, if you only want to copy the value of a cell:

Don't do

Range("A1").Select
Selection.Copy
Range("A2").Select
Selection.Paste

Do

Range("A2").Value = Range("A1").Value

如何将单元格值设置为循环内容?

半城柳色半声笛 2024-12-24 09:23:54

像这样的东西应该可以工作:

container
    .RegisterType<LoaderInputReader>(
        "us",
        new InjectionConstructor(
            @"\\ad1\accounting$\Xml\qb_us.xml",
            new ResolvedParameter<Company>(),
            new ResolvedParameter<eTargets>()));
container
    .RegisterType<LoaderInputReader>(
        "intl",
        new InjectionConstructor(
            @"\\ad1\accounting$\Xml\qb_intl.xml",
            new ResolvedParameter<Company>(),
            new ResolvedParameter<eTargets>()));

这为 LoaderInputReader 的每个注册命名。现在你可以这样解决:

var us = container.Resolve<LoaderInputReader>("us");
var intl = container.Resolve<LoaderInputReader>("intl");

Something like this ought to work:

container
    .RegisterType<LoaderInputReader>(
        "us",
        new InjectionConstructor(
            @"\\ad1\accounting$\Xml\qb_us.xml",
            new ResolvedParameter<Company>(),
            new ResolvedParameter<eTargets>()));
container
    .RegisterType<LoaderInputReader>(
        "intl",
        new InjectionConstructor(
            @"\\ad1\accounting$\Xml\qb_intl.xml",
            new ResolvedParameter<Company>(),
            new ResolvedParameter<eTargets>()));

This names each registration of LoaderInputReader. Now you can resolve like this:

var us = container.Resolve<LoaderInputReader>("us");
var intl = container.Resolve<LoaderInputReader>("intl");

使用 Unity 改变构造函数注入的字符串参数

半城柳色半声笛 2024-12-24 08:26:24
$sql = "SELECT COUNT(*) FROM users WHERE username = '$username'";
$sql = $this->db->quote($sql);

您正在引用整个查询,这没有任何意义,并且从安全角度来看是完全危险的 - 并且可能会导致无效的查询。

这是更正确的代码:

// return TRUE if user is available
public function isUsernameAvailable($username) {
    $sql = "SELECT id FROM users WHERE username = :username";
    $stmt = $this->db->prepare($sql);
    $stmt->execute(array(':username' => $username));

    return $stmt->fetch() === FALSE;
}


if (!$user->isUsernameAvailable($_POST['username'])) {
    echo 'The username is already taken!';
    $error = 1;
}
$sql = "SELECT COUNT(*) FROM users WHERE username = '$username'";
$sql = $this->db->quote($sql);

You are quoting the whole query, this does not make any sense and is outright dangerous from a security standpoint – and probably results in an invalid query anyway.

Here's a more proper code:

// return TRUE if user is available
public function isUsernameAvailable($username) {
    $sql = "SELECT id FROM users WHERE username = :username";
    $stmt = $this->db->prepare($sql);
    $stmt->execute(array(':username' => $username));

    return $stmt->fetch() === FALSE;
}


if (!$user->isUsernameAvailable($_POST['username'])) {
    echo 'The username is already taken!';
    $error = 1;
}

pdo - 用户名已经存在,但还不是

半城柳色半声笛 2024-12-24 05:17:10

目前,RubyMine 依赖 Rails 框架将 CoffeeScript 编译为 JavaScript。

PhpStorm/WebStorm 产品中提供了尖端的 CoffeeScript 支持,EAP 版本将于 2011 年底发布。您可以在 http://confluence.jetbrains.net/display/WI/Web+IDE+EAP

观看该问题以了解进展情况。

最新版本有编译 CoffeeScript 的操作,但它只是显示一个包含结果的窗口,而不写入任何文件(帮助 | 查找操作 | 编译 Coffeescript 文件,或将其绑定到设置 | 键盘映射中的键盘快捷键)。

请注意,它仍在进行中,更多功能很快就会推出。目前,您可能可以使用命令行外部工具来设置编译。

RubyMine relies on Rails framework for CoffeeScript to JavaScript compilation at the moment.

Cutting edge CoffeeScript support is available in PhpStorm/WebStorm products, in the EAP versions to be released by the end of 2011. You can download and try them at http://confluence.jetbrains.net/display/WI/Web+IDE+EAP.

Watch the issue for progress.

Latest version has an action to compile CoffeeScript, but it just displays a window with the result without writing any files (Help | Find Action | Compile Coffeescript File, or bind it to keyboard shortcut in Settings | Keymap).

Note that it's still work in progress, more features will be available soon. At the moment you can probably set up compilation using command line external tools.

适用于 Windows 的 CoffeeScript IDE - 尝试过 Titanium Studio 和 RubyMine

半城柳色半声笛 2024-12-24 05:08:10
def myClassOf[T:ClassTag] = implicitly[ClassTag[T]].runtimeClass
def myClassOf[T:ClassTag] = implicitly[ClassTag[T]].runtimeClass

Scala - 从泛型类型获取类对象

更多

推荐作者

kaipeng

文章 0 评论 0

吐个泡泡

文章 0 评论 0

沧桑㈠

文章 0 评论 0

御宅男

文章 0 评论 0

泪眸﹌

文章 0 评论 0

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