灯角

文章 0 评论 0 浏览 23

灯角 2024-12-13 19:26:43

这个查询对我来说看起来很好。也许你应该创建一些索引?

如果尚未创建,则为 Analysis.User_Id 创建索引,为 Data.User_Id 创建索引(主键自动创建索引)。

或者也可以为包含 User_Id 和 Upgrade_Flag 列的 Analysis 创建索引。

The query looks fine to me. Maybe you should create some indexes?

Create index for Analysis.User_Id and index for Data.User_Id if not yet created (primary key creates index automatically).

Or maybe also create index for Analysis containing both columns User_Id and Upgrade_Flag.

我的查询存在性能问题。请提出建议

灯角 2024-12-13 11:45:00

是的。此行为在 Spring WebFlow 编辑器中可用。 SpringIDE 使用此编辑器提供基本的 WebFlow 编辑。如果您想要更复杂的图形编辑器,那么您应该下载 SpringSource 工具套件:

http://www.springsource。 com/developer/sts

可以将 STS 安装到现有的 Eclipse 实例中。

我必须说,我对您没有找到此功能感到有点惊讶,因为所有 webflow 文件都默认使用 webflow 编辑器。也许还有另一个问题正在发生。

Yes. This behavior is available in the Spring WebFlow editor. SpringIDE provides basic WebFlow editing using this editor. If you want a more sophisticated graphical editor, then you should download SpringSource Tool Suite:

http://www.springsource.com/developer/sts

It is possible to install STS into an existing Eclipse instance.

I must say that I am a little surprised that you are not finding this feature since the use of the webflow editor should be default for all webflow files. Perhaps there is another problem going on.

Eclipse:Spring WebFlow 中的 Spring bean 自动完成?

灯角 2024-12-13 10:56:39

你想要这样的东西吗?

[^\\d\\$,]

you want something like this?

[^\\d\\$,]

我想去掉除数字、$、逗号(,)之外的所有内容

灯角 2024-12-13 10:14:42

试试这个:

  SELECT *
    FROM (
         SELECT *, row_number() OVER (PARTITION BY division ORDER BY rank DESC) as rn
           FROM users
         ) as extended_users
   WHERE rn <= 2
ORDER BY userId

Try this:

  SELECT *
    FROM (
         SELECT *, row_number() OVER (PARTITION BY division ORDER BY rank DESC) as rn
           FROM users
         ) as extended_users
   WHERE rn <= 2
ORDER BY userId

SQL - 选择“n”群体中最大的元素

灯角 2024-12-13 04:00:32

这是一个脚本,可以在 40 秒(在我的机器上)内解析一百万个 /> 元素(967MB 文件),而不会消耗大量资源内存量。

吞吐量为24MB/scElementTree 页面 (2005) 报告 47MB/ s

#!/usr/bin/env python
from itertools import imap, islice, izip
from operator  import itemgetter
from xml.etree import cElementTree as etree

def parsexml(filename):
    it = imap(itemgetter(1),
              iter(etree.iterparse(filename, events=('start',))))
    root = next(it) # get root element
    for elem in it:
        if elem.tag == '{http://psi.hupo.org/ms/mzml}instrumentConfiguration':
            values = [('Id', elem.get('id')),
                      ('Parameter1', next(it).get('name'))] # cvParam
            componentList_count = int(next(it).get('count'))
            for parent, child in islice(izip(it, it), componentList_count):
                key = parent.tag.partition('}')[2]
                value = child.get('name')
                assert child.tag.endswith('cvParam')
                values.append((key, value))
            yield values
            root.clear() # preserve memory

def print_values(it):
    for line in (': '.join(val) for conf in it for val in conf):
        print(line)

print_values(parsexml(filename))

输出

$ /usr/bin/time python parse_mxml.py
Id: QTOF
Parameter1: Q-Tof ultima
source: nanoelectrospray
analyzer: quadrupole
analyzer: time-of-flight
detector: microchannel plate detector
38.51user 1.16system 0:40.09elapsed 98%CPU (0avgtext+0avgdata 23360maxresident)k
1984784inputs+0outputs (2major+1634minor)pagefaults 0swaps

注意:代码很脆弱,它假设 的前两个子项是 和所有值都可用作标记名称或属​​性。

在这种情况下,ElementTree 1.3 的性能

比 cElementTree 1.0.6 慢约 6 倍。

如果将 root.clear() 替换为 elem.clear(),则代码速度会加快约 10%,但内存会增加约 10 倍。 lxml.etreeelem.clear() 变体配合使用,性能与 cElementTree 相同,但消耗 20 (root .clear()) / 2 (elem.clear()) 倍内存 (500MB)。

Here's a script that parses one million <instrumentConfiguration/> elements (967MB file) in 40 seconds (on my machine) without consuming large amount of memory.

The throughput is 24MB/s. The cElementTree page (2005) reports 47MB/s.

#!/usr/bin/env python
from itertools import imap, islice, izip
from operator  import itemgetter
from xml.etree import cElementTree as etree

def parsexml(filename):
    it = imap(itemgetter(1),
              iter(etree.iterparse(filename, events=('start',))))
    root = next(it) # get root element
    for elem in it:
        if elem.tag == '{http://psi.hupo.org/ms/mzml}instrumentConfiguration':
            values = [('Id', elem.get('id')),
                      ('Parameter1', next(it).get('name'))] # cvParam
            componentList_count = int(next(it).get('count'))
            for parent, child in islice(izip(it, it), componentList_count):
                key = parent.tag.partition('}')[2]
                value = child.get('name')
                assert child.tag.endswith('cvParam')
                values.append((key, value))
            yield values
            root.clear() # preserve memory

def print_values(it):
    for line in (': '.join(val) for conf in it for val in conf):
        print(line)

print_values(parsexml(filename))

Output

$ /usr/bin/time python parse_mxml.py
Id: QTOF
Parameter1: Q-Tof ultima
source: nanoelectrospray
analyzer: quadrupole
analyzer: time-of-flight
detector: microchannel plate detector
38.51user 1.16system 0:40.09elapsed 98%CPU (0avgtext+0avgdata 23360maxresident)k
1984784inputs+0outputs (2major+1634minor)pagefaults 0swaps

Note: The code is fragile it assumes that the first two children of <instrumentConfiguration/> are <cvParam/> and <componentList/> and all values are available as tag names or attributes.

On performance

ElementTree 1.3 is ~6 times slower than cElementTree 1.0.6 in this case.

If you replace root.clear() by elem.clear() then the code is ~10% faster but ~10 times more memory. lxml.etree works with elem.clear() variant, the performance is the same as for cElementTree but it consumes 20 (root.clear()) / 2 (elem.clear()) times as much memory (500MB).

ElementTree(1.3.0) Python中XML解析的高效方法

灯角 2024-12-13 02:02:36

此页面是了解运行时的重要来源;快速内存辅助扫描显示标题为“那么 objc_msgSend 中会发生什么?”的部分。是立即获得答案的好地方,但整篇文章将真正帮助您了解正在发生的事情。

下面是一个示例,他在运行时查询适当的函数指针,然后直接调用该函数:

//declare C function pointer
int (computeNum *)(id,SEL,int);

//methodForSelector is COCOA & not ObjC Runtime
//gets the same function pointer objc_msgSend gets
computeNum = (int (*)(id,SEL,int))[target methodForSelector:@selector(doComputeWithNum:)];

//execute the C function pointer returned by the runtime
computeNum(obj,@selector(doComputeWithNum:),aNum); 

This page is a great source for understanding the runtime; a quick memory-assisted scan shows that the section titled "So what happens in objc_msgSend anyway?" is a good place to start for an immediate answer, but the article as a whole will really help you understand what goes on.

Here's an example where he queries the runtime for the appropriate function pointer, then calls the function directly:

//declare C function pointer
int (computeNum *)(id,SEL,int);

//methodForSelector is COCOA & not ObjC Runtime
//gets the same function pointer objc_msgSend gets
computeNum = (int (*)(id,SEL,int))[target methodForSelector:@selector(doComputeWithNum:)];

//execute the C function pointer returned by the runtime
computeNum(obj,@selector(doComputeWithNum:),aNum); 

非虚拟调用 Objective-C 函数

灯角 2024-12-13 00:44:00

您可以使用SQL Server 管理对象类库中的对象。

例如, Database 类实现IScriptable。我会用它作为我的起点(但我自己还没有这样做)。此生成的脚本可能包含太多不相关的内容,在这种情况下,您可能必须枚举各个表并为它们生成脚本。

但如今,SMO 始终是“我如何针对 SQL Server 执行管理任务 X?”的答案。

You would use the objects in the SQL Server Management Objects Class library.

For instance, the Database class implements IScriptable. I'd use that as my starting point (but I haven't done this myself). It's possible that the script this generates might have too much that isn't relevant, in which case you might have to enumerate individual tables and generate scripts for them.

But SMO is always the answer (these days) to "how do I do management task X against SQL Server?".

以编程方式重新创建现有的 SQL Server 数据库?

灯角 2024-12-12 22:40:12

尝试使用 Redrome.com 中的代码。它们展示了如何正确加载页面。

Try the code from Redrome.com. They show how to load the page properly.

如何在我的网站中创建 iPhone 测试器来报告网站是否适合移动设备

灯角 2024-12-12 16:50:40

对于您提到的第一个选项,TeamCity 中有一个请求:http://youtrack。 jetbrains.net/issue/TW-1619

For the first option, you've mentioned, there is a request in TeamCity: http://youtrack.jetbrains.net/issue/TW-1619

是否可以修复链接到 JetBrains YouTrack 的签到评论中的错误?

灯角 2024-12-12 09:22:26

为什么不简单地使用 text 属性?

NSString *urlAddress = [myLabel text];

Why don't you simply use text property?

NSString *urlAddress = [myLabel text];

如何让 UIWebView 加载网页,但 URL 位于 UILabel 上?

灯角 2024-12-12 09:19:41

好吧,您正在覆盖该值而不是添加新值。相反,为每个结果构造一个数组,并将这些数组添加到$jsonresult

另外,请确保避免 SQL 注入漏洞

$sql = "SELECT * FROM users WHERE user_name='".
       mysql_real_escape_string($_POST["user_name"]) . "' AND " .
       "user_password='". mysql_real_escape_string($_POST["user_password"]) ."'";
$result = mysql_query($sql) or die(mysql_error());
// Or better yet, use PDO and prepared statements

$jsonresult = array();
while (($row = mysql_fetch_array($result)) !== false) {
  $rowresult = array();
  $rowresult["user_auth"] = 1;
  $rowresult["user_id"] = $row['user_id'];
  $rowresult["user_name"] = $row['user_name'];
  $jsonresult[] = $rowresult; // Or array_push($jsonresult, $rowresult);
  // $_SESSION stuff
}

Well, you're overwriting the value instead of adding a new one. Instead, construct an array for each result, and add those arrays to $jsonresult.

Also, make sure to avoid SQL Injection vulnerabilities:

$sql = "SELECT * FROM users WHERE user_name='".
       mysql_real_escape_string($_POST["user_name"]) . "' AND " .
       "user_password='". mysql_real_escape_string($_POST["user_password"]) ."'";
$result = mysql_query($sql) or die(mysql_error());
// Or better yet, use PDO and prepared statements

$jsonresult = array();
while (($row = mysql_fetch_array($result)) !== false) {
  $rowresult = array();
  $rowresult["user_auth"] = 1;
  $rowresult["user_id"] = $row['user_id'];
  $rowresult["user_name"] = $row['user_name'];
  $jsonresult[] = $rowresult; // Or array_push($jsonresult, $rowresult);
  // $_SESSION stuff
}

在循环中添加到数组

灯角 2024-12-12 08:46:40

您可以使用 tee:

myscript.sh 2>&1 | tee logfile

这会将脚本的所有输出(stdout 和 stderr)打印到 stdout 和日志文件。

You can use tee:

myscript.sh 2>&1 | tee logfile

This will print all the output of your script (both stdout and stderr) to stdout and also to the logfile.

Unix shell脚本捕获Java进程错误?

灯角 2024-12-12 04:25:36

一次触摸就是一个点。尽管建议制作合理大小的控件,但当您触摸屏幕时,您得到的是一个点,而不是一个区域。该点将位于一个或另一个控件中。

您可以尝试拦截触摸并将其变成更大的矩形,看看是否同时覆盖两个按钮。

编辑

看看这个SO问题 查看拦截触摸的一种方法。

A touch is a point. Although the recommendation is to make controls of a reasonable size, when you touch the screen, you are getting a point, not a region. That point is going to be in one or other of the controls.

You could try to intercept the touch and turn it into a larger rectangle and see if that covers both the buttons at the same time.

EDIT

Have a look at this SO question to see one way of doing intercepting touches.

同时按下两个按钮

灯角 2024-12-12 02:42:34

像这样使用 ImageMagick 的 ping 功能怎么样:

identify -ping -format "%wx%h" http://www.google.com/logos/giroux1.jpg
482x142

How about using ImageMagick's ping functionality like this:

identify -ping -format "%wx%h" http://www.google.com/logos/giroux1.jpg
482x142

如何在不下载图像(完整)的情况下确定图像的大小?

灯角 2024-12-11 17:23:54

如果您可以将 Python 与脚本一起嵌入并使用类似 py2app,我想你可以添加/编辑 Info.plist 以满足 Apple 的签名要求。同样,对于权利,我想您可以 编辑 .app 的entitlements.plist。我认为沙箱执行器 sandboxd 不是特定于语言的,它只是允许/阻止进程对设备和文件的访问(例如,通过不授予受限文件描述符)。请记住,嵌入式 Python 解释器默认情况下可能需要访问某些权限才能进行初始化(因为它可能不是在创建时考虑到沙箱)。

对于 iOS 设备(必须经过沙盒处理才能在商店中销售),Apple 的政策(iOS 开发者计划协议第 3.3.2 节)是:

应用程序可能无法下载或安装可执行代码。如果所有脚本、代码和解释器都打包在应用程序中并且未下载,则解释的代码只能在应用程序中使用。

如果可能的话,上述解决方案似乎可以满足此要求(假设对 OS X 应用程序也有类似的规定)。但是,如果您对在 App Store 上分发您的应用程序不感兴趣,我认为您没有什么可担心的。我非常怀疑他们很快就会要求代码签名或授权才能在您的计算机上运行应用程序(而只是将 App Store 上出售的应用程序沙箱化,使其成为获取应用程序的“安全”场所)。

If you could embed Python along with your script and package it into a .app using something like py2app, I would imagine you could add/edit the Info.plist to satisfy Apple's requirements for signing. Similarly for entitlements, I would imagine you could edit the .app's entitlements.plist. I think the sandbox enforcer sandboxd is not language specific, it just allows/blocks the process's access to devices and files (for example, by not granting restricted file descriptors). Keep in mind, it's possible that an embedded Python interpreter would by default need access to some entitlements for initialization (because it may not be created with sandboxing in mind).

For iOS devices (which must be sandboxed to be sold on the store), Apple's policy (iOS developer program agreement section 3.3.2) is:

An Application may not download or install executable code. Interpreted code may only be used in an Application if all scripts, code and interpreters are packaged in the Application and not downloaded.

It seems that the above solution, if possible, would satisfy this requirement (assuming a similar stipulation would be made for OS X apps). However, if you are not interested in distributing your app on the App Store, I don't think you have anything to worry about. I very much doubt they will require code signing or entitlements for running applications on your computer anytime soon (instead just sandboxing those sold on the App Store, making it the 'safe' place to get apps).

Lion 的新安全模型将如何影响 Python 等事物?

更多

推荐作者

小瓶盖

文章 0 评论 0

wxsp_Ukbq8xGR

文章 0 评论 0

1638627670

文章 0 评论 0

仅一夜美梦

文章 0 评论 0

夜访吸血鬼

文章 0 评论 0

近卫軍团

文章 0 评论 0

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